uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
25
pkgs/development/libraries/qt-5/hooks/fix-qmake-libtool.sh
Normal file
25
pkgs/development/libraries/qt-5/hooks/fix-qmake-libtool.sh
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Fix libtool libraries generated by qmake.
|
||||
# qmake started inserting filenames of shared objects instead of the appropriate
|
||||
# linker flags. fixQmakeLibtool searches for broken libtool libraries and
|
||||
# replaces the filenames with the linker flags that should have been there.
|
||||
fixQmakeLibtool() {
|
||||
if [ -d "$1" ]; then
|
||||
find "$1" -name '*.la' | while read la; do
|
||||
set +e
|
||||
framework_libs=$(grep '^dependency_libs' "$la" | grep -Eo -- '-framework +\w+' | tr '\n' ' ')
|
||||
set -e
|
||||
sed -i "$la" \
|
||||
-e '/^dependency_libs/ s,\(/[^ ]\+\)/lib\([^/ ]\+\)\.so,-L\1 -l\2,g' \
|
||||
-e '/^dependency_libs/ s,-framework \+\w\+,,g'
|
||||
if [ ! -z "$framework_libs" ]; then
|
||||
if grep '^inherited_linker_flags=' $la >/dev/null; then
|
||||
sed -i "$la" -e "s/^\(inherited_linker_flags='[^']*\)/\1 $framework_libs/"
|
||||
else
|
||||
echo "inherited_linker_flags='$framework_libs'" >> "$la"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
fixupOutputHooks+=('fixQmakeLibtool $prefix')
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
# fixQtBuiltinPaths
|
||||
#
|
||||
# Usage: fixQtBuiltinPaths _dir_ _pattern_
|
||||
#
|
||||
# Fix Qt builtin paths in files matching _pattern_ under _dir_.
|
||||
#
|
||||
fixQtBuiltinPaths() {
|
||||
local dir="$1"
|
||||
local pattern="$2"
|
||||
local bin="${!outputBin}"
|
||||
local dev="${!outputDev}"
|
||||
local doc="${!outputDoc}"
|
||||
local lib="${!outputLib}"
|
||||
|
||||
if [ -d "$dir" ]; then
|
||||
find "$dir" -name "$pattern" | while read pr_; do
|
||||
if grep -q '\$\$\[QT_' "${pr_:?}"; then
|
||||
echo "fixQtBuiltinPaths: Fixing Qt builtin paths in \`${pr_:?}'..."
|
||||
sed -i "${pr_:?}" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_BINS[^]]*\\]|$dev/bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_DATA[^]]*\\]/mkspecs|$dev/mkspecs|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_PREFIX[^]]*\\]|$dev|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_ARCHDATA[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_BINS[^]]*\\]|$bin/bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_CONFIGURATION[^]]*\\]|$bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_DATA[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_DOCS[^]]*\\]|$doc/share/doc|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_EXAMPLES[^]]*\\]|$doc/examples|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_HEADERS[^]]*\\]|$dev/include|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_LIBS[^]]*\\]|$lib/lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_LIBEXECS[^]]*\\]|$lib/libexec|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_PLUGINS[^]]*\\]|$bin/$qtPluginPrefix|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_PREFIX[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_TESTS[^]]*\\]|$dev/tests|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_TRANSLATIONS[^]]*\\]|$lib/translations|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_QML[^]]*\\]|$bin/$qtQmlPrefix|g"
|
||||
fi
|
||||
done
|
||||
elif [ -e "$dir" ]; then
|
||||
if grep -q '\$\$\[QT_' "${dir:?}"; then
|
||||
echo "fixQtBuiltinPaths: Fixing Qt builtin paths in \`${dir:?}'..."
|
||||
sed -i "${dir:?}" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_BINS[^]]*\\]|$dev/bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_DATA[^]]*\\]/mkspecs|$dev/mkspecs|g" \
|
||||
-e "s|\\\$\\\$\\[QT_HOST_PREFIX[^]]*\\]|$dev|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_ARCHDATA[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_BINS[^]]*\\]|$bin/bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_CONFIGURATION[^]]*\\]|$bin|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_DATA[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_DOCS[^]]*\\]|$doc/share/doc|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_EXAMPLES[^]]*\\]|$doc/examples|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_HEADERS[^]]*\\]|$dev/include|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_LIBS[^]]*\\]|$lib/lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_LIBEXECS[^]]*\\]|$lib/libexec|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_PLUGINS[^]]*\\]|$bin/$qtPluginPrefix|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_PREFIX[^]]*\\]|$lib|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_TESTS[^]]*\\]|$dev/tests|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_TRANSLATIONS[^]]*\\]|$lib/translations|g" \
|
||||
-e "s|\\\$\\\$\\[QT_INSTALL_QML[^]]*\\]|$bin/$qtQmlPrefix|g"
|
||||
fi
|
||||
else
|
||||
echo "fixQtBuiltinPaths: Warning: \`$dir' does not exist"
|
||||
fi
|
||||
}
|
||||
36
pkgs/development/libraries/qt-5/hooks/fix-qt-module-paths.sh
Normal file
36
pkgs/development/libraries/qt-5/hooks/fix-qt-module-paths.sh
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# fixQtModulePaths
|
||||
#
|
||||
# Usage: fixQtModulePaths _dir_
|
||||
#
|
||||
# Find Qt module definitions in directory _dir_ and patch the module paths.
|
||||
#
|
||||
fixQtModulePaths () {
|
||||
local dir="$1"
|
||||
local bin="${!outputBin}"
|
||||
local dev="${!outputDev}"
|
||||
local lib="${!outputLib}"
|
||||
|
||||
if [ -d "$dir" ]; then
|
||||
find "$dir" -name 'qt_*.pri' | while read pr; do
|
||||
if grep -q '\$\$QT_MODULE_' "${pr:?}"; then
|
||||
echo "fixQtModulePaths: Fixing module paths in \`${pr:?}'..."
|
||||
sed -i "${pr:?}" \
|
||||
-e "s|\\\$\\\$QT_MODULE_LIB_BASE|$lib/lib|g" \
|
||||
-e "s|\\\$\\\$QT_MODULE_HOST_LIB_BASE|$lib/lib|g" \
|
||||
-e "s|\\\$\\\$QT_MODULE_INCLUDE_BASE|$dev/include|g" \
|
||||
-e "s|\\\$\\\$QT_MODULE_BIN_BASE|$dev/bin|g"
|
||||
fi
|
||||
done
|
||||
elif [ -e "$dir" ]; then
|
||||
echo "fixQtModulePaths: Warning: \`$dir' is not a directory"
|
||||
else
|
||||
echo "fixQtModulePaths: Warning: \`$dir' does not exist"
|
||||
fi
|
||||
|
||||
if [ "z$bin" != "z$dev" ]; then
|
||||
if [ -d "$bin/bin" ]; then
|
||||
mkdir -p "$dev/bin"
|
||||
lndir -silent "$bin/bin" "$dev/bin"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
34
pkgs/development/libraries/qt-5/hooks/move-qt-dev-tools.sh
Normal file
34
pkgs/development/libraries/qt-5/hooks/move-qt-dev-tools.sh
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
updateToolPath() {
|
||||
local tool="$1"
|
||||
local target="$2"
|
||||
local original="${!outputBin}/$tool"
|
||||
local actual="${!outputDev}/$tool"
|
||||
if grep -q "$original" "$target"; then
|
||||
echo "updateToolPath: Updating \`$original' in \`$target\'..."
|
||||
sed -i "$target" -e "s|$original|$actual|"
|
||||
fi
|
||||
}
|
||||
|
||||
moveQtDevTools() {
|
||||
if [ -n "$devTools" ]; then
|
||||
for tool in $devTools; do
|
||||
moveToOutput "$tool" "${!outputDev}"
|
||||
done
|
||||
|
||||
if [ -d "${!outputDev}/mkspecs" ]; then
|
||||
find "${!outputDev}/mkspecs" -name '*.pr?' | while read pr_; do
|
||||
for tool in $devTools; do
|
||||
updateToolPath "$tool" "$pr_"
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -d "${!outputDev}/lib/cmake" ]; then
|
||||
find "${!outputDev}/lib/cmake" -name '*.cmake' | while read cmake; do
|
||||
for tool in $devTools; do
|
||||
updateToolPath "$tool" "$cmake"
|
||||
done
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
46
pkgs/development/libraries/qt-5/hooks/qmake-hook.sh
Normal file
46
pkgs/development/libraries/qt-5/hooks/qmake-hook.sh
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
. @fix_qmake_libtool@
|
||||
|
||||
qmakeFlags=( ${qmakeFlags-} )
|
||||
|
||||
qmakePrePhase() {
|
||||
qmakeFlags_orig=( "${qmakeFlags[@]}" )
|
||||
|
||||
# These flags must be added _before_ the flags specified in the derivation.
|
||||
qmakeFlags=( \
|
||||
"PREFIX=$out" \
|
||||
"NIX_OUTPUT_OUT=$out" \
|
||||
"NIX_OUTPUT_DEV=${!outputDev}" \
|
||||
"NIX_OUTPUT_BIN=${!outputBin}" \
|
||||
"NIX_OUTPUT_DOC=${!outputDev}/${qtDocPrefix:?}" \
|
||||
"NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" \
|
||||
"NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}" \
|
||||
)
|
||||
|
||||
if [ -n "@debug@" ]; then
|
||||
qmakeFlags+=( "CONFIG+=debug" )
|
||||
else
|
||||
qmakeFlags+=( "CONFIG+=release" )
|
||||
fi
|
||||
|
||||
qmakeFlags+=( "${qmakeFlags_orig[@]}" )
|
||||
}
|
||||
prePhases+=" qmakePrePhase"
|
||||
|
||||
qmakeConfigurePhase() {
|
||||
runHook preConfigure
|
||||
|
||||
echo "QMAKEPATH=$QMAKEPATH"
|
||||
echo qmake "${qmakeFlags[@]}"
|
||||
qmake "${qmakeFlags[@]}"
|
||||
|
||||
if ! [[ -v enableParallelBuilding ]]; then
|
||||
enableParallelBuilding=1
|
||||
echo "qmake: enabled parallel building"
|
||||
fi
|
||||
|
||||
runHook postConfigure
|
||||
}
|
||||
|
||||
if [ -z "${dontUseQmakeConfigure-}" -a -z "${configurePhase-}" ]; then
|
||||
configurePhase=qmakeConfigurePhase
|
||||
fi
|
||||
112
pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
Normal file
112
pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
if [[ -n "${__nix_qtbase-}" ]]; then
|
||||
# Throw an error if a different version of Qt was already set up.
|
||||
if [[ "$__nix_qtbase" != "@dev@" ]]; then
|
||||
echo >&2 "Error: detected mismatched Qt dependencies:"
|
||||
echo >&2 " @dev@"
|
||||
echo >&2 " $__nix_qtbase"
|
||||
exit 1
|
||||
fi
|
||||
else # Only set up Qt once.
|
||||
__nix_qtbase="@dev@"
|
||||
|
||||
qtPluginPrefix=@qtPluginPrefix@
|
||||
qtQmlPrefix=@qtQmlPrefix@
|
||||
qtDocPrefix=@qtDocPrefix@
|
||||
|
||||
. @fix_qt_builtin_paths@
|
||||
. @fix_qt_module_paths@
|
||||
|
||||
# Disable debug symbols if qtbase was built without debugging.
|
||||
# This stops -dev paths from leaking into other outputs.
|
||||
if [ -z "@debug@" ]; then
|
||||
NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE-}${NIX_CFLAGS_COMPILE:+ }-DQT_NO_DEBUG"
|
||||
fi
|
||||
|
||||
# Integration with CMake:
|
||||
# Set the CMake build type corresponding to how qtbase was built.
|
||||
if [ -n "@debug@" ]; then
|
||||
cmakeBuildType="Debug"
|
||||
else
|
||||
cmakeBuildType="Release"
|
||||
fi
|
||||
|
||||
providesQtRuntime() {
|
||||
[ -d "$1/$qtPluginPrefix" ] || [ -d "$1/$qtQmlPrefix" ]
|
||||
}
|
||||
|
||||
# Build tools are often confused if QMAKE is unset.
|
||||
QMAKE=@dev@/bin/qmake
|
||||
export QMAKE
|
||||
|
||||
QMAKEPATH=
|
||||
export QMAKEPATH
|
||||
|
||||
QMAKEMODULES=
|
||||
export QMAKEMODULES
|
||||
|
||||
declare -Ag qmakePathSeen=()
|
||||
qmakePathHook() {
|
||||
# Skip this path if we have seen it before.
|
||||
# MUST use 'if' because 'qmakePathSeen[$]' may be unset.
|
||||
if [ -n "${qmakePathSeen[$1]-}" ]; then return; fi
|
||||
qmakePathSeen[$1]=1
|
||||
if [ -d "$1/mkspecs" ]
|
||||
then
|
||||
QMAKEMODULES="${QMAKEMODULES}${QMAKEMODULES:+:}/mkspecs"
|
||||
QMAKEPATH="${QMAKEPATH}${QMAKEPATH:+:}$1"
|
||||
fi
|
||||
}
|
||||
envBuildHostHooks+=(qmakePathHook)
|
||||
|
||||
# Propagate any runtime dependency of the building package.
|
||||
# Each dependency is propagated to the user environment and as a build
|
||||
# input so that it will be re-propagated to the user environment by any
|
||||
# package depending on the building package. (This is necessary in case
|
||||
# the building package does not provide runtime dependencies itself and so
|
||||
# would not be propagated to the user environment.)
|
||||
declare -Ag qtEnvHostTargetSeen=()
|
||||
qtEnvHostTargetHook() {
|
||||
# Skip this path if we have seen it before.
|
||||
# MUST use 'if' because 'qmakePathSeen[$]' may be unset.
|
||||
if [ -n "${qtEnvHostTargetSeen[$1]-}" ]; then return; fi
|
||||
qtEnvHostTargetSeen[$1]=1
|
||||
if providesQtRuntime "$1" && [ "z${!outputBin}" != "z${!outputDev}" ]
|
||||
then
|
||||
propagatedBuildInputs+=" $1"
|
||||
fi
|
||||
}
|
||||
envHostTargetHooks+=(qtEnvHostTargetHook)
|
||||
|
||||
postPatchMkspecs() {
|
||||
# Prevent this hook from running multiple times
|
||||
dontPatchMkspecs=1
|
||||
|
||||
local bin="${!outputBin}"
|
||||
local dev="${!outputDev}"
|
||||
local doc="${!outputDoc}"
|
||||
local lib="${!outputLib}"
|
||||
|
||||
moveToOutput "mkspecs" "$dev"
|
||||
|
||||
if [ -d "$dev/mkspecs/modules" ]; then
|
||||
fixQtModulePaths "$dev/mkspecs/modules"
|
||||
fi
|
||||
|
||||
if [ -d "$dev/mkspecs" ]; then
|
||||
fixQtBuiltinPaths "$dev/mkspecs" '*.pr?'
|
||||
fi
|
||||
}
|
||||
if [ -z "${dontPatchMkspecs-}" ]; then
|
||||
postPhases="${postPhases-}${postPhases:+ }postPatchMkspecs"
|
||||
fi
|
||||
|
||||
qtPreHook() {
|
||||
# Check that wrapQtAppsHook is used, or it is explicitly disabled.
|
||||
if [[ -z "$__nix_wrapQtAppsHook" && -z "$dontWrapQtApps" ]]; then
|
||||
echo >&2 "Error: wrapQtAppsHook is not used, and dontWrapQtApps is not set."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
prePhases+=" qtPreHook"
|
||||
|
||||
fi
|
||||
|
|
@ -0,0 +1 @@
|
|||
qmakeFlags+=( "QMAKE_LRELEASE=@dev@/bin/lrelease" )
|
||||
107
pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh
Normal file
107
pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
if [[ -z "${__nix_wrapQtAppsHook-}" ]]; then
|
||||
__nix_wrapQtAppsHook=1 # Don't run this hook more than once.
|
||||
|
||||
# Inherit arguments given in mkDerivation
|
||||
qtWrapperArgs=( ${qtWrapperArgs-} )
|
||||
|
||||
qtHostPathSeen=()
|
||||
|
||||
qtUnseenHostPath() {
|
||||
for pkg in "${qtHostPathSeen[@]}"
|
||||
do
|
||||
if [ "${pkg:?}" == "$1" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
qtHostPathSeen+=("$1")
|
||||
return 0
|
||||
}
|
||||
|
||||
qtHostPathHook() {
|
||||
qtUnseenHostPath "$1" || return 0
|
||||
|
||||
local pluginDir="$1/${qtPluginPrefix:?}"
|
||||
if [ -d "$pluginDir" ]
|
||||
then
|
||||
qtWrapperArgs+=(--prefix QT_PLUGIN_PATH : "$pluginDir")
|
||||
fi
|
||||
|
||||
local qmlDir="$1/${qtQmlPrefix:?}"
|
||||
if [ -d "$qmlDir" ]
|
||||
then
|
||||
qtWrapperArgs+=(--prefix QML2_IMPORT_PATH : "$qmlDir")
|
||||
fi
|
||||
}
|
||||
addEnvHooks "$hostOffset" qtHostPathHook
|
||||
|
||||
makeQtWrapper() {
|
||||
local original="$1"
|
||||
local wrapper="$2"
|
||||
shift 2
|
||||
makeWrapper "$original" "$wrapper" "${qtWrapperArgs[@]}" "$@"
|
||||
}
|
||||
|
||||
wrapQtApp() {
|
||||
local program="$1"
|
||||
shift 1
|
||||
wrapProgram "$program" "${qtWrapperArgs[@]}" "$@"
|
||||
}
|
||||
|
||||
qtOwnPathsHook() {
|
||||
local xdgDataDir="${!outputBin}/share"
|
||||
if [ -d "$xdgDataDir" ]
|
||||
then
|
||||
qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "$xdgDataDir")
|
||||
fi
|
||||
|
||||
local xdgConfigDir="${!outputBin}/etc/xdg"
|
||||
if [ -d "$xdgConfigDir" ]
|
||||
then
|
||||
qtWrapperArgs+=(--prefix XDG_CONFIG_DIRS : "$xdgConfigDir")
|
||||
fi
|
||||
|
||||
qtHostPathHook "${!outputBin}"
|
||||
}
|
||||
|
||||
preFixupPhases+=" qtOwnPathsHook"
|
||||
|
||||
# Note: $qtWrapperArgs still gets defined even if ${dontWrapQtApps-} is set.
|
||||
wrapQtAppsHook() {
|
||||
# skip this hook when requested
|
||||
[ -z "${dontWrapQtApps-}" ] || return 0
|
||||
|
||||
# guard against running multiple times (e.g. due to propagation)
|
||||
[ -z "$wrapQtAppsHookHasRun" ] || return 0
|
||||
wrapQtAppsHookHasRun=1
|
||||
|
||||
local targetDirs=( "$prefix/bin" "$prefix/sbin" "$prefix/libexec" "$prefix/Applications" "$prefix/"*.app )
|
||||
echo "wrapping Qt applications in ${targetDirs[@]}"
|
||||
|
||||
for targetDir in "${targetDirs[@]}"
|
||||
do
|
||||
[ -d "$targetDir" ] || continue
|
||||
|
||||
find "$targetDir" ! -type d -executable -print0 | while IFS= read -r -d '' file
|
||||
do
|
||||
isELF "$file" || isMachO "$file" || continue
|
||||
|
||||
if [ -f "$file" ]
|
||||
then
|
||||
echo "wrapping $file"
|
||||
wrapQtApp "$file"
|
||||
elif [ -h "$file" ]
|
||||
then
|
||||
target="$(readlink -e "$file")"
|
||||
echo "wrapping $file -> $target"
|
||||
rm "$file"
|
||||
makeQtWrapper "$target" "$file"
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
fixupOutputHooks+=(wrapQtAppsHook)
|
||||
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue