darwin.developer_cmds: convert to Meson and use mkAppleDerivation

This commit is contained in:
Randy Eckenrode 2024-09-21 22:46:04 -04:00
parent b8dbc16f1b
commit 83807dc4e9
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9
6 changed files with 120 additions and 108 deletions

View File

@ -309,7 +309,7 @@ developerToolsPackages_11_3_1 // macosPackages_11_0_1 // {
Librpcsvc = applePackage "Librpcsvc" "osx-10.11.6" "sha256-YHbGws901xONzAbo6sB5zSea4Wp0sgYUJ8YgwVfWxnE=" {};
adv_cmds = callPackage ./adv_cmds/package.nix { };
basic_cmds = callPackage ./basic_cmds/package.nix { };
developer_cmds = applePackage "developer_cmds" "osx-10.11.6" "sha256-h0wMVlS6QdRvKOVJ74W9ziHYGApjvnk77AIR6ukYBRo=" {};
developer_cmds = callPackage ./developer_cmds/package.nix { };
diskdev_cmds = applePackage "diskdev_cmds" "osx-10.11.6" "sha256-VX+hcZ7JhOA8EhwLloPlM3Yx79RXp9OYHV9Mi10uw3Q=" {
macosPackages_11_0_1 = macosPackages_11_0_1;
};

View File

@ -1,41 +0,0 @@
{ lib, appleDerivation, xcbuildHook, llvmPackages, makeWrapper }:
appleDerivation {
nativeBuildInputs = [ xcbuildHook makeWrapper ];
patches = [
# The following copied from
# https://github.com/Homebrew/homebrew-core/commit/712ed3e948868e17f96b7e59972b5f45d4faf688
# is needed to build libvirt.
./rpcgen-support-hyper-and-quad-types.patch
];
postPatch = ''
makeWrapper ${llvmPackages.clang}/bin/clang $out/bin/clang-cpp --add-flags "--driver-mode=cpp"
substituteInPlace rpcgen/rpc_main.c \
--replace "/usr/bin/cpp" "$out/bin/clang-cpp"
'';
# Workaround build failure on -fno-common toolchains:
# duplicate symbol '_btype_2' in:args.o pr_comment.o
env.NIX_CFLAGS_COMPILE = "-fcommon";
# temporary install phase until xcodebuild has "install" support
installPhase = ''
for f in Products/Release/*; do
if [ -f $f ]; then
install -D $f $out/bin/$(basename $f)
fi
done
for n in 1; do
mkdir -p $out/share/man/man$n
install */*.$n $out/share/man/man$n
done
'';
meta = {
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ matthewbauer ];
};
}

View File

@ -0,0 +1,80 @@
# Build settings based on the upstream Xcode project.
# See: https://github.com/apple-oss-distributions/developer_cmds/blob/main/developer_cmds.xcodeproj/project.pbxproj
# Project settings
project('developer_cmds', 'c', version : '@version@')
# Dependencies
cc = meson.get_compiler('c')
# Binaries
executable(
'asa',
install : true,
sources : [ 'asa/asa.c' ],
)
install_man('asa/asa.1')
executable(
'ctags',
install : true,
sources : [
'ctags/C.c',
'ctags/ctags.c',
'ctags/fortran.c',
'ctags/lisp.c',
'ctags/print.c',
'ctags/tree.c',
'ctags/yacc.c',
],
)
install_man('ctags/ctags.1')
executable(
'indent',
install : true,
sources : [
'indent/args.c',
'indent/indent.c',
'indent/io.c',
'indent/lexi.c',
'indent/parse.c',
'indent/pr_comment.c',
],
)
install_man('indent/indent.1')
install_data(
'lorder/lorder.sh',
install_dir : get_option('bindir'),
install_mode : 'r-xr-xr-x',
rename : 'lorder'
)
install_man('lorder/lorder.1')
executable(
'rpcgen',
install : true,
sources : [
'rpcgen/rpc_clntout.c',
'rpcgen/rpc_cout.c',
'rpcgen/rpc_hout.c',
'rpcgen/rpc_main.c',
'rpcgen/rpc_parse.c',
'rpcgen/rpc_sample.c',
'rpcgen/rpc_scan.c',
'rpcgen/rpc_svcout.c',
'rpcgen/rpc_tblout.c',
'rpcgen/rpc_util.c',
],
)
install_man('rpcgen/rpcgen.1')
executable(
'unifdef',
install : true,
sources : [ 'unifdef/unifdef.c' ],
)
install_man('unifdef/unifdef.1')

