diff options
Diffstat (limited to 'nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds')
3 files changed, 122 insertions, 131 deletions
diff --git a/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/boot.nix b/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/boot.nix new file mode 100644 index 000000000000..318e2728fc2e --- /dev/null +++ b/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/boot.nix @@ -0,0 +1,91 @@ +{ stdenv, appleDerivation, fetchzip, bsdmake, perl, flex, yacc +}: + +# this derivation sucks +# locale data was removed after adv_cmds-118, so our base is that because it's easier than +# replicating the bizarre bsdmake file structure +# +# sadly adv_cmds-118 builds a mklocale and colldef that generate files that our libc can no +# longer understand +# +# the more recent adv_cmds release is used for everything else in this package + +let recentAdvCmds = fetchzip { + url = "http://opensource.apple.com/tarballs/adv_cmds/adv_cmds-158.tar.gz"; + sha256 = "0z081kcprzg5jcvqivfnwvvv6wfxzkjg2jc2lagsf8c7j7vgm8nn"; +}; + +in appleDerivation { + nativeBuildInputs = [ bsdmake perl yacc flex ]; + buildInputs = [ flex ]; + + patchPhase = '' + substituteInPlace BSDmakefile \ + --replace chgrp true \ + --replace /Developer/Makefiles/bin/compress-man-pages.pl true \ + --replace "ps.tproj" "" --replace "gencat.tproj" "" --replace "md.tproj" "" \ + --replace "tabs.tproj" "" --replace "cap_mkdb.tproj" "" \ + --replace "!= tconf --test TARGET_OS_EMBEDDED" "= NO" + + substituteInPlace Makefile --replace perl true + + for subproject in colldef mklocale monetdef msgdef numericdef timedef; do + substituteInPlace usr-share-locale.tproj/$subproject/BSDmakefile \ + --replace /usr/share/locale "" \ + --replace '-o ''${BINOWN} -g ''${BINGRP}' "" \ + --replace "rsync -a" "cp -r" + done + ''; + + preBuild = '' + cp -r --no-preserve=all ${recentAdvCmds}/colldef . + pushd colldef + mv locale/collate.h . + flex -t -8 -i scan.l > scan.c + yacc -d parse.y + clang *.c -o colldef -lfl + popd + mv colldef/colldef colldef.tproj/colldef + + cp -r --no-preserve=all ${recentAdvCmds}/mklocale . + pushd mklocale + flex -t -8 -i lex.l > lex.c + yacc -d yacc.y + clang *.c -o mklocale -lfl + popd + mv mklocale/mklocale mklocale.tproj/mklocale + ''; + + buildPhase = '' + runHook preBuild + + bsdmake -C usr-share-locale.tproj + + clang ${recentAdvCmds}/ps/*.c -o ps + ''; + + installPhase = '' + bsdmake -C usr-share-locale.tproj install DESTDIR="$locale/share/locale" + + # need to get rid of runtime dependency on flex + # install -d 0755 $locale/bin + # install -m 0755 colldef.tproj/colldef $locale/bin + # install -m 0755 mklocale.tproj/mklocale $locale/bin + + install -d 0755 $ps/bin + install ps $ps/bin/ps + touch "$out" + ''; + + outputs = [ + "out" + "ps" + "locale" + ]; + setOutputFlags = false; + + meta = { + platforms = stdenv.lib.platforms.darwin; + maintainers = with stdenv.lib.maintainers; [ gridaphobe ]; + }; +} diff --git a/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/default.nix b/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/default.nix index 1d8ebac74b0e..0cbd7d81b902 100644 --- a/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/default.nix +++ b/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/default.nix @@ -1,69 +1,36 @@ -{ stdenv, appleDerivation, fetchzip, bsdmake, perl, flex, yacc -}: +{ stdenv, appleDerivation, xcbuild, ncurses, libutil }: -# this derivation sucks -# locale data was removed after adv_cmds-118, so our base is that because it's easier than -# replicating the bizarre bsdmake file structure -# -# sadly adv_cmds-118 builds a mklocale and colldef that generate files that our libc can no -# longer understand -# -# the more recent adv_cmds release is used for everything else in this package +appleDerivation { + # We can't just run the root build, because https://github.com/facebook/xcbuild/issues/264 -let recentAdvCmds = fetchzip { - url = "https://opensource.apple.com/tarballs/adv_cmds/adv_cmds-158.tar.gz"; - sha256 = "0z081kcprzg5jcvqivfnwvvv6wfxzkjg2jc2lagsf8c7j7vgm8nn"; -}; - -in appleDerivation { - nativeBuildInputs = [ bsdmake perl yacc flex ]; - buildInputs = [ flex ]; + # pkill requires special private headers that are unavailable in + # NixPkgs. These ones are needed: + # - xpc/xpxc.h + # - os/base_private.h + # - _simple.h + # We disable it here for now. TODO: build pkill inside adv_cmds + # We also disable locale here because of some issues with a missing + # "lstdc++". patchPhase = '' - substituteInPlace BSDmakefile \ - --replace chgrp true \ - --replace /Developer/Makefiles/bin/compress-man-pages.pl true \ - --replace "ps.tproj" "" --replace "gencat.tproj" "" --replace "md.tproj" "" \ - --replace "tabs.tproj" "" --replace "cap_mkdb.tproj" "" \ - --replace "!= tconf --test TARGET_OS_EMBEDDED" "= NO" - - substituteInPlace Makefile --replace perl true - - for subproject in colldef mklocale monetdef msgdef numericdef timedef; do - substituteInPlace usr-share-locale.tproj/$subproject/BSDmakefile \ - --replace /usr/share/locale "" \ - --replace '-o ''${BINOWN} -g ''${BINGRP}' "" \ - --replace "rsync -a" "cp -r" - done - ''; - - preBuild = '' - cp -r --no-preserve=all ${recentAdvCmds}/colldef . - pushd colldef - mv locale/collate.h . - flex -t -8 -i scan.l > scan.c - yacc -d parse.y - clang *.c -o colldef -lfl - popd - mv colldef/colldef colldef.tproj/colldef - - cp -r --no-preserve=all ${recentAdvCmds}/mklocale . - pushd mklocale - flex -t -8 -i lex.l > lex.c - yacc -d yacc.y - clang *.c -o mklocale -lfl - popd - mv mklocale/mklocale mklocale.tproj/mklocale + substituteInPlace adv_cmds.xcodeproj/project.pbxproj \ + --replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" \ + --replace "FDF278D60FC6204E00D7A3C6 /* locale.cc in Sources */," "" \ + --replace '/usr/lib/libtermcap.dylib' 'libncurses.dylib' ''; buildPhase = '' - runHook preBuild - - bsdmake -C usr-share-locale.tproj + targets=$(xcodebuild -list \ + | awk '/Targets:/{p=1;print;next} p&&/^\s*$/{p=0};p' \ + | tail -n +2 | sed 's/^[ \t]*//' \ + | grep -v -e Desktop -e Embedded -e mklocale -e colldef) - clang ${recentAdvCmds}/ps/*.c -o ps + for i in $targets; do + xcodebuild SYMROOT=$PWD/Products OBJROOT=$PWD/Intermediates -target $i + done ''; + # temporary install phase until xcodebuild has "install" support installPhase = '' for f in Products/Release/*; do if [ -f $f ]; then @@ -71,27 +38,19 @@ in appleDerivation { fi done - bsdmake -C usr-share-locale.tproj install DESTDIR="$locale/share/locale" - - # need to get rid of runtime dependency on flex - # install -d 0755 $locale/bin - # install -m 0755 colldef.tproj/colldef $locale/bin - # install -m 0755 mklocale.tproj/mklocale $locale/bin + mkdir -p $out/System/Library/LaunchDaemons + install fingerd/finger.plist $out/System/Library/LaunchDaemons - install -d 0755 $ps/bin - install ps $ps/bin/ps - touch "$out" + # from variant_links.sh + # ln -s $out/bin/pkill $out/bin/pgrep + # ln -s $out/share/man/man1/pkill.1 $out/share/man/man1/pgrep.1 ''; - outputs = [ - "out" - "ps" - "locale" - ]; - setOutputFlags = false; + nativeBuildInputs = [ xcbuild ]; + buildInputs = [ ncurses libutil ]; meta = { platforms = stdenv.lib.platforms.darwin; - maintainers = with stdenv.lib.maintainers; [ gridaphobe ]; + maintainers = with stdenv.lib.maintainers; [ matthewbauer ]; }; } diff --git a/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix b/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix deleted file mode 100644 index 45912041a24c..000000000000 --- a/nixpkgs/pkgs/os-specific/darwin/apple-source-releases/adv_cmds/xcode.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ stdenv, appleDerivation, xcbuild, ncurses, libutil-new }: - -appleDerivation { - # We can't just run the root build, because https://github.com/facebook/xcbuild/issues/264 - - # pkill requires special private headers that are unavailable in - # NixPkgs. These ones are needed: - # - xpc/xpxc.h - # - os/base_private.h - # - _simple.h - # We disable it here for now. TODO: build pkill inside adv_cmds - - # We also disable locale here because of some issues with a missing - # "lstdc++". - patchPhase = '' - substituteInPlace adv_cmds.xcodeproj/project.pbxproj \ - --replace "FD201DC214369B4200906237 /* pkill.c in Sources */," "" \ - --replace "FDF278D60FC6204E00D7A3C6 /* locale.cc in Sources */," "" \ - --replace '/usr/lib/libtermcap.dylib' 'libncurses.dylib' \ - --replace 'DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";' "" - ''; - - buildPhase = '' - targets=$(xcodebuild -list \ - | awk '/Targets:/{p=1;print;next} p&&/^\s*$/{p=0};p' \ - | tail -n +2 | sed 's/^[ \t]*//' \ - | grep -v -e Desktop -e Embedded -e mklocale -e colldef) - - for i in $targets; do - xcodebuild SYMROOT=$PWD/Products OBJROOT=$PWD/Intermediates -target $i - done - ''; - - # temporary install phase until xcodebuild has "install" support - installPhase = '' - mkdir -p $out/bin/ - install Products/Release/* $out/bin/ - - for n in 1 8; do - mkdir -p $out/share/man/man$n - install */*.$n $out/share/man/man$n - done - - mkdir -p $out/System/Library/LaunchDaemons - install fingerd/finger.plist $out/System/Library/LaunchDaemons - - # from variant_links.sh - # ln -s $out/bin/pkill $out/bin/pgrep - # ln -s $out/share/man/man1/pkill.1 $out/share/man/man1/pgrep.1 - ''; - - nativeBuildInputs = [ xcbuild ]; - buildInputs = [ ncurses libutil-new ]; - - meta = { - platforms = stdenv.lib.platforms.darwin; - maintainers = with stdenv.lib.maintainers; [ matthewbauer ]; - }; -} |