From ebb8d03f96e3f1bf8491a3f74540d2cbb47da294 Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Tue, 3 Feb 2015 14:06:13 -0800 Subject: [PATCH] darwin-specific stuff --- pkgs/os-specific/darwin/adv_cmds/ps.nix | 35 +++++ .../darwin/bootstrap-cmds/default.nix | 46 +++++++ .../darwin/cctools-port/default.nix | 64 --------- pkgs/os-specific/darwin/cctools/darwin.patch | 122 ++++++++++++++++++ .../ld-ignore-rpath-link.patch | 0 .../ld-rpath-nonfinal.patch | 0 pkgs/os-specific/darwin/cctools/port.nix | 80 ++++++++++++ .../darwin/command-line-tools/default.nix | 70 +++------- pkgs/os-specific/darwin/libc/default.nix | 40 ++++++ pkgs/os-specific/darwin/libc/fileport.patch | 38 ++++++ 10 files changed, 382 insertions(+), 113 deletions(-) create mode 100644 pkgs/os-specific/darwin/adv_cmds/ps.nix create mode 100644 pkgs/os-specific/darwin/bootstrap-cmds/default.nix delete mode 100644 pkgs/os-specific/darwin/cctools-port/default.nix create mode 100644 pkgs/os-specific/darwin/cctools/darwin.patch rename pkgs/os-specific/darwin/{cctools-port => cctools}/ld-ignore-rpath-link.patch (100%) rename pkgs/os-specific/darwin/{cctools-port => cctools}/ld-rpath-nonfinal.patch (100%) create mode 100644 pkgs/os-specific/darwin/cctools/port.nix create mode 100644 pkgs/os-specific/darwin/libc/default.nix create mode 100644 pkgs/os-specific/darwin/libc/fileport.patch diff --git a/pkgs/os-specific/darwin/adv_cmds/ps.nix b/pkgs/os-specific/darwin/adv_cmds/ps.nix new file mode 100644 index 000000000000..c3d3d1588627 --- /dev/null +++ b/pkgs/os-specific/darwin/adv_cmds/ps.nix @@ -0,0 +1,35 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + name = "ps-${version}"; + version = "153"; + + src = fetchurl { + url = "http://opensource.apple.com/tarballs/adv_cmds/adv_cmds-${version}.tar.gz"; + sha256 = "174v6a4zkcm2pafzgdm6kvs48z5f911zl7k49hv7kjq6gm58w99v"; + }; + + buildPhase = '' + cd ps + cc -Os -Wall -I. -c -o fmt.o fmt.c + cc -Os -Wall -I. -c -o keyword.o keyword.c + cc -Os -Wall -I. -c -o nlist.o nlist.c + cc -Os -Wall -I. -c -o print.o print.c + cc -Os -Wall -I. -c -o ps.o ps.c + cc -Os -Wall -I. -c -o tasks.o tasks.c + cc -o ps fmt.o keyword.o nlist.o print.o ps.o tasks.o + ''; + + installPhase = '' + mkdir -p $out/bin $out/share/man/man1 + + cp ps $out/bin/ps + cp ps.1 $out/share/man/man1 + ''; + + + meta = { + platforms = stdenv.lib.platforms.darwin; + maintainers = with stdenv.lib.maintainers; [ gridaphobe ]; + }; +} diff --git a/pkgs/os-specific/darwin/bootstrap-cmds/default.nix b/pkgs/os-specific/darwin/bootstrap-cmds/default.nix new file mode 100644 index 000000000000..add17aa362a1 --- /dev/null +++ b/pkgs/os-specific/darwin/bootstrap-cmds/default.nix @@ -0,0 +1,46 @@ +{ stdenv, fetchurl, flex, yacc }: + +stdenv.mkDerivation rec { + version = "86"; + name = "bootstrap_cmds-${version}"; + + src = fetchurl { + url = "http://www.opensource.apple.com/tarballs/bootstrap_cmds/${name}.tar.gz"; + sha256 = "0xr0296jm1r3q7kbam98h85g23qlfi763z54ahj563n636kyk2wb"; + }; + + buildInputs = [ flex yacc ]; + + buildPhase = '' + cd migcom.tproj + yacc -d parser.y + flex --header-file=lexxer.yy.h -o lexxer.yy.c lexxer.l + + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o error.o error.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o global.o global.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o handler.o header.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o header.o header.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o mig.o mig.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o routine.o routine.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o server.o server.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o statement.o statement.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o string.o string.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o type.o type.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o user.o user.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o utils.o utils.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o lexxer.yy.o lexxer.yy.c + cc -Os -pipe -DMIG_VERSION="" -Wall -mdynamic-no-pic -I. -c -o y.tab.o y.tab.c + + cc -dead_strip -o migcom error.o global.o header.o mig.o routine.o server.o statement.o string.o type.o user.o utils.o lexxer.yy.o y.tab.o + ''; + + installPhase = '' + mkdir -p $out/bin $out/libexec $out/share/man/man1 + + chmod +x mig.sh + cp mig.sh $out/bin/mig + cp migcom $out/libexec + cp mig.1 $out/share/man/man1 + cp migcom.1 $out/share/man/man1 + ''; +} diff --git a/pkgs/os-specific/darwin/cctools-port/default.nix b/pkgs/os-specific/darwin/cctools-port/default.nix deleted file mode 100644 index cdc259c1e2a0..000000000000 --- a/pkgs/os-specific/darwin/cctools-port/default.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ stdenv, cross, fetchurl, autoconf, automake, libtool -, libcxx, llvm, clang, openssl, libuuid -, maloader, makeWrapper, xctoolchain -}: - -stdenv.mkDerivation rec { - name = "cctools-port-${version}"; - version = "845"; - - src = fetchurl { - url = "https://github.com/tpoechtrager/cctools-port/archive/" - + "cctools-${version}-ld64-136-1.tar.gz"; - sha256 = "06pg6h1g8avgx4j6cfykdpggf490li796gzhhyqn27jsagli307i"; - }; - - buildInputs = [ - autoconf automake libtool libcxx llvm clang openssl libuuid makeWrapper - ]; - - patches = [ ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch ]; - - enableParallelBuilding = true; - - postPatch = '' - patchShebangs tools - sed -i -e 's/which/type -P/' tools/*.sh - sed -i -e 's|clang++|& -I${libcxx}/include/c++/v1|' cctools/autogen.sh - - # Workaround for https://www.sourceware.org/bugzilla/show_bug.cgi?id=11157 - cat > cctools/include/unistd.h < +Date: Sun, 12 Oct 2014 12:23:51 -0400 +Subject: [PATCH] work + +--- + cctools/Makefile.am | 2 +- + cctools/configure.ac | 2 -- + cctools/ld64/src/3rd/helper.c | 2 ++ + cctools/ld64/src/3rd/strlcat.c | 2 ++ + cctools/ld64/src/3rd/strlcpy.c | 3 ++- + cctools/ld64/src/ld/Options.cpp | 2 ++ + tools/find_lto_header.sh | 2 +- + 7 files changed, 10 insertions(+), 5 deletions(-) + +diff --git a/cctools/Makefile.am b/cctools/Makefile.am +index 44084ad..34a670c 100644 +--- a/cctools/Makefile.am ++++ b/cctools/Makefile.am +@@ -1,2 +1,2 @@ +-SUBDIRS=libstuff ar as misc libobjc2 otool ld64 $(LD_CLASSIC) ++SUBDIRS=libstuff ar as misc ld64 $(LD_CLASSIC) + ACLOCAL_AMFLAGS = -I m4 +diff --git a/cctools/configure.ac b/cctools/configure.ac +index c4f6c47..b641925 100644 +--- a/cctools/configure.ac ++++ b/cctools/configure.ac +@@ -278,8 +278,6 @@ AC_CONFIG_FILES([as/ppc/Makefile]) + AC_CONFIG_FILES([as/ppc64/Makefile]) + #AC_CONFIG_FILES([man/Makefile]) + AC_CONFIG_FILES([misc/Makefile]) +-AC_CONFIG_FILES([otool/Makefile]) +-AC_CONFIG_FILES([libobjc2/Makefile]) + AC_CONFIG_FILES([ld/Makefile]) + + +diff --git a/cctools/ld64/src/3rd/helper.c b/cctools/ld64/src/3rd/helper.c +index 19f4be7..bec6869 100644 +--- a/cctools/ld64/src/3rd/helper.c ++++ b/cctools/ld64/src/3rd/helper.c +@@ -23,6 +23,7 @@ + const char ldVersionString[] = "236.3\n"; + + ++#if 0 + void __assert_rtn(const char *func, const char *file, int line, const char *msg) + { + #ifdef __FreeBSD__ +@@ -33,6 +34,7 @@ void __assert_rtn(const char *func, const char *file, int line, const char *msg) + __assert(msg, file, line); + #endif /* __FreeBSD__ */ + } ++#endif + + int _NSGetExecutablePath(char *path, unsigned int *size) + { +diff --git a/cctools/ld64/src/3rd/strlcat.c b/cctools/ld64/src/3rd/strlcat.c +index 500d038..dadf269 100644 +--- a/cctools/ld64/src/3rd/strlcat.c ++++ b/cctools/ld64/src/3rd/strlcat.c +@@ -23,6 +23,7 @@ + + #include + ++#if 0 + size_t + strlcat(char * restrict dst, const char * restrict src, size_t maxlen) { + const size_t srclen = strlen(src); +@@ -36,3 +37,4 @@ strlcat(char * restrict dst, const char * restrict src, size_t maxlen) { + } + return dstlen + srclen; + } ++#endif +\ No newline at end of file +diff --git a/cctools/ld64/src/3rd/strlcpy.c b/cctools/ld64/src/3rd/strlcpy.c +index c69f107..34a399b 100644 +--- a/cctools/ld64/src/3rd/strlcpy.c ++++ b/cctools/ld64/src/3rd/strlcpy.c +@@ -23,6 +23,7 @@ + + #include + ++#if 0 + size_t + strlcpy(char * restrict dst, const char * restrict src, size_t maxlen) { + const size_t srclen = strlen(src); +@@ -34,4 +35,4 @@ strlcpy(char * restrict dst, const char * restrict src, size_t maxlen) { + } + return srclen; + } +- ++#endif +\ No newline at end of file +diff --git a/cctools/ld64/src/ld/Options.cpp b/cctools/ld64/src/ld/Options.cpp +index 3a78df8..0ecf9f2 100644 +--- a/cctools/ld64/src/ld/Options.cpp ++++ b/cctools/ld64/src/ld/Options.cpp +@@ -49,6 +49,8 @@ namespace lto { + extern const char* version(); + } + ++#define __MAC_OS_X_VERSION_MIN_REQUIRED 1060 ++ + // magic to place command line in crash reports + const int crashreporterBufferSize = 2000; + static char crashreporterBuffer[crashreporterBufferSize]; +diff --git a/tools/find_lto_header.sh b/tools/find_lto_header.sh +index aee3a4a..4733981 100755 +--- a/tools/find_lto_header.sh ++++ b/tools/find_lto_header.sh +@@ -14,7 +14,7 @@ function try() + # Adding the include directory with -I causes the build to fail. + ln -sf "$LLVM_INC_DIR/llvm-c/lto.h" "include/llvm-c/lto.h" + mkdir -p tmp +- echo -n "-Wl,-rpath,$LLVM_LIB_DIR,--enable-new-dtags -L$LLVM_LIB_DIR -lLTO " > tmp/ldflags ++ echo -n "-Wl,-rpath,$LLVM_LIB_DIR -L$LLVM_LIB_DIR -lLTO " > tmp/ldflags + echo -n "-DLTO_SUPPORT=1 " > tmp/cflags + echo -n "-DLTO_SUPPORT=1 " > tmp/cxxflags + echo -n "$LLVM_LIB_DIR" > tmp/ldpath +-- +1.9.3 (Apple Git-50) + diff --git a/pkgs/os-specific/darwin/cctools-port/ld-ignore-rpath-link.patch b/pkgs/os-specific/darwin/cctools/ld-ignore-rpath-link.patch similarity index 100% rename from pkgs/os-specific/darwin/cctools-port/ld-ignore-rpath-link.patch rename to pkgs/os-specific/darwin/cctools/ld-ignore-rpath-link.patch diff --git a/pkgs/os-specific/darwin/cctools-port/ld-rpath-nonfinal.patch b/pkgs/os-specific/darwin/cctools/ld-rpath-nonfinal.patch similarity index 100% rename from pkgs/os-specific/darwin/cctools-port/ld-rpath-nonfinal.patch rename to pkgs/os-specific/darwin/cctools/ld-rpath-nonfinal.patch diff --git a/pkgs/os-specific/darwin/cctools/port.nix b/pkgs/os-specific/darwin/cctools/port.nix new file mode 100644 index 000000000000..4dbdbede60ec --- /dev/null +++ b/pkgs/os-specific/darwin/cctools/port.nix @@ -0,0 +1,80 @@ +{ stdenv, fetchurl, autoconf, automake, libtool +, llvm, libcxx, clang, openssl, libuuid +}: + +let + baseParams = rec { + name = "cctools-port-${version}"; + version = "855"; + + src = let + # Should be fetchFromGitHub but it was whining so this will do for now + owner = "tpoechtrager"; + repo = "cctools-port"; + rev = "7083dddbb0f106d791d313829ea7dc45db90e375"; + in fetchurl { + url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; + sha256 = "017gxlcwgi7xhayjzj9w3fac175p2rm4vjzf9cycq9683m9pmyzj"; + }; + + buildInputs = [ + autoconf automake libtool llvm clang openssl libuuid libcxx + ]; + + patches = [ ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch ]; + + enableParallelBuilding = true; + + postPatch = '' + patchShebangs tools + sed -i -e 's/which/type -P/' tools/*.sh + + # Workaround for https://www.sourceware.org/bugzilla/show_bug.cgi?id=11157 + cat > cctools/include/unistd.h < + #include + #include ++#include + #include + #include + #include +diff --git a/locale/FreeBSD/toupper.c b/locale/FreeBSD/toupper.c +index d02ddd6..e5a1f10 100644 +--- a/locale/FreeBSD/toupper.c ++++ b/locale/FreeBSD/toupper.c +@@ -39,6 +39,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/toupper.c,v 1.13 2007/01/09 00:28:01 imp + #include + #include + ++#define __ct_rune_t ct_rune_t ++ + __ct_rune_t + ___toupper_l(c, loc) + __ct_rune_t c;