From cf5f282940c9ac07533ef602e2ea415e1a5ed517 Mon Sep 17 00:00:00 2001 From: Patrick Mahoney Date: Fri, 28 Nov 2014 13:10:37 -0600 Subject: [PATCH 1/2] Consolidate conf-compile steps for skarnet.org pkgs. --- .../development/libraries/skalibs/default.nix | 33 +++------------ .../tools/build-managers/skarnet/default.nix | 21 ++++++++++ .../build-managers/skarnet/setup-hook.sh | 42 +++++++++++++++++++ .../linux/s6-linux-utils/default.nix | 34 +++------------ pkgs/servers/s6/default.nix | 34 ++++----------- pkgs/tools/misc/execline/default.nix | 35 +++------------- pkgs/tools/misc/s6-portable-utils/default.nix | 32 +++----------- pkgs/tools/networking/s6-dns/default.nix | 34 +++------------ .../networking/s6-networking/default.nix | 34 +-------------- pkgs/top-level/all-packages.nix | 2 + 10 files changed, 104 insertions(+), 197 deletions(-) create mode 100644 pkgs/development/tools/build-managers/skarnet/default.nix create mode 100644 pkgs/development/tools/build-managers/skarnet/setup-hook.sh diff --git a/pkgs/development/libraries/skalibs/default.nix b/pkgs/development/libraries/skalibs/default.nix index ba8dcc812e8..55c69b137e5 100644 --- a/pkgs/development/libraries/skalibs/default.nix +++ b/pkgs/development/libraries/skalibs/default.nix @@ -1,10 +1,14 @@ -{stdenv, fetchurl}: +{ stdenv +, skarnetConfCompile +, fetchurl +}: let version = "1.6.0.0"; in stdenv.mkDerivation rec { + name = "skalibs-${version}"; src = fetchurl { @@ -17,32 +21,7 @@ in stdenv.mkDerivation rec { # See http://skarnet.org/cgi-bin/archive.cgi?1:mss:75:201405:pkmodhckjklemogbplje patches = [ ./getpeereid.patch ]; - configurePhase = '' - pushd conf-compile - - printf "$out/bin" > conf-defaultpath - printf "$out/etc" > conf-etc - printf "$out/bin" > conf-install-command - printf "$out/include" > conf-install-include - printf "$out/libexec" > conf-install-libexec - printf "$out/lib" > conf-install-library - printf "$out/lib" > conf-install-library.so - printf "$out/sysdeps" > conf-install-sysdeps - - # let nix builder strip things, cross-platform - truncate --size 0 conf-stripbins - truncate --size 0 conf-striplibs - - rm -f flag-slashpackage - touch flag-allstatic - touch flag-forcedevr - - popd - ''; - - preBuild = '' - patchShebangs src/sys - ''; + buildInputs = [ skarnetConfCompile ]; preInstall = '' mkdir -p "$out/etc" diff --git a/pkgs/development/tools/build-managers/skarnet/default.nix b/pkgs/development/tools/build-managers/skarnet/default.nix new file mode 100644 index 00000000000..5490fcabef9 --- /dev/null +++ b/pkgs/development/tools/build-managers/skarnet/default.nix @@ -0,0 +1,21 @@ +{ stdenv }: + +let + + version = "2014-11-28"; + +in stdenv.mkDerivation { + + name = "skarnet-conf-compile-${version}"; + + phases = [ "fixupPhase" ]; + + setupHook = ./setup-hook.sh; + + meta = { + homepage = http://www.skarnet.org/software/conf-compile.html; + description = "Support for configuring skarnet.org packages for nix builds"; + platforms = stdenv.lib.platforms.all; + }; + +} diff --git a/pkgs/development/tools/build-managers/skarnet/setup-hook.sh b/pkgs/development/tools/build-managers/skarnet/setup-hook.sh new file mode 100644 index 00000000000..1c5c7efd408 --- /dev/null +++ b/pkgs/development/tools/build-managers/skarnet/setup-hook.sh @@ -0,0 +1,42 @@ +# Packages from skarnet.org use a unique build system. These functions +# assist with some common configuration and shebang patching. + +skarnetConfigure() { + runHook preConfigure + + pushd conf-compile >/dev/null + + # paths + > conf-defaultpath printf "$out/bin" + > conf-etc printf "$out/etc" + > conf-install-command printf "$out/bin" + > conf-install-include printf "$out/include" + > conf-install-libexec printf "$out/libexec" + > conf-install-library printf "$out/lib" + > conf-install-library.so printf "$out/lib" + > conf-install-sysdeps printf "$out/sysdeps" + + # let nix builder strip things, cross-platform + truncate --size 0 conf-stripbins conf-striplibs + + rm -f flag-slashpackage + touch flag-allstatic + touch flag-forcedevr # only used for skalibs + + # build inputs + truncate --size 0 import path-include path-library + for input in $nativeBuildInputs; do + [[ -a "$input/sysdeps" ]] && >> import printf "$input/sysdeps" + [[ -a "$input/include" ]] && >> path-include printf "$input/include" + [[ -a "$input/lib" ]] && >> path-library printf "$input/lib" + done + + popd >/dev/null + + # patch various scripts to use stdenv shell + patchShebangs src/sys + + runHook postConfigure +} + +export configurePhase=skarnetConfigure diff --git a/pkgs/os-specific/linux/s6-linux-utils/default.nix b/pkgs/os-specific/linux/s6-linux-utils/default.nix index a50400e492a..b7a546a3ea0 100644 --- a/pkgs/os-specific/linux/s6-linux-utils/default.nix +++ b/pkgs/os-specific/linux/s6-linux-utils/default.nix @@ -1,4 +1,8 @@ -{ stdenv, fetchurl, skalibs }: +{ stdenv +, fetchurl +, skalibs +, skarnetConfCompile +}: let @@ -13,36 +17,10 @@ in stdenv.mkDerivation rec { sha256 = "1s17g03z5hfpiz32g001g5wyamyvn9l36fr2csk3k7r0jkqfnl0d"; }; - buildInputs = [ skalibs ]; + buildInputs = [ skalibs skarnetConfCompile ]; sourceRoot = "admin/${name}"; - configurePhase = '' - pushd conf-compile - - printf "$out/bin" > conf-install-command - printf "$out/include" > conf-install-include - printf "$out/lib" > conf-install-library - printf "$out/lib" > conf-install-library.so - - # let nix builder strip things, cross-platform - truncate --size 0 conf-stripbins - truncate --size 0 conf-striplibs - - printf "${skalibs}/sysdeps" > import - printf "%s" "${skalibs}/include" > path-include - printf "%s" "${skalibs}/lib" > path-library - - rm -f flag-slashpackage - touch flag-allstatic - - popd - ''; - - preBuild = '' - patchShebangs src/sys - ''; - meta = { homepage = http://www.skarnet.org/software/s6-linux-utils/; description = "A set of minimalistic Linux-specific system utilities"; diff --git a/pkgs/servers/s6/default.nix b/pkgs/servers/s6/default.nix index 039128e9df4..491dc625cf2 100644 --- a/pkgs/servers/s6/default.nix +++ b/pkgs/servers/s6/default.nix @@ -1,4 +1,9 @@ -{stdenv, fetchurl, skalibs, execline}: +{ stdenv +, execline +, fetchurl +, skalibs +, skarnetConfCompile +}: let @@ -13,38 +18,13 @@ in stdenv.mkDerivation rec { sha256 = "0djxdd3d3mlp63sjqqs0ilf8p68m86c1s98d82fl0kgaaibpsikp"; }; - buildInputs = [ skalibs execline ]; + buildInputs = [ skalibs execline skarnetConfCompile ]; sourceRoot = "admin/${name}"; - configurePhase = '' - pushd conf-compile - - printf "$out/bin" > conf-install-command - printf "$out/include" > conf-install-include - printf "$out/lib" > conf-install-library - printf "$out/lib" > conf-install-library.so - printf "$out/sysdeps" > conf-install-sysdeps - - # let nix builder strip things, cross-platform - truncate --size 0 conf-stripbins - truncate --size 0 conf-striplibs - - printf "${skalibs}/sysdeps" > import - printf "%s\n%s" "${skalibs}/include" "${execline}/include" > path-include - printf "%s\n%s" "${skalibs}/lib" "${execline}/lib" > path-library - - rm -f flag-slashpackage - touch flag-allstatic - - popd - ''; - preBuild = '' substituteInPlace "src/daemontools-extras/s6-log.c" \ --replace '"execlineb"' '"${execline}/bin/execlineb"' - - patchShebangs src/sys ''; meta = { diff --git a/pkgs/tools/misc/execline/default.nix b/pkgs/tools/misc/execline/default.nix index 8462ca0e9c6..6bfb1852f87 100644 --- a/pkgs/tools/misc/execline/default.nix +++ b/pkgs/tools/misc/execline/default.nix @@ -1,4 +1,8 @@ -{stdenv, fetchurl, skalibs}: +{ stdenv +, fetchurl +, skalibs +, skarnetConfCompile +}: let @@ -13,37 +17,10 @@ in stdenv.mkDerivation rec { sha256 = "1br3qzif166kbp4k813ljbyq058p7mfsp2lj88n8vi4dmj935nzg"; }; - buildInputs = [ skalibs ]; + buildInputs = [ skalibs skarnetConfCompile ]; sourceRoot = "admin/${name}"; - configurePhase = '' - pushd conf-compile - - printf "$out/bin" > conf-install-command - printf "$out/include" > conf-install-include - printf "$out/lib" > conf-install-library - printf "$out/lib" > conf-install-library.so - printf "$out/sysdeps" > conf-install-sysdeps - - printf "${skalibs}/sysdeps" > import - printf "${skalibs}/include" > path-include - printf "${skalibs}/lib" > path-library - - # let nix builder strip things, cross-platform - truncate --size 0 conf-stripbins - truncate --size 0 conf-striplibs - - rm -f flag-slashpackage - touch flag-allstatic - - popd - ''; - - preBuild = '' - patchShebangs src/sys - ''; - meta = { homepage = http://skarnet.org/software/execline/; description = "A small scripting language, to be used in place of a shell in non-interactive scripts"; diff --git a/pkgs/tools/misc/s6-portable-utils/default.nix b/pkgs/tools/misc/s6-portable-utils/default.nix index 8da10b7eb58..650886351e6 100644 --- a/pkgs/tools/misc/s6-portable-utils/default.nix +++ b/pkgs/tools/misc/s6-portable-utils/default.nix @@ -1,4 +1,8 @@ -{ stdenv, fetchurl, skalibs }: +{ stdenv +, fetchurl +, skalibs +, skarnetConfCompile +}: let @@ -13,34 +17,10 @@ in stdenv.mkDerivation rec { sha256 = "040nmls7qbgw8yn502lym4kgqh5zxr2ks734bqajpi2ricnasvhl"; }; - buildInputs = [ skalibs ]; + buildInputs = [ skalibs skarnetConfCompile ]; sourceRoot = "admin/${name}"; - configurePhase = '' - pushd conf-compile - - printf "$out/bin" > conf-install-command - printf "$out/libexec" > conf-install-libexec - - # let nix builder strip things, cross-platform - truncate --size 0 conf-stripbins - truncate --size 0 conf-striplibs - - printf "${skalibs}/sysdeps" > import - printf "%s" "${skalibs}/include" > path-include - printf "%s" "${skalibs}/lib" > path-library - - rm -f flag-slashpackage - touch flag-allstatic - - popd - ''; - - preBuild = '' - patchShebangs src/sys - ''; - preInstall = '' mkdir -p "$out/libexec" ''; diff --git a/pkgs/tools/networking/s6-dns/default.nix b/pkgs/tools/networking/s6-dns/default.nix index 881bb7dd32f..16467e84a1e 100644 --- a/pkgs/tools/networking/s6-dns/default.nix +++ b/pkgs/tools/networking/s6-dns/default.nix @@ -1,4 +1,8 @@ -{ stdenv, fetchurl, skalibs }: +{ stdenv +, fetchurl +, skalibs +, skarnetConfCompile +}: let @@ -13,36 +17,10 @@ in stdenv.mkDerivation rec { sha256 = "1r82l5fnz2rrwm5wq2sldqp74lk9fifr0d8hyq98xdyh24hish68"; }; - buildInputs = [ skalibs ]; + buildInputs = [ skalibs skarnetConfCompile ]; sourceRoot = "web/${name}"; - configurePhase = '' - pushd conf-compile - - printf "$out/bin" > conf-install-command - printf "$out/include" > conf-install-include - printf "$out/lib" > conf-install-library - printf "$out/lib" > conf-install-library.so - - # let nix builder strip things, cross-platform - truncate --size 0 conf-stripbins - truncate --size 0 conf-striplibs - - printf "${skalibs}/sysdeps" > import - printf "%s" "${skalibs}/include" > path-include - printf "%s" "${skalibs}/lib" > path-library - - rm -f flag-slashpackage - touch flag-allstatic - - popd - ''; - - preBuild = '' - patchShebangs src/sys - ''; - meta = { homepage = http://www.skarnet.org/software/s6-dns/; description = "A suite of DNS client programs and libraries for Unix systems"; diff --git a/pkgs/tools/networking/s6-networking/default.nix b/pkgs/tools/networking/s6-networking/default.nix index 5faa2af8ba1..a4482bb71c3 100644 --- a/pkgs/tools/networking/s6-networking/default.nix +++ b/pkgs/tools/networking/s6-networking/default.nix @@ -3,6 +3,7 @@ , fetchurl , s6Dns , skalibs +, skarnetConfCompile }: let @@ -18,41 +19,10 @@ in stdenv.mkDerivation rec { sha256 = "1np9m2j1i2450mbcjvpbb56kv3wc2fbyvmv2a039q61j2lk6vjz7"; }; - buildInputs = [ skalibs s6Dns execline ]; + buildInputs = [ skalibs s6Dns execline skarnetConfCompile ]; sourceRoot = "net/${name}"; - configurePhase = '' - pushd conf-compile - - printf "$out/bin" > conf-install-command - printf "$out/include" > conf-install-include - printf "$out/lib" > conf-install-library - printf "$out/lib" > conf-install-library.so - - # let nix builder strip things, cross-platform - truncate --size 0 conf-stripbins - truncate --size 0 conf-striplibs - - printf "${skalibs}/sysdeps" > import - - rm -f path-include - rm -f path-library - for dep in "${execline}" "${s6Dns}" "${skalibs}"; do - printf "%s\n" "$dep/include" >> path-include - printf "%s\n" "$dep/lib" >> path-library - done - - rm -f flag-slashpackage - touch flag-allstatic - - popd - ''; - - preBuild = '' - patchShebangs src/sys - ''; - meta = { homepage = http://www.skarnet.org/software/s6-networking/; description = "A suite of small networking utilities for Unix systems"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3b27e447009..e31bd7ed737 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6831,6 +6831,8 @@ let skalibs = callPackage ../development/libraries/skalibs { }; + skarnetConfCompile = callPackage ../development/tools/build-managers/skarnet { }; + slang = callPackage ../development/libraries/slang { }; slibGuile = callPackage ../development/libraries/slib { From a61293e65938518f05a92459c5ef9213bd7826cb Mon Sep 17 00:00:00 2001 From: Patrick Mahoney Date: Fri, 28 Nov 2014 13:11:36 -0600 Subject: [PATCH 2/2] skarnet: Invoke compile as 'cc' for wider support. Darwin stdenv uses clang, which can be invoked as 'cc' but not 'gcc'. --- pkgs/development/tools/build-managers/skarnet/setup-hook.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/tools/build-managers/skarnet/setup-hook.sh b/pkgs/development/tools/build-managers/skarnet/setup-hook.sh index 1c5c7efd408..e9cd02a4e7e 100644 --- a/pkgs/development/tools/build-managers/skarnet/setup-hook.sh +++ b/pkgs/development/tools/build-managers/skarnet/setup-hook.sh @@ -16,6 +16,11 @@ skarnetConfigure() { > conf-install-library.so printf "$out/lib" > conf-install-sysdeps printf "$out/sysdeps" + # use generic 'cc' to support both gcc and clang (darwin) stdenvs + for file in conf-cc conf-dynld conf-ld; do + substituteInPlace $file --replace gcc cc + done + # let nix builder strip things, cross-platform truncate --size 0 conf-stripbins conf-striplibs