From 64f1191313c9df006e7f09b2fe574ea88c86f195 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 26 Jan 2010 18:10:59 +0000 Subject: [PATCH] * Fix Perl on FreeBSD. svn path=/nixpkgs/branches/stdenv-updates/; revision=19685 --- pkgs/build-support/gcc-wrapper/default.nix | 4 +- .../interpreters/perl-5.10/default.nix | 62 +++++++------- .../interpreters/perl-5.10/no-sys-dirs.patch | 80 +++++++++++++------ pkgs/top-level/all-packages.nix | 8 +- 4 files changed, 89 insertions(+), 65 deletions(-) diff --git a/pkgs/build-support/gcc-wrapper/default.nix b/pkgs/build-support/gcc-wrapper/default.nix index 87b2b097659a..87557bb47795 100644 --- a/pkgs/build-support/gcc-wrapper/default.nix +++ b/pkgs/build-support/gcc-wrapper/default.nix @@ -6,8 +6,8 @@ # variables so that the compiler and the linker just "work". { name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? "" -, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? "", -zlib ? null +, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? "" +, zlib ? null }: assert nativeTools -> nativePrefix != ""; diff --git a/pkgs/development/interpreters/perl-5.10/default.nix b/pkgs/development/interpreters/perl-5.10/default.nix index aadf1b7d00d5..31168291e3d1 100644 --- a/pkgs/development/interpreters/perl-5.10/default.nix +++ b/pkgs/development/interpreters/perl-5.10/default.nix @@ -1,14 +1,8 @@ -{ stdenv, fetchurl -, impureLibcPath ? null -}: +{ stdenv, fetchurl }: -let - - preBuildNoNative = - '' - # Make Cwd work on NixOS (where we don't have a /bin/pwd). - substituteInPlace lib/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'" - ''; +let + + libc = if stdenv ? gcc && stdenv.gcc.libc != null then stdenv.gcc.libc else "/usr"; in @@ -20,47 +14,45 @@ stdenv.mkDerivation rec { sha256 = "0dagnhjgmslfx1jawz986nvc3jh1klk7mn2l8djdca1b9gm2czyb"; }; - patches = [ - # This patch does the following: - # 1) Do use the PATH environment variable to find the `pwd' command. - # By default, Perl will only look for it in /lib and /usr/lib. - # !!! what are the security implications of this? - # 2) Force the use of , not /usr/include/errno.h, on Linux - # systems. (This actually appears to be due to a bug in Perl.) - ./no-sys-dirs.patch - ]; + patches = + [ # Do not look in /usr etc. for dependencies. + ./no-sys-dirs.patch + ]; # Build a thread-safe Perl with a dynamic libperls.o. We need the # "installstyle" option to ensure that modules are put under # $out/lib/perl5 - this is the general default, but because $out # contains the string "perl", Configure would select $out/lib. # Miniperl needs -lm. perl needs -lrt. - configureFlags = [ - "-de" - "-Dcc=gcc" - "-Uinstallusrbinperl" - "-Dinstallstyle=lib/perl5" - "-Duseshrplib" - (if stdenv ? glibc then "-Dusethreads" else "") - ]; + configureFlags = + [ "-de" + "-Dcc=gcc" + "-Uinstallusrbinperl" + "-Dinstallstyle=lib/perl5" + "-Duseshrplib" + "-Dlocincpth=${libc}/include" + "-Dloclibpth=${libc}/lib" + ] + ++ stdenv.lib.optional (stdenv ? glibc) "-Dusethreads"; configureScript = "${stdenv.shell} ./Configure"; dontAddPrefix = true; - configurePhase = + preConfigure = '' configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3" - if test "${if impureLibcPath == null then "$NIX_ENFORCE_PURITY" else "1"}" = "1"; then - GLIBC=${if impureLibcPath == null then "$(cat $NIX_GCC/nix-support/orig-libc)" else impureLibcPath} - configureFlags="$configureFlags -Dlocincpth=$GLIBC/include -Dloclibpth=$GLIBC/lib" - fi - ${stdenv.shell} ./Configure $configureFlags \ - ${if stdenv.system == "armv5tel-linux" then "-Dldflags=\"-lm -lrt\"" else ""}; + ${stdenv.lib.optionalString (stdenv.system == "armv5tel-linux") '' + configureFlagsArray=(-Dldflags="-lm -lrt") + ''} ''; - preBuild = stdenv.lib.optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools)) preBuildNoNative; + preBuild = stdenv.lib.optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools)) + '' + # Make Cwd work on NixOS (where we don't have a /bin/pwd). + substituteInPlace lib/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'" + ''; setupHook = ./setup-hook.sh; } diff --git a/pkgs/development/interpreters/perl-5.10/no-sys-dirs.patch b/pkgs/development/interpreters/perl-5.10/no-sys-dirs.patch index 0b1164a32509..29edf68bb647 100644 --- a/pkgs/development/interpreters/perl-5.10/no-sys-dirs.patch +++ b/pkgs/development/interpreters/perl-5.10/no-sys-dirs.patch @@ -1,8 +1,8 @@ -diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure -*** perl-5.10.0-orig/Configure 2007-12-18 11:47:07.000000000 +0100 ---- perl-5.10.0/Configure 2008-02-21 17:00:40.000000000 +0100 +diff -rc -x '*~' perl-5.10.1-orig/Configure perl-5.10.1/Configure +*** perl-5.10.1-orig/Configure 2009-08-18 21:03:53.000000000 +0200 +--- perl-5.10.1/Configure 2010-01-26 19:08:32.933792254 +0100 *************** -*** 104,118 **** +*** 103,117 **** fi : Proper PATH setting @@ -18,7 +18,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure for p in $paths do ---- 104,110 ---- +--- 103,109 ---- fi : Proper PATH setting @@ -27,8 +27,8 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure for p in $paths do *************** -*** 1271,1287 **** - groupstype='' +*** 1301,1317 **** + archname='' libnames='' : change the next line if compiling for Xenix/286 on Xenix/386 ! xlibpth='/usr/lib/386 /lib/386' @@ -45,8 +45,8 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure : Private path used by Configure to find libraries. Its value : is prepended to libpth. This variable takes care of special ---- 1263,1274 ---- - groupstype='' +--- 1293,1304 ---- + archname='' libnames='' : change the next line if compiling for Xenix/286 on Xenix/386 ! xlibpth='' @@ -59,7 +59,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure : Private path used by Configure to find libraries. Its value : is prepended to libpth. This variable takes care of special *************** -*** 1302,1309 **** +*** 1329,1336 **** : Possible local include directories to search. : Set locincpth to "" in a hint file to defeat local include searches. @@ -68,7 +68,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure : : no include file wanted by default inclwanted='' ---- 1289,1295 ---- +--- 1316,1322 ---- : Possible local include directories to search. : Set locincpth to "" in a hint file to defeat local include searches. @@ -77,7 +77,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure : no include file wanted by default inclwanted='' *************** -*** 1331,1338 **** +*** 1358,1365 **** libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD" : We probably want to search /usr/shlib before most other libraries. : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist. @@ -86,9 +86,9 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure : Do not use vfork unless overridden by a hint file. usevfork=false ---- 1317,1322 ---- +--- 1344,1349 ---- *************** -*** 2340,2346 **** +*** 2366,2372 **** zip " pth=`echo $PATH | sed -e "s/$p_/ /g"` @@ -96,9 +96,9 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure for file in $loclist; do eval xxx=\$$file case "$xxx" in ---- 2324,2329 ---- +--- 2350,2355 ---- *************** -*** 8155,8167 **** +*** 8361,8373 **** echo " " case "$sysman" in '') @@ -112,7 +112,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure ;; esac if $test -d "$sysman"; then ---- 8138,8145 ---- +--- 8344,8351 ---- echo " " case "$sysman" in '') @@ -122,7 +122,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure esac if $test -d "$sysman"; then *************** -*** 19005,19013 **** +*** 19476,19484 **** case "$full_ar" in '') full_ar=$ar ;; esac @@ -132,7 +132,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure : see what type gids are declared as in the kernel echo " " ---- 18983,18992 ---- +--- 19454,19463 ---- case "$full_ar" in '') full_ar=$ar ;; esac @@ -143,11 +143,11 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure : see what type gids are declared as in the kernel echo " " -diff -rc perl-5.10.0-orig/ext/Errno/Errno_pm.PL perl-5.10.0/ext/Errno/Errno_pm.PL -*** perl-5.10.0-orig/ext/Errno/Errno_pm.PL 2007-12-18 11:47:07.000000000 +0100 ---- perl-5.10.0/ext/Errno/Errno_pm.PL 2008-02-21 17:00:02.000000000 +0100 +diff -rc -x '*~' perl-5.10.1-orig/ext/Errno/Errno_pm.PL perl-5.10.1/ext/Errno/Errno_pm.PL +*** perl-5.10.1-orig/ext/Errno/Errno_pm.PL 2009-06-27 18:09:45.000000000 +0200 +--- perl-5.10.1/ext/Errno/Errno_pm.PL 2010-01-26 18:08:09.552792021 +0100 *************** -*** 140,150 **** +*** 144,154 **** if ($dep =~ /(\S+errno\.h)/) { $file{$1} = 1; } @@ -159,7 +159,7 @@ diff -rc perl-5.10.0-orig/ext/Errno/Errno_pm.PL perl-5.10.0/ext/Errno/Errno_pm.P # Some Linuxes have weird errno.hs which generate # no #file or #line directives my $linux_errno_h = -e '/usr/include/errno.h' ? ---- 140,146 ---- +--- 144,150 ---- if ($dep =~ /(\S+errno\.h)/) { $file{$1} = 1; } @@ -167,3 +167,35 @@ diff -rc perl-5.10.0-orig/ext/Errno/Errno_pm.PL perl-5.10.0/ext/Errno/Errno_pm.P # Some Linuxes have weird errno.hs which generate # no #file or #line directives my $linux_errno_h = -e '/usr/include/errno.h' ? +diff -rc -x '*~' perl-5.10.1-orig/hints/freebsd.sh perl-5.10.1/hints/freebsd.sh +*** perl-5.10.1-orig/hints/freebsd.sh 2009-02-12 23:58:12.000000000 +0100 +--- perl-5.10.1/hints/freebsd.sh 2010-01-26 18:30:01.181854620 +0100 +*************** +*** 118,130 **** + objformat=`/usr/bin/objformat` + if [ x$objformat = xaout ]; then + if [ -e /usr/lib/aout ]; then +! libpth="/usr/lib/aout /usr/local/lib /usr/lib" +! glibpth="/usr/lib/aout /usr/local/lib /usr/lib" + fi + lddlflags='-Bshareable' + else +! libpth="/usr/lib /usr/local/lib" +! glibpth="/usr/lib /usr/local/lib" + ldflags="-Wl,-E " + lddlflags="-shared " + fi +--- 118,130 ---- + objformat=`/usr/bin/objformat` + if [ x$objformat = xaout ]; then + if [ -e /usr/lib/aout ]; then +! libpth="" +! glibpth="" + fi + lddlflags='-Bshareable' + else +! libpth="" +! glibpth="" + ldflags="-Wl,-E " + lddlflags="-shared " + fi diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 82f269fd00bc..49c50d409cf8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -33,6 +33,7 @@ # argument. Otherwise, it's read from $NIXPKGS_CONFIG or # ~/.nixpkgs/config.nix. config ? null + , crossSystem ? null }: @@ -2496,14 +2497,13 @@ let }; perl58 = import ../development/interpreters/perl-5.8 { - inherit fetchurl stdenv; - impureLibcPath = if stdenv.isLinux then null else "/usr"; - }; + inherit fetchurl stdenv; + impureLibcPath = if stdenv.isLinux then null else "/usr"; + }; perl510 = makeOverridable (import ../development/interpreters/perl-5.10) { inherit stdenv; fetchurl = fetchurlBoot; - impureLibcPath = if stdenv.isLinux then null else "/usr"; }; perl = useFromStdenv "perl"