···2829 libc_bin = if nativeLibc then null else libc.bin or libc;
30 libc_dev = if nativeLibc then null else libc.dev or libc;
031 binutils_bin = if nativeTools then null else binutils.bin or binutils;
32 # The wrapper scripts use 'cat', so we may need coreutils.
33 coreutils_bin = if nativeTools then null else coreutils.bin or coreutils;
···4041 preferLocalBuild = true;
4243- inherit cc shell libc_bin libc_dev binutils_bin coreutils_bin;
4445 passthru = { inherit libc nativeTools nativeLibc nativePrefix; };
46···58 ''
5960 + optionalString (!nativeLibc) (if (!stdenv.isDarwin) then ''
61- dynamicLinker="${libc}/lib/$dynamicLinker"
62 echo $dynamicLinker > $out/nix-support/dynamic-linker
6364- if [ -e ${libc}/lib/32/ld-linux.so.2 ]; then
65- echo ${libc}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
66 fi
6768 # The dynamic linker is passed in `ldflagsBefore' to allow
···87 # compile, because it uses "#include_next <limits.h>" to find the
88 # limits.h file in ../includes-fixed. To remedy the problem,
89 # another -idirafter is necessary to add that directory again.
90- echo "-B${libc}/lib/ -idirafter ${libc_dev}/include -idirafter $cc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
9192- echo "-L${libc}/lib" > $out/nix-support/libc-ldflags
9394- echo "${libc}" > $out/nix-support/orig-libc
95 ''
9697 + (if nativeTools then ''
···2829 libc_bin = if nativeLibc then null else libc.bin or libc;
30 libc_dev = if nativeLibc then null else libc.dev or libc;
31+ libc_lib = if nativeLibc then null else libc.out or libc;
32 binutils_bin = if nativeTools then null else binutils.bin or binutils;
33 # The wrapper scripts use 'cat', so we may need coreutils.
34 coreutils_bin = if nativeTools then null else coreutils.bin or coreutils;
···4142 preferLocalBuild = true;
4344+ inherit cc shell libc_bin libc_dev libc_lib binutils_bin coreutils_bin;
4546 passthru = { inherit libc nativeTools nativeLibc nativePrefix; };
47···59 ''
6061 + optionalString (!nativeLibc) (if (!stdenv.isDarwin) then ''
62+ dynamicLinker="${libc_lib}/lib/$dynamicLinker"
63 echo $dynamicLinker > $out/nix-support/dynamic-linker
6465+ if [ -e ${libc_lib}/lib/32/ld-linux.so.2 ]; then
66+ echo ${libc_lib}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
67 fi
6869 # The dynamic linker is passed in `ldflagsBefore' to allow
···88 # compile, because it uses "#include_next <limits.h>" to find the
89 # limits.h file in ../includes-fixed. To remedy the problem,
90 # another -idirafter is necessary to add that directory again.
91+ echo "-B${libc_lib}/lib/ -idirafter ${libc_dev}/include -idirafter $cc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
9293+ echo "-L${libc_lib}/lib" > $out/nix-support/libc-ldflags
9495+ echo "${libc_lib}" > $out/nix-support/orig-libc
96 ''
9798 + (if nativeTools then ''
···39_overrideFirst outputMan "man" "doc" "$outputBin"
40_overrideFirst outputInfo "info" "doc" "$outputMan"
4142-# Make stdenv put propagated*BuildInputs into $outputDev instead of $out
43-propagateIntoOutput="${!outputDev}"
44-4546# Add standard flags to put files into the desired outputs.
47_multioutConfig() {
···676869# Move subpaths that match pattern $1 from under any output/ to the $2 output/
070_moveToOutput() {
71 local patt="$1"
72 local dstOut="$2"
···108# Move development-only stuff to the desired outputs.
109_multioutDevs() {
110 if [ "$outputs" = "out" ] || [ -z "${moveToDev-1}" ]; then return; fi;
111- echo "Looking for development-only stuff to move between outputs"
112 _moveToOutput include "${!outputInclude}"
113 _moveToOutput lib/pkgconfig "${!outputDev}"
114- _moveToOutput "lib/*.la" "${!outputDev}"
115116- echo "Patching *.pc includedir to output ${!outputInclude}"
117- for f in "${!outputDev}"/lib/pkgconfig/*.pc; do
000118 sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f"
119 done
120}
121122-# Make ${!outputDev} propagate other outputs needed for development
0123# Note: during the build, probably only the "native" development packages are useful.
124# With current cross-building setup, all packages are "native" if not cross-building.
125_multioutPropagateDev() {
126 if [ "$outputs" = "out" ]; then return; fi;
127128- if [ "${!outputInclude}" != "$propagateIntoOutput" ]; then
129- mkdir -p "$propagateIntoOutput"/nix-support
130- echo -n " ${!outputInclude}" >> "$propagateIntoOutput"/nix-support/propagated-native-build-inputs
131- fi
132- if [ "${!outputLib}" != "$propagateIntoOutput" ]; then
133- mkdir -p "$propagateIntoOutput"/nix-support
134- echo -n " ${!outputLib}" >> "$propagateIntoOutput"/nix-support/propagated-native-build-inputs
0000000135 fi
00000136}
137
···39_overrideFirst outputMan "man" "doc" "$outputBin"
40_overrideFirst outputInfo "info" "doc" "$outputMan"
410004243# Add standard flags to put files into the desired outputs.
44_multioutConfig() {
···646566# Move subpaths that match pattern $1 from under any output/ to the $2 output/
67+# Beware: only * ? [..] patterns are accepted.
68_moveToOutput() {
69 local patt="$1"
70 local dstOut="$2"
···106# Move development-only stuff to the desired outputs.
107_multioutDevs() {
108 if [ "$outputs" = "out" ] || [ -z "${moveToDev-1}" ]; then return; fi;
109+ echo "Looking for development-only stuff to move to $outputDev"
110 _moveToOutput include "${!outputInclude}"
111 _moveToOutput lib/pkgconfig "${!outputDev}"
112+ _moveToOutput share/pkgconfig "${!outputDev}"
113114+ # don't move libtool files yet
115+ #_moveToOutput "lib/*.la" "${!outputDev}"
116+117+ for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc; do
118+ echo "Patching '$f' includedir to output ${!outputInclude}"
119 sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f"
120 done
121}
122123+# Make the first output (typically "dev") propagate other outputs needed for development.
124+# Take the first, because that's what one gets when putting the package into buildInputs.
125# Note: during the build, probably only the "native" development packages are useful.
126# With current cross-building setup, all packages are "native" if not cross-building.
127_multioutPropagateDev() {
128 if [ "$outputs" = "out" ]; then return; fi;
129130+ local outputFirst
131+ for outputFirst in $outputs; do
132+ break
133+ done
134+135+ # Default value: propagate binaries, includes and libraries
136+ if [[ ! -v "$propagatedOutputs" ]]; then
137+ local po_dirty="$outputBin $outputInclude $outputLib"
138+ propagatedOutputs=`echo "$po_dirty" \
139+ | tr -s ' ' '\n' | grep -v -F "$outputFirst" \
140+ | sort -u | tr '\n' ' ' `
141+142+ elif [ -z "$propagatedOutputs" ]; then
143+ return # variable was explicitly set to empty
144 fi
145+146+ mkdir -p "${!outputFirst}"/nix-support
147+ for output in $propagatedOutputs; do
148+ echo -n " ${!output}" >> "${!outputFirst}"/nix-support/propagated-native-build-inputs
149+ done
150}
151