summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers/skarnet/setup-hook.sh
blob: e9cd02a4e7e6ca780da6a8a765ee7caaa764d1ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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"

  # 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

  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