Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdenv: support __structuredAttrs, opt-in per package #85042

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6b97cdb
stdenv: add experimental __structuredAttrs option
gnprice Apr 8, 2020
26b5ce1
stdenv: add __structuredAttrs shell variable
gnprice Apr 6, 2020
b7c25fe
stdenv: handle `outputs`, `out`, etc., under structured attrs
gnprice Apr 8, 2020
15ae3da
stdenv: handle all build-inputs / deps attrs under structured attrs
gnprice Apr 7, 2020
49189ac
stdenv: handle phases, prePhases, etc., under structured attrs
gnprice Apr 8, 2020
7e2cc36
stdenv: handle srcs under structured attrs
gnprice Apr 8, 2020
e2dedb6
stdenv: handle patches under structured attrs
gnprice Apr 8, 2020
734b78e
stdenv: handle patchFlags under structured attrs
gnprice Apr 6, 2020
70abbde
stdenv: add _prepend function for structured-attrs compatibility
gnprice Apr 6, 2020
fff83e1
stdenv: use _prepend when adding to configureFlags
gnprice Apr 6, 2020
c8208b3
stdenv: use _prepend when adding to installFlags
gnprice Apr 7, 2020
d3239a2
stdenv: add _accumFlagsArray, for structured-attrs-compatible code
gnprice Apr 7, 2020
57e5ea7
stdenv: handle configureFlags under structured attrs
gnprice Apr 6, 2020
3006054
stdenv: adapt buildPhase, checkPhase, installPhase to structured attrs
gnprice Apr 6, 2020
5440f3b
stdenv: adapt installCheckPhase and distPhase to structured attrs
gnprice Apr 7, 2020
aba2bcb
stdenv: adapt strip hook to structured attrs
gnprice Apr 7, 2020
692a70e
stdenv: handle forceShare under structured attrs
gnprice Apr 8, 2020
30e0939
stdenv: handle tarballs under structured attrs
gnprice Apr 8, 2020
0fa109d
stdenv: __structuredAttrs is now often usable!
gnprice Apr 8, 2020
5d2fb45
netmask: enable structured attrs
gnprice Apr 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions pkgs/build-support/setup-hooks/move-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@
preFixupHooks+=(_moveToShare)

_moveToShare() {
forceShare=${forceShare:=man doc info}
if [ -n "$__structuredAttrs" ]; then
if [ -z "${forceShare-}" ]; then
forceShare=( man doc info )
fi
else
forceShare=( ${forceShare:-man doc info} )
fi

if [ -z "$forceShare" -o -z "$out" ]; then return; fi

for d in $forceShare; do
for d in "${forceShare[@]}"; do
if [ -d "$out/$d" ]; then
if [ -d "$out/share/$d" ]; then
echo "both $d/ and share/$d/ exist!"
Expand All @@ -20,4 +27,3 @@ _moveToShare() {
fi
done
}

25 changes: 12 additions & 13 deletions pkgs/build-support/setup-hooks/multiple-outputs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,18 @@ _multioutConfig() {
fi
fi

configureFlags="\
--bindir=${!outputBin}/bin --sbindir=${!outputBin}/sbin \
--includedir=${!outputInclude}/include --oldincludedir=${!outputInclude}/include \
--mandir=${!outputMan}/share/man --infodir=${!outputInfo}/share/info \
--docdir=${!outputDoc}/share/doc/${shareDocName} \
--libdir=${!outputLib}/lib --libexecdir=${!outputLib}/libexec \
--localedir=${!outputLib}/share/locale \
$configureFlags"

installFlags="\
pkgconfigdir=${!outputDev}/lib/pkgconfig \
m4datadir=${!outputDev}/share/aclocal aclocaldir=${!outputDev}/share/aclocal \
$installFlags"
_prepend configureFlags \
--bindir="${!outputBin}"/bin --sbindir="${!outputBin}"/sbin \
--includedir="${!outputInclude}"/include --oldincludedir="${!outputInclude}"/include \
--mandir="${!outputMan}"/share/man --infodir="${!outputInfo}"/share/info \
--docdir="${!outputDoc}"/share/doc/"${shareDocName}" \
--libdir="${!outputLib}"/lib --libexecdir="${!outputLib}"/libexec \
--localedir="${!outputLib}"/share/locale

_prepend installFlags \
pkgconfigdir="${!outputDev}"/lib/pkgconfig \
m4datadir="${!outputDev}"/share/aclocal aclocaldir="${!outputDev}"/share/aclocal

}


Expand Down
17 changes: 13 additions & 4 deletions pkgs/build-support/setup-hooks/strip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,23 @@ _doStrip() {
if [[ "${dontStrip-}" || "${flag-}" ]] || ! type -f "${stripCmd-}" 2>/dev/null
then continue; fi

stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
# TODO(structured-attrs): This doesn't work correctly if one of
# the items in strip*List or strip*Flags contains a space,
# even with structured attrs enabled. This is OK for now
# because very few packages set any of these, and it doesn't
# affect any of them.
#
# After __structuredAttrs = true is universal, come back and
# push arrays all the way through this logic.

stripDebugList=${stripDebugList[*]:-lib lib32 lib64 libexec bin sbin}
if [ -n "$stripDebugList" ]; then
stripDirs "$stripCmd" "$stripDebugList" "${stripDebugFlags:--S}"
stripDirs "$stripCmd" "$stripDebugList" "${stripDebugFlags[*]:--S}"
fi

stripAllList=${stripAllList:-}
stripAllList=${stripAllList[*]:-}
if [ -n "$stripAllList" ]; then
stripDirs "$stripCmd" "$stripAllList" "${stripAllFlags:--s}"
stripDirs "$stripCmd" "$stripAllList" "${stripAllFlags[*]:--s}"
fi
done
}
Expand Down
4 changes: 4 additions & 0 deletions pkgs/stdenv/generic/default-builder.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
if [ -e .attrs.sh ]; then
. .attrs.sh
fi

source $stdenv/setup
genericBuild
5 changes: 5 additions & 0 deletions pkgs/stdenv/generic/make-derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ in rec {

, patches ? []

# Experimental. For simple packages mostly just works,
# but for anything complex, be prepared to debug if enabling.
, __structuredAttrs ? false

, ... } @ attrs:

let
Expand Down Expand Up @@ -210,6 +214,7 @@ in rec {

userHook = config.stdenv.userHook or null;
__ignoreNulls = true;
inherit __structuredAttrs;

inherit strictDeps;

Expand Down
Loading