1 # shellcheck shell=bash disable=SC2154,SC2164
3 # BSD makefiles should be able to detect this
4 # but without they end up using gcc on Darwin stdenv
23 export _GCC_CRTBEGINS
=
26 export _GCC_LIBGCCDIR
=
31 # Definitions passed to share/mk/*.mk. Should be pretty simple -
32 # eventually maybe move it to a configure script.
34 export NOCLANGERROR
=yes
38 export EXTERNAL_TOOLCHAIN
=yes
40 prependToVar makeFlags
"MACHINE=$MACHINE"
41 prependToVar makeFlags
"MACHINE_ARCH=$MACHINE_ARCH"
42 prependToVar makeFlags
"AR=$AR"
43 prependToVar makeFlags
"CC=$CC"
44 prependToVar makeFlags
"CPP=$CPP"
45 prependToVar makeFlags
"CXX=$CXX"
46 prependToVar makeFlags
"LD=$LD"
47 prependToVar makeFlags
"STRIP=$STRIP"
49 prependToVar makeFlags
"BINDIR=${!outputBin}/bin"
50 prependToVar makeFlags
"LIBDIR=${!outputLib}/lib"
51 prependToVar makeFlags
"SHLIBDIR=${!outputLib}/lib"
52 prependToVar makeFlags
"SHAREDIR=${!outputLib}/share"
53 prependToVar makeFlags
"INFODIR=${!outputInfo}/share/info"
54 prependToVar makeFlags
"DOCDIR=${!outputDoc}/share/doc"
55 prependToVar makeFlags
"LOCALEDIR=${!outputLib}/share/locale"
57 # Parallel building. Needs the space.
58 prependToVar makeFlags
"-j $NIX_BUILD_CORES"
62 sourceRoot
=$PWD/$sourceRoot
63 export BSDSRCDIR
=$sourceRoot
64 export _SRC_TOP_
=$BSDSRCDIR
69 if [ -d "$COMPONENT_PATH" ]
70 then sourceRoot
=$sourceRoot/$COMPONENT_PATH
76 if [ -z "${skipIncludesPhase:-}" ]; then
80 concatTo flagsArray makeFlags makeFlagsArray
81 flagsArray
+=(includes
)
83 echoCmd
'includes flags' "${flagsArray[@]}"
84 make ${makefile:+-f $makefile} "${flagsArray[@]}"
93 if [ -d "$prefix" ]; then
94 # Remove lingering /usr references
95 if [ -d "$prefix/usr" ]; then
96 # Didn't try using rsync yet because per
97 # https://unix.stackexchange.com/questions/127712/merging-folders-with-mv,
98 # it's not neessarily better.
100 find .
-type d
-exec mkdir
-p "$out/{}" \
;
101 find . \
( -type f
-o -type l \
) -exec mv "{}" "$out/{}" \
;
105 find "$prefix" -type d
-empty -delete
109 postUnpackHooks
+=(setBSDSourceDir
)
110 postPatchHooks
+=(cdBSDPath
)
111 preConfigureHooks
+=(addMakeFlags
)
112 preInstallHooks
+=(includesPhase
)
113 fixupOutputHooks
+=(moveUsrDir
)