View File

@ -0,0 +1,35 @@
{
lib,
clang,
mkAppleDerivation,
buildPackages,
shell_cmds,
}:
mkAppleDerivation {
releaseName = "developer_cmds";
outputs = [
"out"
"man"
];
xcodeHash = "sha256-4Ucyy4esmaekoVysvDTGq5/F/zH2CfU+iGmsmYykLa8=";
postPatch = ''
substituteInPlace rpcgen/rpc_main.c \
--replace-fail '/usr/bin/cpp' '${lib.getBin buildPackages.clang}/bin/${buildPackages.clang.targetPrefix}cpp'
'';
postInstall = ''
HOST_PATH='${lib.getBin shell_cmds}/bin' patchShebangs --host "$out/bin"
'';
meta = {
description = "Developer commands for Darwin";
license = [
lib.licenses.bsd3
lib.licenses.bsdOriginal
];
};
}

View File

@ -1,66 +0,0 @@
diff --git a/rpcgen/rpc_parse.c b/rpcgen/rpc_parse.c
index 52edc9f..db0c1f1 100644
--- a/rpcgen/rpc_parse.c
+++ b/rpcgen/rpc_parse.c
@@ -580,6 +580,10 @@ get_type(prefixp, typep, dkind)
*typep = "long";
(void) peekscan(TOK_INT, &tok);
break;
+ case TOK_HYPER:
+ *typep = "int64_t";
+ (void) peekscan(TOK_INT, &tok);
+ break;
case TOK_VOID:
if (dkind != DEF_UNION && dkind != DEF_PROGRAM) {
error("voids allowed only inside union and program definitions with one argument");
@@ -592,6 +596,7 @@ get_type(prefixp, typep, dkind)
case TOK_INT:
case TOK_FLOAT:
case TOK_DOUBLE:
+ case TOK_QUAD:
case TOK_BOOL:
*typep = tok.str;
break;
@@ -622,6 +627,11 @@ unsigned_dec(typep)
*typep = "u_long";
(void) peekscan(TOK_INT, &tok);
break;
+ case TOK_HYPER:
+ get_token(&tok);
+ *typep = "u_int64_t";
+ (void) peekscan(TOK_INT, &tok);
+ break;
case TOK_INT:
get_token(&tok);
*typep = "u_int";
diff --git a/rpcgen/rpc_scan.c b/rpcgen/rpc_scan.c
index a8df441..4130107 100644
--- a/rpcgen/rpc_scan.c
+++ b/rpcgen/rpc_scan.c
@@ -419,8 +419,10 @@ static token symbols[] = {
{TOK_UNSIGNED, "unsigned"},
{TOK_SHORT, "short"},
{TOK_LONG, "long"},
+ {TOK_HYPER, "hyper"},
{TOK_FLOAT, "float"},
{TOK_DOUBLE, "double"},
+ {TOK_QUAD, "quadruple"},
{TOK_STRING, "string"},
{TOK_PROGRAM, "program"},
{TOK_VERSION, "version"},
diff --git a/rpcgen/rpc_scan.h b/rpcgen/rpc_scan.h
index bac2be4..e4c57c8 100644
--- a/rpcgen/rpc_scan.h
+++ b/rpcgen/rpc_scan.h
@@ -66,9 +66,11 @@ enum tok_kind {
TOK_INT,
TOK_SHORT,
TOK_LONG,
+ TOK_HYPER,
TOK_UNSIGNED,
TOK_FLOAT,
TOK_DOUBLE,
+ TOK_QUAD,
TOK_OPAQUE,
TOK_CHAR,
TOK_STRING,

View File

@ -22,5 +22,9 @@
"copyfile": {
"hash": "sha256-uHqLFOIpXK+n0RHyOZzVsP2DDZcFDivKCnqHBaXvHns=",
"version": "138"
},
"developer_cmds": {
"hash": "sha256-h0wMVlS6QdRvKOVJ74W9ziHYGApjvnk77AIR6ukYBRo=",
"version": "62"
}
}