summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/ptxd_lib_dgen.awk59
-rw-r--r--scripts/lib/ptxd_make_00-init.sh37
-rw-r--r--scripts/lib/ptxd_make_extract.sh53
-rw-r--r--scripts/lib/ptxd_make_extract_archive.sh51
-rw-r--r--scripts/lib/ptxd_make_fixpermissions.sh9
-rw-r--r--scripts/lib/ptxd_make_get.sh9
-rwxr-xr-xscripts/lib/ptxd_make_import.awk26
-rw-r--r--scripts/lib/ptxd_make_install.sh30
-rw-r--r--scripts/lib/ptxd_make_ipkg_finish.sh25
-rw-r--r--scripts/lib/ptxd_make_world_clean.sh4
-rw-r--r--scripts/lib/ptxd_make_world_common.sh55
-rw-r--r--scripts/lib/ptxd_make_world_install.sh164
-rw-r--r--scripts/lib/ptxd_make_world_patchin.sh418
-rw-r--r--scripts/lib/ptxd_make_xpkg_common.sh3
-rw-r--r--scripts/lib/ptxd_make_xpkg_finish.sh37
-rw-r--r--scripts/lib/ptxd_make_xpkg_pkg.sh539
16 files changed, 1336 insertions, 183 deletions
diff --git a/scripts/lib/ptxd_lib_dgen.awk b/scripts/lib/ptxd_lib_dgen.awk
index 2b1253fcc..f49af9eef 100644
--- a/scripts/lib/ptxd_lib_dgen.awk
+++ b/scripts/lib/ptxd_lib_dgen.awk
@@ -19,6 +19,7 @@ BEGIN {
DGEN_DEPS_PRE = ENVIRON["PTX_DGEN_DEPS_PRE"];
DGEN_DEPS_POST = ENVIRON["PTX_DGEN_DEPS_POST"];
DGEN_RULESFILES_MAKE = ENVIRON["PTX_DGEN_RULESFILES_MAKE"];
+ PTXDIST_TEMPDIR = ENVIRON["PTXDIST_TEMPDIR"];
}
#
@@ -176,12 +177,24 @@ $1 ~ /^PTX_MAP_DEP/ {
# parse the ptx- and platformconfig
# record yes and module packages
#
-$1 ~ /^PTXCONF_/ && $2 ~ /^[ym]$/ {
+$1 ~ /^PTXCONF_/ {
this_PKG = gensub(/^PTXCONF_/, "", "g", $1);
- if (this_PKG in PKG_to_pkg)
+ if ($2 ~ /^[ym]$/ && this_PKG in PKG_to_pkg)
active_PKG_to_pkg[this_PKG] = PKG_to_pkg[this_PKG];
+ do {
+ if (this_PKG in PKG_to_pkg) {
+ next_PKG_HASHFILE = PTXDIST_TEMPDIR "/pkghash-" this_PKG;
+ if (next_PKG_HASHFILE != PKG_HASHFILE) {
+ close(PKG_HASHFILE);
+ PKG_HASHFILE = next_PKG_HASHFILE;
+ }
+ print $0 >> PKG_HASHFILE;
+ break;
+ }
+ } while (sub(/_+[^_]+$/, "", this_PKG));
+
next;
}
@@ -213,14 +226,20 @@ function import_PKG(this_PKG, this_pkg) {
" := $(STATEDIR)/" this_pkg "." stage ".post" > DGEN_DEPS_PRE;
#
+ # archive name for devel packages
+ #
+ this_devpkg = "$(" this_PKG ")-$(" this_PKG "_CFGHASH)-dev.tar.gz"
+
+ #
# things depending on target or host-, cross- package
#
- if (this_pkg !~ /^host-|^cross-/)
+ if (this_pkg !~ /^host-|^cross-/) {
# target packages
# define ${PKG}_PKGDIR
print this_PKG "_PKGDIR = $(PKGDIR)/$(" this_PKG ")" > DGEN_DEPS_PRE;
- else {
+ print this_PKG "_DEVPKG = " this_devpkg > DGEN_DEPS_PRE;
+ } else {
# host, cross packages
target_PKG = gensub(/^HOST_|^CROSS_/, "", "", this_PKG);
@@ -231,6 +250,15 @@ function import_PKG(this_PKG, this_pkg) {
print this_PKG "_SOURCE = $(" target_PKG "_SOURCE)" > DGEN_DEPS_PRE;
print this_PKG "_DIR = $(" this_PKG_type \
"BUILDDIR)/$(" target_PKG ")" > DGEN_DEPS_PRE;
+ if (this_pkg ~ /^host-/) {
+ print this_PKG "_PKGDIR = $(PKGDIR)/host-$(" \
+ this_PKG ")" > DGEN_DEPS_PRE;
+ print this_PKG "_DEVPKG = host-" this_devpkg > DGEN_DEPS_PRE;
+ } else if (this_pkg ~ /^cross-/) {
+ print this_PKG "_PKGDIR = $(PKGDIR)/cross-$(" \
+ this_PKG ")" > DGEN_DEPS_PRE;
+ print this_PKG "_DEVPKG = cross-" this_devpkg > DGEN_DEPS_PRE;
+ }
}
}
@@ -251,7 +279,12 @@ END {
print "$(STATEDIR)/" this_pkg ".tags: " "$(STATEDIR)/" this_pkg ".prepare" > DGEN_DEPS_POST;
print "$(STATEDIR)/" this_pkg ".compile: " "$(STATEDIR)/" this_pkg ".prepare" > DGEN_DEPS_POST;
print "$(STATEDIR)/" this_pkg ".install: " "$(STATEDIR)/" this_pkg ".compile" > DGEN_DEPS_POST;
- print "$(STATEDIR)/" this_pkg ".install.post: " "$(STATEDIR)/" this_pkg ".install" > DGEN_DEPS_POST;
+ print "$(STATEDIR)/" this_pkg ".install.pack: " "$(STATEDIR)/" this_pkg ".install" > DGEN_DEPS_POST;
+ print "ifeq ($(strip $(wildcard $(PTXDIST_DEVPKG_PLATFORMDIR)/$(" this_PKG "_DEVPKG))),)" > DGEN_DEPS_POST;
+ print "$(STATEDIR)/" this_pkg ".install.post: " "$(STATEDIR)/" this_pkg ".install.pack" > DGEN_DEPS_POST;
+ print "else" > DGEN_DEPS_POST;
+ print "$(STATEDIR)/" this_pkg ".install.post: " "$(STATEDIR)/" this_pkg ".install.unpack" > DGEN_DEPS_POST;
+ print "endif" > DGEN_DEPS_POST;
if (!(this_pkg ~ /^host-|^cross-/)) {
print "$(STATEDIR)/" this_pkg ".targetinstall: " "$(STATEDIR)/" this_pkg ".install.post" > DGEN_DEPS_POST;
print "$(STATEDIR)/" this_pkg ".targetinstall.post: " "$(STATEDIR)/" this_pkg ".targetinstall" > DGEN_DEPS_POST;
@@ -277,6 +310,9 @@ END {
print \
"$(STATEDIR)/" this_pkg ".prepare: " \
"$(STATEDIR)/" this_dep ".install.post" > DGEN_DEPS_POST;
+ print \
+ "$(STATEDIR)/" this_pkg ".install.unpack: " \
+ "$(STATEDIR)/" this_dep ".install.post" > DGEN_DEPS_POST;
#
# only target packages have targetinstall rules
@@ -294,6 +330,8 @@ END {
#
if (this_pkg ~ /^host-pkg-config$/)
continue;
+ if (this_pkg ~ /^host-chrpath$/)
+ continue;
if (this_pkg ~ /^host-|^cross-/)
virtual = "virtual-host-tools";
@@ -307,8 +345,19 @@ END {
print \
"$(STATEDIR)/" this_pkg ".prepare: " \
"$(STATEDIR)/" virtual ".install" > DGEN_DEPS_POST;
+ print \
+ "$(STATEDIR)/" this_pkg ".install.unpack: " \
+ "$(STATEDIR)/" virtual ".install" > DGEN_DEPS_POST;
+ }
+
+ close(PKG_HASHFILE);
+ MD5SUM_CMD = "md5sum " PTXDIST_TEMPDIR "/pkghash-*";
+ while (MD5SUM_CMD | getline) {
+ split($0, line, "[ -]")
+ print line[length(line)] "_CFGHASH = " line[1] > DGEN_DEPS_PRE;
}
+ close(MD5SUM_CMD)
close(MAP_ALL);
close(MAP_ALL_MAKE);
close(MAP_DEPS);
diff --git a/scripts/lib/ptxd_make_00-init.sh b/scripts/lib/ptxd_make_00-init.sh
index eb563a74e..709f7936d 100644
--- a/scripts/lib/ptxd_make_00-init.sh
+++ b/scripts/lib/ptxd_make_00-init.sh
@@ -113,7 +113,7 @@ ptxd_init_get_sysroot_production() {
# PTXDIST_PATH_SYSROOT_PREFIX prefixes (/, /usr) of additional sysroots (without toolchain)
# PTXDIST_PATH_SYSROOT_PREFIX_ALL prefixes (/, /usr) of all sysroots (including toolchain)
#
-ptxd_init_ptxdist_path() {
+ptxd_init_ptxdist_path_sysroot() {
local sysroot="$(ptxd_get_ptxconf PTXCONF_SYSROOT_TARGET)"
local sysroot_prefix="${sysroot}:${sysroot}/usr"
@@ -138,6 +138,20 @@ ptxd_init_ptxdist_path() {
}
+#
+#
+#
+ptxd_init_ptxdist_path() {
+ PTXDIST_PATH="${PTXDIST_WORKSPACE}:${PTXDIST_PLATFORMCONFIGDIR}:${PTXDIST_TOPDIR}:"
+ export PTXDIST_PATH
+
+ PTXDIST_PATH_PATCHES="${PTXDIST_PATH//://patches:}"
+ export PTXDIST_PATH_PATCHES
+
+ ptxd_init_ptxdist_path_sysroot
+}
+
+
#
# setup compiler and pkgconfig environment
@@ -219,6 +233,25 @@ ptxd_init_cross_env() {
IFS="${orig_IFS}"
}
+ptxd_init_devpkg()
+{
+ local prefix
+
+ prefix="$(ptxd_get_ptxconf PTXCONF_PROJECT_DEVPKGDIR)" || return 0
+
+ local platform platform_version
+ platform="$(ptxd_get_ptxconf PTXCONF_PLATFORM)"
+ platform_version="$(ptxd_get_ptxconf PTXCONF_PLATFORM_VERSION)"
+
+ if [ -n "${platform}" ]; then
+ prefix="${prefix}/platform-${platform}${platform_version}"
+ else
+ : # nothing to do for non-platform BSPs
+ fi
+
+ PTXDIST_DEVPKG_PLATFORMDIR="${prefix}"
+ export PTXDIST_DEVPKG_PLATFORMDIR
+}
#
# initialize vars needed by PTXdist's make
@@ -231,6 +264,8 @@ ptxd_make_init() {
ptxd_init_sysroot_toolchain || return
fi &&
+ ptxd_init_devpkg &&
+
ptxd_init_ptxdist_path &&
ptxd_init_cross_env
}
diff --git a/scripts/lib/ptxd_make_extract.sh b/scripts/lib/ptxd_make_extract.sh
index d38bbb34f..3c648268b 100644
--- a/scripts/lib/ptxd_make_extract.sh
+++ b/scripts/lib/ptxd_make_extract.sh
@@ -1,4 +1,11 @@
#!/bin/bash
+#
+# Copyright (C) 2008, 2009 by Marc Kleine-Budde <mkl@pengutronix.de>
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
#
# -d DEST
@@ -65,52 +72,8 @@ ptxd_make_extract() {
echo "extract: archive=${packet_source}"
echo "extract: dest=${dest}"
- local filter
-
- case "${packet_source}" in
- *gz)
- filter="--gzip"
- ;;
- *bz2)
- filter="--bzip2"
- ;;
- *lzma)
- filter="--lzma"
- ;;
- *xz)
- filter="--xz"
- ;;
- *lzop)
- filter="--lzop"
- ;;
- *tar)
- # none
- ;;
- *zip)
- echo "$(basename "${packet_source}")" >> "${STATEDIR}/packetlist"
- unzip -q "${packet_source}" -d "${dest}"
- return
- ;;
- *)
- echo
- echo "Unknown format, cannot extract!"
- echo
- return 1
- ;;
- esac
-
+ ptxd_make_extract_archive "${packet_source}" "${dest}" &&
echo "$(basename "${packet_source}")" >> "${STATEDIR}/packetlist"
- tar -C "${dest}" "${filter}" -x -f "${packet_source}" ||
- {
- cat >&2 <<EOF
-
-
-error: extracting '${packet_source}' failed
-
-
-EOF
- return 1
- }
}
export -f ptxd_make_extract
diff --git a/scripts/lib/ptxd_make_extract_archive.sh b/scripts/lib/ptxd_make_extract_archive.sh
new file mode 100644
index 000000000..f44f0c9f0
--- /dev/null
+++ b/scripts/lib/ptxd_make_extract_archive.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+ptxd_make_extract_archive() {
+ local archive="$1"
+ local dest="$2"
+ local filter
+
+ case "${archive}" in
+ *gz)
+ filter="--gzip"
+ ;;
+ *bz2)
+ filter="--bzip2"
+ ;;
+ *lzma)
+ filter="--lzma"
+ ;;
+ *xz)
+ filter="--xz"
+ ;;
+ *lzop)
+ filter="--lzop"
+ ;;
+ *tar|*tar.*)
+ # no filter or autodetect
+ ;;
+ *zip)
+ unzip -q "${archive}" -d "${dest}"
+ return
+ ;;
+ *)
+ cat >&2 <<EOF
+
+Unknown format, cannot extract!
+
+EOF
+ return 1
+ ;;
+ esac
+
+ tar -C "${dest}" "${filter}" -x -f "${archive}" || {
+ cat >&2 <<EOF
+
+error: extracting '${archive}' failed
+
+EOF
+ return 1
+ }
+}
+export -f ptxd_make_extract_archive
+
diff --git a/scripts/lib/ptxd_make_fixpermissions.sh b/scripts/lib/ptxd_make_fixpermissions.sh
index 6151d23c5..0d3d7b982 100644
--- a/scripts/lib/ptxd_make_fixpermissions.sh
+++ b/scripts/lib/ptxd_make_fixpermissions.sh
@@ -1,5 +1,12 @@
#!/bin/bash
-
+#
+# Copyright (C) 2008, 2009 by Marc Kleine-Budde <mkl@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
ptxd_make_fixpermissions_generate() {
case "${kind}" in
diff --git a/scripts/lib/ptxd_make_get.sh b/scripts/lib/ptxd_make_get.sh
index 9a9f964f6..f4d809411 100644
--- a/scripts/lib/ptxd_make_get.sh
+++ b/scripts/lib/ptxd_make_get.sh
@@ -1,5 +1,12 @@
#!/bin/bash
-
+#
+# Copyright (C) 2008, 2009 by Marc Kleine-Budde <mkl@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
#
# in env:
diff --git a/scripts/lib/ptxd_make_import.awk b/scripts/lib/ptxd_make_import.awk
index 40c5c877f..8a457478d 100755
--- a/scripts/lib/ptxd_make_import.awk
+++ b/scripts/lib/ptxd_make_import.awk
@@ -48,10 +48,7 @@ FNR == 1 {
out_file = importdir "/" prefix_file "/" gensub(in_path "/", "", "g", FILENAME);
out_dir = gensub(/^(.*)\/.*/, "\\1", "g", out_file);
- err = system(" \
- if [ \\! -d \"" out_dir "\" ]; then \
- mkdir -p -- \"" out_dir "\"; \
- fi");
+ err = system("mkdir -p -- \"" out_dir "\"");
if (err != 0)
exit(err);
}
@@ -104,14 +101,19 @@ FNR == 1 {
# add prefix to symbols on line
#
function add_prefix(IN, in_match) {
-# depends on FOO && BAR
-# +--------+ +-------+
-# | |
-# in_match[1] |
-# |
-# in_match[4]
-
- match(IN, /^([[:space:]]*(config|select|default|if|depends([[:space:]]+on)?)[[:space:]]+)(.*)$/, in_match);
+# depends on FOO && BAR
+# +----------------+ +--------+
+# | |
+# in_match[1] |
+# |
+# in_match[4]
+
+ match(IN, /^([[:space:]]*(config|select|default|if|depends([[:space:]]+on)?)[[:space:]]+)((")?[^"]*(")?)$/, in_match);
+
+ # don't convert things wrapped in ""
+ if (in_match[5] ~ /"/) {
+ return $0;
+ }
# don't convert "N" symbols like in "default N"
return in_match[1] gensub(/(!)?(N[A-Z0-9_]+|[A-MO-Z]+[A-Z0-9_]*)/, "\\1" prefix "\\2", "g", in_match[4]);
diff --git a/scripts/lib/ptxd_make_install.sh b/scripts/lib/ptxd_make_install.sh
index 71c452a4f..539a67a21 100644
--- a/scripts/lib/ptxd_make_install.sh
+++ b/scripts/lib/ptxd_make_install.sh
@@ -15,6 +15,8 @@
ptxd_make_install_init() {
. ${PTXDIST_TOPDIR}/scripts/ptxdist_vars.sh || return
+ ptxd_make_xpkg_init || return
+
local opt
while getopts "p:t:" opt; do
case "${opt}" in
@@ -39,19 +41,20 @@ ptxd_make_install_init() {
fi
echo "install_init: preparing for image creation..."
- local dst="${PKGDIR}/${packet}.tmp"
rm -fr -- \
- "${PKGDIR}/${packet}.tmp" \
- "${STATEDIR}/${packet}.perms"
- mkdir -p -- "${dst}/ipkg/CONTROL" || return
+ "${pkg_xpkg_tmp}" \
+ "${pkg_xpkg_cmds}" \
+ "${pkg_xpkg_perms}" &&
+ mkdir -p -- "${pkg_ipkg_control_dir}" &&
+ touch "${pkg_xpkg_cmds}" || return
local replace_from="ARCH"
local replace_to="${PTXDIST_IPKG_ARCH_STRING}"
echo -n "install_init: @${replace_from}@ -> ${replace_to} ... "
sed -e "s,@${replace_from}@,${replace_to},g" "${RULESDIR}/default.ipkg" > \
- "${dst}/ipkg/CONTROL/control" || return
+ "${pkg_ipkg_control}" || return
echo "done"
local script rd found
@@ -69,7 +72,7 @@ ptxd_make_install_init() {
if [ -f "${abs_script}" ]; then
install -m 0755 \
-D "${abs_script}" \
- "${dst}/ipkg/CONTROL/${script}" || return
+ "${pkg_ipkg_control_dir}/${script}" || return
echo "packaging: '${abs_script}'"
@@ -98,6 +101,8 @@ export -f ptxd_make_install_init
ptxd_make_install_fixup() {
. ${PTXDIST_TOPDIR}/scripts/ptxdist_vars.sh || return
+ ptxd_make_xpkg_init || return
+
local opt
while getopts "p:f:t:s:" opt; do
case "${opt}" in
@@ -137,23 +142,22 @@ ptxd_make_install_fixup() {
#
# track "pkg name" to "xpkg filename"
#
- local xpkg_map="${STATEDIR}/${target}.xpkg.map"
- if [ -e "${xpkg_map}" ]; then
- sed -i -e "/^${replace_to}$/d" "${xpkg_map}" &&
+ if [ -e "${pkg_xpkg_map}" ]; then
+ sed -i -e "/^${replace_to}$/d" "${pkg_xpkg_map}" &&
- if [ -s "${xpkg_map}" ]; then
+ if [ -s "${pkg_xpkg_map}" ]; then
cat >&2 <<EOF
${PREFIX}warning: more than one ipkg per PTXdist package detected:
pkg: '${target}'
-ipkg: '${replace_to}' and '$(cat "${xpkg_map}")'
+ipkg: '${replace_to}' and '$(cat "${pkg_xpkg_map}")'
EOF
fi
fi &&
- echo "${replace_to}" >> "${xpkg_map}" || return
+ echo "${replace_to}" >> "${pkg_xpkg_map}" || return
;;
@@ -166,7 +170,7 @@ EOF
esac
echo -n "install_fixup: @${replace_from}@ -> ${replace_to} ... "
- sed -i -e "s,@$replace_from@,$replace_to,g" "${PKGDIR}/$packet.tmp/ipkg/CONTROL/control" || return
+ sed -i -e "s,@$replace_from@,$replace_to,g" "${pkg_ipkg_control}" || return
echo "done."
}
diff --git a/scripts/lib/ptxd_make_ipkg_finish.sh b/scripts/lib/ptxd_make_ipkg_finish.sh
index eefa0e7d9..8f91916c3 100644
--- a/scripts/lib/ptxd_make_ipkg_finish.sh
+++ b/scripts/lib/ptxd_make_ipkg_finish.sh
@@ -9,6 +9,16 @@
# see the README file.
#
+#
+# the actual ipkg package creation, will run in fakeroot
+#
+ptxd_make_ipkg_finish_impl() {
+ chown -R 0:0 "${pkg_xpkg_tmp}" &&
+ ptxd_make_xpkg_pkg "${pkg_ipkg_tmp}" "${pkg_xpkg_cmds}" "${pkg_xpkg_perms}" &&
+ ipkg-build ${pkg_ipkg_extra_args} "${pkg_ipkg_tmp}" "${ptx_pkg_dir}"
+}
+export -f ptxd_make_ipkg_finish_impl
+
#
# create an ipkg package
@@ -22,12 +32,13 @@ ptxd_make_ipkg_finish() {
sed -i -e "s:@DEPENDS@:${dep}:g" "${pkg_ipkg_control}" || return
- {
- echo "pushd '${pkg_ipkg_tmp}' >/dev/null &&" &&
- ptxd_dopermissions "${pkg_xpkg_perms}" &&
- echo "popd >/dev/null &&" &&
- echo "ipkg-build ${pkg_ipkg_extra_args} '${pkg_ipkg_tmp}' '${ptx_pkg_dir}' >/dev/null"
- } | fakeroot -- &&
- check_pipe_status
+ local -a fake_args
+ if [ -f "${pkg_fake_env}" ]; then
+ fake_args=( "-i" "${pkg_fake_env}" )
+ fi
+ fake_args[${#fake_args[@]}]="-u"
+
+ export ${!pkg_*} ${!ptx_*}
+ fakeroot "${fake_args[@]}" -- ptxd_make_ipkg_finish_impl
}
export -f ptxd_make_ipkg_finish
diff --git a/scripts/lib/ptxd_make_world_clean.sh b/scripts/lib/ptxd_make_world_clean.sh
index f173ac1db..87b7ab994 100644
--- a/scripts/lib/ptxd_make_world_clean.sh
+++ b/scripts/lib/ptxd_make_world_clean.sh
@@ -13,9 +13,9 @@
ptxd_make_world_clean() {
ptxd_make_world_init &&
- if [ -f "${ptx_state_dir}/${pkg_label}.xpkg.map" ]; then
+ if [ -f "${pkg_xpkg_map}" ]; then
echo "Deleting ipks:"
- for name in $(cat "${ptx_state_dir}/${pkg_label}.xpkg.map" 2>/dev/null); do
+ for name in $(cat "${pkg_xpkg_map}" 2>/dev/null); do
ls "${ptx_pkg_dir}/${name}"_*.ipk
rm -f "${ptx_pkg_dir}/${name}"_*.ipk
done
diff --git a/scripts/lib/ptxd_make_world_common.sh b/scripts/lib/ptxd_make_world_common.sh
index 452320586..58e42eb9b 100644
--- a/scripts/lib/ptxd_make_world_common.sh
+++ b/scripts/lib/ptxd_make_world_common.sh
@@ -149,7 +149,7 @@ ptxd_make_world_init_compat() {
# pkg_sysroot_dir
#
case "${pkg_stamp}" in
- initramfs-*|klibc-*) pkg_sysroot_dir="${PTXDIST_SYSROOT_TARGET}/usr/lib/klibc" ;;
+ klibc-*) pkg_sysroot_dir="${PTXDIST_SYSROOT_TARGET}/usr/lib/klibc" ;;
host-*) pkg_sysroot_dir="${PTXDIST_SYSROOT_HOST}" ;;
cross-*) pkg_sysroot_dir="${PTXDIST_SYSROOT_CROSS}" ;;
*) pkg_sysroot_dir="${PTXDIST_SYSROOT_TARGET}" ;;
@@ -160,7 +160,7 @@ ptxd_make_world_init_compat() {
# pkg_env
case "${pkg_type}" in
target) pkg_env="${PTXDIST_CROSS_ENV_PKG_CONFIG} SYSROOT='${pkg_sysroot_dir}'" ;;
- host|cross) pkg_env="PKG_CONFIG_LIBDIR='${PTXDIST_SYSROOT_HOST}/lib/pkgconfig:${PTXDIST_SYSROOT_HOST}/share/pkgconfig'" ;;
+ host|cross) pkg_env="PKG_CONFIG_LIBDIR='${PTXDIST_SYSROOT_HOST}/lib/pkgconfig:${PTXDIST_SYSROOT_HOST}/share/pkgconfig' SYSROOT='${pkg_sysroot_dir}'" ;;
esac
}
export -f ptxd_make_world_init_compat
@@ -199,13 +199,6 @@ ptxd_make_world_init() {
ptxd_make_world_init_sanity_check || return
#
- # sanitize pkg_pkg_dir
- #
- if [ "${pkg_pkg_dir}" = "${ptx_pkg_dir}/" ]; then
- pkg_pkg_dir=""
- fi
-
- #
# type
#
case "${pkg_stamp}" in
@@ -214,6 +207,15 @@ ptxd_make_world_init() {
esac
#
+ # sanitize pkg_pkg_dir
+ #
+ if [ "${pkg_pkg_dir}" = "${ptx_pkg_dir}/" -o \
+ "${pkg_pkg_dev}" = "NO" -a "${pkg_type}" != "target" ]; then
+ pkg_pkg_dir=""
+ local conf_opt_ext="_sysroot"
+ fi
+
+ #
# label + stage
#
pkg_label="${pkg_stamp%%.*}"
@@ -222,6 +224,12 @@ ptxd_make_world_init() {
ptxd_make_world_init_compat || return
#
+ # xpkg mapping
+ #
+ pkg_xpkg_map="${ptx_state_dir}/${pkg_label}.xpkg.map"
+ pkg_fake_env="${ptx_state_dir}/${pkg_label}.fakeroot"
+
+ #
# path
#
local path_ptr="ptx_path_${pkg_type}"
@@ -253,7 +261,7 @@ ptxd_make_world_init() {
case "${pkg_conf_tool}" in
autoconf|cmake|qmake)
- local conf_opt_ptr="ptx_conf_opt_${pkg_conf_tool}_${pkg_type}"
+ local conf_opt_ptr="ptx_conf_opt_${pkg_conf_tool}_${pkg_type}${conf_opt_ext}"
local conf_env_ptr="ptx_conf_env_${pkg_type}"
pkg_conf_opt="${pkg_conf_opt:-${!conf_opt_ptr}}"
@@ -268,21 +276,16 @@ ptxd_make_world_init() {
# build dir
#
if [ -z "${pkg_build_dir}" ]; then
- case "${pkg_conf_tool}" in
- cmake) # cmake based pkg -> _always_ out of tree
- pkg_build_dir="${pkg_dir}-build"
- ;;
- autoconf) # autotoolizied pkg
- case "${pkg_build_oot}" in
- "YES") pkg_build_dir="${pkg_dir}-build" ;;
- "NO") pkg_build_dir="${pkg_conf_dir}" ;;
- "") pkg_build_dir="${pkg_conf_dir}" ;;
- *) ptxd_bailout "<PKG>_BUILD_OOT: please set to YES or NO" ;;
- esac
- ;;
- *) # qmake or std pkg
- pkg_build_dir="${pkg_conf_dir}"
- ;;
+ if [ -z "${pkg_build_oot}" ]; then
+ case "${pkg_conf_tool}" in
+ cmake) pkg_build_oot=YES ;;
+ *) pkg_build_oot=NO ;;
+ esac
+ fi
+ case "${pkg_build_oot}" in
+ "YES") pkg_build_dir="${pkg_dir}-build" ;;
+ "NO") pkg_build_dir="${pkg_conf_dir}" ;;
+ *) ptxd_bailout "<PKG>_BUILD_OOT: please set to YES or NO" ;;
esac
fi
@@ -304,7 +307,7 @@ ptxd_make_world_init() {
# parallelmake
#
case "${pkg_make_par}" in
- "YES"|"") pkg_make_par="${PTXDIST_PARALLELMFLAGS_INTERN}" ;;
+ "YES"|"") pkg_make_par="${PTXDIST_PARALLELMFLAGS_INTERN} ${PTXDIST_LOADMFLAGS_INTERN}" ;;
"NO") pkg_make_par=-j1 ;;
*) ptxd_bailout "<PKG>_MAKE_PAR: please set to YES or NO" ;;
esac
diff --git a/scripts/lib/ptxd_make_world_install.sh b/scripts/lib/ptxd_make_world_install.sh
index a88fb9729..7599ecd24 100644
--- a/scripts/lib/ptxd_make_world_install.sh
+++ b/scripts/lib/ptxd_make_world_install.sh
@@ -8,13 +8,41 @@
#
#
-# in:
-# $echo optional
-# $fakeroot optional
+# prepare
+#
+# create pkg_pkg_dir and typical subdirs if pkg_pkg_dir is defined
+#
+ptxd_make_world_install_prepare() {
+ ptxd_make_world_init &&
+
+ if [ -z "${pkg_pkg_dir}" ]; then
+ return
+ fi &&
+ rm -rf -- "${pkg_pkg_dir}" &&
+ mkdir -p -- "${pkg_pkg_dir}"/{etc,{,usr/}{lib,{,s}bin,include,{,share/}man/man{1,2,3,4,5,6,7,8,9}}}
+}
+export -f ptxd_make_world_install_prepare
+
#
# FIXME: kick ${pkg_install_env}
#
-ptxd_make_world_install_pkg() {
+ptxd_make_world_install() {
+ local -a fakeargs
+ #
+ # fakeroot is a host pkg and
+ # might not be available, yet
+ #
+ if ! eval "${pkg_path}" which fakeroot > /dev/null; then
+ local echo="eval"
+ local fakeroot="cat"
+ fi &&
+
+# if [ -z "${fakeroot}" ]; then
+# fakeargs=( "-s" "${pkg_fake_env}" )
+# fi
+
+ ptxd_make_world_install_prepare &&
+
"${echo:-echo}" \
"${pkg_path}" \
"${pkg_env}" \
@@ -24,26 +52,55 @@ ptxd_make_world_install_pkg() {
-C "${pkg_build_dir}" \
"${pkg_install_opt}" \
-j1 \
- | "${fakeroot:-fakeroot}" --
+ | "${fakeroot:-fakeroot}" "${fakeargs[@]}" --
check_pipe_status
}
-export -f ptxd_make_world_install_pkg
-
-
+export -f ptxd_make_world_install
#
-# install
+# unpack
#
-# Perform standard install actions
+# unpack the dev tarball to pkg_pkg_dir
#
-ptxd_make_world_install_target() {
+ptxd_make_world_install_unpack() {
+ local pkg_prefix
+
+ ptxd_make_world_init &&
+
+ case "${pkg_type}" in
+ host|cross) pkg_prefix="${pkg_type}-" ;;
+ *) pkg_prefix="" ;;
+ esac &&
+
+ if [ \! -e "${ptx_pkg_dev_dir}/${pkg_pkg_dev}" ]; then
+ ptxd_bailout "Internal error: '$(ptxd_print_path ${ptx_pkg_dev_dir}/${pkg_pkg_dev})' does not exist."
+ fi &&
rm -rf -- "${pkg_pkg_dir}" &&
- mkdir -p -- "${pkg_pkg_dir}"/{etc,{,usr/}{lib,{,s}bin,include,{,share/}man/man{1,2,3,4,5,6,7,8,9}}} &&
+ mkdir -p -- "${ptx_pkg_dir}" &&
+ tar -x -C "${ptx_pkg_dir}" -z -f "${ptx_pkg_dev_dir}/${pkg_pkg_dev}" &&
+
+ # fix rpaths in host/cross tools
+ if [ "${pkg_type}" != "target" ]; then
+ find "${pkg_pkg_dir}" ! -type d -executable -print | while read file; do
+ if chrpath "${file}" > /dev/null 2>&1; then
+ chrpath --replace "${PTXDIST_SYSROOT_HOST}/lib" "${file}" || return
+ fi
+ done
+ fi
+}
+export -f ptxd_make_world_install_unpack
- ptxd_make_world_install_pkg "${pkg_pkg_dir}" || return
+#
+# pack
+#
+# pack the dev tarball from pkg_pkg_dir
+#
+ptxd_make_world_install_pack() {
+ ptxd_make_world_init &&
# remove empty dirs
- find "${pkg_pkg_dir}" -type d -print0 | xargs -r -0 -- \
+ test \! -e "${pkg_pkg_dir}" || \
+ find "${pkg_pkg_dir}" -type d -print0 | xargs -r -0 -- \
rmdir --ignore-fail-on-non-empty -p -- &&
check_pipe_status &&
@@ -52,54 +109,59 @@ ptxd_make_world_install_target() {
return
fi &&
- # prefix paths in la files with sysroot
- find "${pkg_pkg_dir}" -name "*.la" -print0 | xargs -r -0 -- \
- sed -i \
- -e "/^dependency_libs/s:\( \)\(/lib\|/usr/lib\):\1${pkg_sysroot_dir}\2:g" \
- -e "/^libdir=/s:\(libdir='\)\(/lib\|/usr/lib\):\1${pkg_sysroot_dir}\2:g" &&
- check_pipe_status &&
-
# make pkgconfig's pc files relocatable
find "${pkg_pkg_dir}" -name "*.pc" -print0 | \
xargs -r -0 gawk -f "${PTXDIST_LIB_DIR}/ptxd_make_world_install_mangle_pc.awk" &&
check_pipe_status &&
- cp -dprf -- "${pkg_pkg_dir}"/* "${pkg_sysroot_dir}"
+ local pkg_sysroot_dir_nolink="$(readlink -f "${pkg_sysroot_dir}")" &&
+ # remove sysroot prefix from paths in la files
+ find "${pkg_pkg_dir}" -name "*.la" -print0 | xargs -r -0 -- \
+ sed -i \
+ -e "/^dependency_libs/s:\( \|-L\|-R\)\(\|${pkg_sysroot_dir}\|${pkg_sysroot_dir_nolink}\|${pkg_pkg_dir}\)/*\(/lib\|/usr/lib\):\1@SYSROOT@\3:g" \
+ -e "/^libdir=/s:\(libdir='\)\(\|${pkg_sysroot_dir}\|${pkg_sysroot_dir_nolink}\|${pkg_pkg_dir}\)/*\(/lib\|/usr/lib\):\1@SYSROOT@\3:g" &&
+ check_pipe_status &&
+ find "${pkg_pkg_dir}" -name "*.prl" -print0 | xargs -r -0 -- \
+ sed -i \
+ -e "/^QMAKE_PRL_LIBS/s:\( \|-L\|-R\)\(\|${pkg_sysroot_dir}\|${pkg_sysroot_dir_nolink}\|${pkg_pkg_dir}\)/*\(/lib\|/usr/lib\):\1@SYSROOT@\3:g" &&
+ check_pipe_status &&
+ find "${pkg_pkg_dir}" ! -type d -name "${pkg_binconfig_glob}" -print0 | xargs -r -0 -- \
+ sed -i \
+ -e "s:\(-L\|-Wl,\)\(${pkg_sysroot_dir}\|${pkg_sysroot_dir_nolink}\)/*\(/lib\|/usr/lib\):\1@SYSROOT@\3:g" \
+ -e "s:\(-I\|-isystem \)\(${pkg_sysroot_dir}\|${pkg_sysroot_dir_nolink}\)/*\(/include\|/usr/include\):\1@SYSROOT@\3:g" &&
+ check_pipe_status &&
- # copy *-config into sysroot_cross
- local config
- for config in $(find "${pkg_pkg_dir}" -name "${pkg_binconfig_glob}"); do
- cp -PR -- "${config}" "${PTXDIST_SYSROOT_CROSS}/bin" || return
- done
+ if [ "${pkg_pkg_dev}" != "NO" -a "$(ptxd_get_ptxconf PTXCONF_PROJECT_CREATE_DEVPKGS)" = "y" ]; then
+ tar -c -C "${ptx_pkg_dir}" -z -f "${ptx_pkg_dir}/${pkg_pkg_dev}" "${pkg_pkg_dir##*/}"
+ fi
}
-export -f ptxd_make_world_install_target
-
+export -f ptxd_make_world_install_pack
#
-# for host pkgs
-#
-ptxd_make_world_install_host() {
- #
- # fakeroot is a host pkg and
- # might not be available, yet
- #
- local echo="eval"
- local fakeroot="cat"
-
- ptxd_make_world_install_pkg
-}
-export -f ptxd_make_world_install_host
-
-
+# post
#
-# generic "make install" function
+# cleanup an copy to sysroot
#
-ptxd_make_world_install() {
+ptxd_make_world_install_post() {
ptxd_make_world_init &&
+ # do nothing if pkg_pkg_dir does not exist
+ if [ \! -d "${pkg_pkg_dir}" ]; then
+ return
+ fi &&
+ # prefix paths in la files with sysroot
+ find "${pkg_pkg_dir}" \( -name "*.la" -o -name "*.prl" \) -print0 | xargs -r -0 -- \
+ sed -i -e "s:@SYSROOT@:${pkg_sysroot_dir}:g" &&
+ check_pipe_status &&
- case "${pkg_type}" in
- target) ptxd_make_world_install_target ;;
- *) ptxd_make_world_install_host ;;
- esac
+ cp -dprf -- "${pkg_pkg_dir}"/* "${pkg_sysroot_dir}" &&
+
+ # fix *-config and copy into sysroot_cross for target packages
+ local config &&
+ find "${pkg_pkg_dir}" ! -type d -name "${pkg_binconfig_glob}" | while read config; do
+ sed -i -e "s:@SYSROOT@:${pkg_sysroot_dir}:g" "${config}" &&
+ if [ "${pkg_type}" = "target" ]; then
+ cp -P -- "${config}" "${PTXDIST_SYSROOT_CROSS}/bin" || return
+ fi
+ done
}
-export -f ptxd_make_world_install
+export -f ptxd_make_world_install_post
diff --git a/scripts/lib/ptxd_make_world_patchin.sh b/scripts/lib/ptxd_make_world_patchin.sh
new file mode 100644
index 000000000..80a50e9d7
--- /dev/null
+++ b/scripts/lib/ptxd_make_world_patchin.sh
@@ -0,0 +1,418 @@
+#!/bin/bash
+#
+# Copyright (C) 2004-2009 by the ptxdist project
+# 2010 by Marc Kleine-Budde <mkl@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# ptxd_make_world_patchin_apply_init -
+# initialize variables used to apply the patches
+#
+# out:
+#
+# pkg_patch_autogen path to autogen.sh
+# pkg_patch_dir path to dir that contains the patches
+# pkg_patch_series path to series file
+# pkg_patch_tool tool used to apply the patch series
+#
+ptxd_make_world_patchin_apply_init()
+{
+ #
+ # for compatibility, look first in 'generic', then in standard
+ # location
+ #
+ local path="${PTXDIST_PATH_PATCHES//://${pkg_pkg}/generic } \
+ ${PTXDIST_PATH_PATCHES//://${pkg_pkg} }"
+
+ # find patch_dir
+ if ! ptxd_get_dirs "${path}"; then
+ echo "patchin: no patches found"
+ return
+ fi
+ pkg_patch_dir="${ptxd_reply}"
+
+ # look for autogen.sh
+ pkg_patch_autogen="${pkg_patch_dir}/autogen.sh"
+ if [ \! -x "${pkg_patch_autogen}" ]; then
+ unset pkg_patch_autogen
+ fi
+
+ # look for series
+ if [ -n "${pkg_patch_series}" ]; then
+ # check if specified series file can be found
+ pkg_patch_series="${pkg_patch_dir}/${pkg_patch_series}"
+ if [ \! -e "${pkg_patch_series}" ]; then
+ echo "error: specified series '${pkg_patch_series}' not found"
+ return 1
+ fi
+ else
+ # is there a "series" file
+ pkg_patch_series="${pkg_patch_dir}/series"
+ if [ \! -e "${pkg_patch_series}" ]; then
+ unset pkg_patch_series
+ fi
+ fi
+
+ # decide which tool to use
+ if [ "${PTXCONF_SETUP_PATCHIN_GIT}" ] && which git > /dev/null 2>&1; then
+ pkg_patch_tool=git
+ elif which quilt > /dev/null 2>&1; then
+ pkg_patch_tool=quilt
+ else
+ pkg_patch_tool=patch
+ fi
+}
+export -f ptxd_make_world_patchin_apply_init
+
+
+#
+# initialize git database in $pkg_patchin_dir and do initial commit
+#
+ptxd_make_world_patchin_apply_git_init()
+{
+ local git_dir
+ git_dir="$(git rev-parse --git-dir 2> /dev/null)" || true
+
+ # is already git repo?
+ if [ "${git_dir}" != ".git" ]; then
+ echo "patchin: git: initializing repository"
+ git init -q "${pkg_patchin_dir}" &&
+ git add -f . &&
+ git commit -q -m "initial commit" --author="ptxdist-${PTXDIST_VERSION_FULL} <ptxdist@pengutronix.de>" &&
+ git tag "${pkg_pkg}"
+ git tag base
+ echo "patchin: git: done"
+ fi
+}
+export -f ptxd_make_world_patchin_apply_git_init
+
+
+#
+# create a directory containing the patches and the selected series
+# file. name that file "series".
+#
+# decompress "bz2" and "gz" patches on the fly
+#
+ptxd_make_world_patchin_apply_git_compat()
+{
+ mkdir "${pkg_patchin_dir}/.ptxdist/git-patches" || return
+
+ local patch para
+ while read patch para; do
+ local cat
+ local patch_file="${patch##*/}"
+
+ case "${para}" in
+ ""|"#"*) para="-p1" ;; # no para or comment
+ -p*) ;;
+ esac
+
+ case "${patch}" in
+ ""|"#"*) continue ;; # skip empty lines and comments
+ *.gz) cat="zcat" ;;
+ *.bz2) cat="bzcat" ;;
+ *)
+ ln -s "../patches/${patch}" "${pkg_patchin_dir}/.ptxdist/git-patches/${patch_file}" &&
+ echo "${patch_file}" "${para}" >> "${pkg_patchin_dir}/.ptxdist/git-patches/series" || return
+ continue
+ ;;
+ esac &&
+
+ "${cat}" "${pkg_patchin_dir}/.ptxdist/patches/${patch}" > \
+ "${pkg_patchin_dir}/.ptxdist/git-patches/${patch_file%.*}"
+ echo "${patch_file%.*}" "${para}" >> "${pkg_patchin_dir}/.ptxdist/git-patches/series" || return
+
+ done < "${pkg_patchin_dir}/.ptxdist/series"
+}
+export -f ptxd_make_world_patchin_apply_git_compat
+
+
+#
+# apply patch series with git
+#
+ptxd_make_world_patchin_apply_git()
+{
+ #
+ # git quiltimport has certain limitations, work around them
+ #
+ ptxd_make_world_patchin_apply_git_compat || return
+
+ git quiltimport \
+ --patches "${pkg_patchin_dir}/.ptxdist/git-patches" \
+ --author "unknown author <unknown.author@example.com>"
+}
+export -f ptxd_make_world_patchin_apply_git
+
+
+#
+# apply patch series with quilt
+#
+ptxd_make_world_patchin_apply_quilt()
+{
+ QUILT_PATCHES="${pkg_patchin_dir}/.ptxdist/patches" quilt push -a
+}
+export -f ptxd_make_world_patchin_apply_quilt
+
+
+#
+# apply patch series with patch
+#
+ptxd_make_world_patchin_apply_patch()
+{
+ local patch para junk
+
+ while read patch para junk; do
+ local cat
+
+ case "${patch}" in
+ ""|"#"*) continue ;; # skip empty lines and comments
+ *.gz) cat=zcat ;;
+ *.bz2) cat=bzcat ;;
+ *) cat=cat ;;
+ esac
+
+ case "${para}" in
+ ""|"#"*) para="-p1" ;; # no para or comment
+ -p*) ;;
+ esac
+
+ echo "applying '${patch}'"
+ patch="${pkg_patchin_dir}/.ptxdist/patches/${patch}"
+ "${cat}" "${patch}" | patch "${para}" -N -d "${pkg_patchin_dir}" &&
+ check_pipe_status || return
+
+ done < "${pkg_patchin_dir}/.ptxdist/series" &&
+ unset patch para junk
+}
+export -f ptxd_make_world_patchin_apply_patch
+
+
+#
+# generic apply patch series function
+#
+ptxd_make_world_patchin_apply()
+{
+ local \
+ pkg_patch_autogen \
+ pkg_patch_dir \
+ pkg_patch_series \
+ pkg_patch_tool
+
+ ptxd_make_world_patchin_apply_init || return
+ if [ -z "${pkg_patch_dir}" ]; then
+ return
+ fi &&
+
+ if [ "${pkg_patch_tool}" = "git" ]; then
+ ptxd_make_world_patchin_apply_git_init || return
+ fi &&
+
+ #
+ # the primary reference is the ".ptxdist" folder in the pkg_patchin_dir:
+ # these files might be existent:
+ #
+ # patches link, pointing to the dir containing the pkg's patches
+ # series usually link, pointing to the used series file
+ # if no series file is supplied and the folder
+ # containing the patches is not writable, this will be a
+ # file
+ #
+ if [ -e "${pkg_patchin_dir}/.ptxdist" ]; then
+ ptxd_bailout "pkg_patchin_dir '${pkg_patchin_dir}' already contains a '.ptxdist' folder"
+ fi &&
+ mkdir "${pkg_patchin_dir}/.ptxdist" &&
+
+ #
+ # create a ".ptxdist/patches" link pointing to the directory
+ # containing the patches
+ #
+ ln -s "${pkg_patch_dir}" "${pkg_patchin_dir}/.ptxdist/patches" &&
+
+ # link series file - if not available create it
+ if [ -z "${pkg_patch_series}" ]; then
+
+ ptxd_pedantic "series file for '$(ptxd_print_path "${pkg_patch_dir}")' is missing"
+
+ # if writable, create series file next to the patches
+ if [ -w "${pkg_patch_dir}/" ]; then
+ pkg_patch_series="${pkg_patch_dir}/series" &&
+ ln -s "${pkg_patch_series}" "${pkg_patchin_dir}/.ptxdist/series"
+ else
+ pkg_patch_series="${pkg_patchin_dir}/.ptxdist/series"
+ fi &&
+
+ #
+ # look for patches (and archives) and put into series file
+ # (the "sed" removes "./" from find's output)
+ #
+ pushd "${pkg_patch_dir}/" >/dev/null &&
+ find \
+ -name "*.diff" -o \
+ -name "*.patch" -o \
+ -name "*.bz2" -o \
+ -name "*.gz" | \
+ sed -e "s:^[.]/::" > \
+ "${pkg_patch_series}" &&
+ popd > /dev/null
+
+ # no patches found
+ if [ \! -s "${pkg_patch_series}" ]; then
+ rm -f \
+ "${pkg_patchin_dir}/.ptxdist/series" \
+ "${pkg_patch_series}" &&
+ unset pkg_patch_series
+ fi
+ else
+ ln -s "${pkg_patch_series}" "${pkg_patchin_dir}/.ptxdist/series"
+
+ #
+ # check for non existing patches
+ #
+ # Some tools like "git" skip non existing patches without an
+ # error. In ptxdist we consider this a fatal error.
+ #
+ local patch para junk
+ while read patch tmp; do
+ case "${patch}" in
+ ""|"#"*) continue ;; # skip empty lines and comments
+ *) ;;
+ esac
+
+ case "${para}" in
+ ""|"#"*) ;; # no para or comment
+ -p*) ;;
+ *) ptxd_bailout "invalid parameter to patch '${patch}' in series file '${pkg_patch_series}'"
+ esac
+
+ if [ \! -f "${pkg_patchin_dir}/.ptxdist/patches/${patch}" ]; then
+ ptxd_bailout "cannot find patch: '${patch}' specified in series file '${pkg_patch_series}'"
+ fi
+
+ done < "${pkg_patchin_dir}/.ptxdist/series" &&
+ unset patch para junk
+ fi || return
+
+ #
+ # setup convenience links
+ #
+ # series
+ if [ -e "${pkg_patchin_dir}/.ptxdist/series" ]; then
+ if [ -e "${pkg_patchin_dir}/series" ]; then
+ ptxd_bailout "there's a 'series' file in the pkg_patchin_dir"
+ fi
+ ln -sf ".ptxdist/series" "${pkg_patchin_dir}/series"
+ fi &&
+
+ # patches
+ if [ \! -e "${pkg_patchin_dir}/patches" ]; then
+ ln -sf ".ptxdist/patches" "${pkg_patchin_dir}/patches"
+ fi || return
+
+ echo "pkg_patch_dir: '$(ptxd_print_path "${pkg_patch_dir:-<none>}")'"
+ echo "pkg_patch_series: '$(ptxd_print_path "${pkg_patch_series:-<none>}")'"
+ echo "pkg_patch_autogen: '$(ptxd_print_path "${pkg_patch_autogen:-<none>}")'"
+ echo
+
+ # apply patches if series file is available
+ if [ -n "${pkg_patch_series}" ]; then
+ echo "patchin: ${pkg_patch_tool}: apply '$(ptxd_print_path ${pkg_patch_series})'"
+ "ptxd_make_world_patchin_apply_${pkg_patch_tool}" || return
+ echo -e "patchin: ${pkg_patch_tool}: done\n"
+ fi
+
+ # run autogen.sh if available
+ if [ -n "${pkg_patch_autogen}" ]; then
+ echo "patchin: autogen: running '${pkg_patch_autogen}'"
+ "${pkg_patch_autogen}" || return
+ echo -e "patchin: autogen: done\n"
+ fi
+}
+export -f ptxd_make_world_patchin_apply
+
+
+#
+#
+#
+ptxd_make_world_patchin_fixup()
+{
+ local file
+
+ echo "patchin: fixup:"
+ find "${pkg_patchin_dir}/" -name "configure" -a -type f -a \! -path "*/.pc/*" | while read file; do
+ ptxd_print_path "${file}"
+ #
+ # the first fixes a problem with libtool on blackfin:
+ # - on blackfin they've got symbols with more "_" prefixes than on other platforms
+ # - teach libtool to cope with it
+ #
+ # the second one supresses the adding of "rpath"
+ #
+ sed -i \
+ -e "s=sed -e \"s/\\\\(\.\*\\\\)/\\\\1;/\"=sed -e \"s/\\\\(.*\\\\)/'\"\$ac_symprfx\"'\\\\1;/\"=" \
+ \
+ -e "s:^\(hardcode_into_libs\)=.*:\1=\"no\":" \
+ -e "s:^\(hardcode_libdir_flag_spec\)=.*:\1=\"\":" \
+ -e "s:^\(hardcode_libdir_flag_spec_ld\)=.*:\1=\"\":" \
+ "${file}" || return
+ done &&
+
+ find "${pkg_patchin_dir}/" -name "ltmain.sh" -a -type f -a \! -path "*/.pc/*" | while read file; do
+ ptxd_print_path "${file}"
+ #
+ # this sed turns of the relinking during "make install" (it
+ # might pick up libs from the host or break otherwise, we
+ # don't need it on linux anyway)
+ #
+ sed -i \
+ -e "s:\(need_relink\)=yes:\1=\"no\":" \
+ "${file}" || return
+ done &&
+
+ echo -e "patchin: fixup: done\n"
+}
+export -f ptxd_make_world_patchin_fixup
+
+
+#
+# FIXME
+#
+ptxd_make_world_patchin()
+{
+ ptxd_make_world_init || return
+
+ if [ -n "${pkg_deprecated_patchin_series}" ]; then
+ ptxd_bailout "a 3rd parameter to patchin ('${pkg_deprecated_patchin_series}') is obsolete, please define <PKG>_SERIES instead"
+ fi
+
+ local pkg_patchin_dir=${pkg_deprecated_patchin_dir:-${pkg_dir}}
+
+ #
+ # FIXME: do we still need this check?
+ #
+ local apply_series
+ case "${pkg_url}" in
+ file://)
+ local dir="${pkg_url#file://}"
+ if [ -d "${dir}" -a "${pkg_label}" != "kernel" ]; then
+ echo "local directory instead of tar file, skipping patch"
+ fi
+ ;;
+ *) apply_series="true" ;;
+ esac
+
+ pushd "${pkg_patchin_dir}" > /dev/null &&
+ if [ -n "${apply_series}" ]; then
+ ptxd_make_world_patchin_apply
+ fi &&
+ popd > /dev/null &&
+
+ if [ "${pkg_type}" = "target" ]; then
+ ptxd_make_world_patchin_fixup
+ fi
+}
+export -f ptxd_make_world_patchin
diff --git a/scripts/lib/ptxd_make_xpkg_common.sh b/scripts/lib/ptxd_make_xpkg_common.sh
index 2d3426593..89cde2c81 100644
--- a/scripts/lib/ptxd_make_xpkg_common.sh
+++ b/scripts/lib/ptxd_make_xpkg_common.sh
@@ -32,6 +32,8 @@ ptxd_make_xpkg_init() {
ptxd_bailout "'pkg_xpkg' or 'pkg_xpkg_type' undefined"
fi
+ ptxd_make_world_init || return
+
# license
pkg_license="${pkg_license:-unknown}"
pkg_xpkg_license="${pkg_xpkg_license:-${pkg_license}}"
@@ -39,6 +41,7 @@ ptxd_make_xpkg_init() {
# packaging stuff
pkg_xpkg_perms="${ptx_state_dir}/${pkg_xpkg}.perms"
+ pkg_xpkg_cmds="${ptx_state_dir}/${pkg_xpkg}.cmds"
pkg_xpkg_tmp="${ptx_pkg_dir}/${pkg_xpkg}.tmp"
"ptxd_make_${pkg_xpkg_type}_init"
diff --git a/scripts/lib/ptxd_make_xpkg_finish.sh b/scripts/lib/ptxd_make_xpkg_finish.sh
index 6c4790492..719b07598 100644
--- a/scripts/lib/ptxd_make_xpkg_finish.sh
+++ b/scripts/lib/ptxd_make_xpkg_finish.sh
@@ -1,7 +1,7 @@
#!/bin/bash
#
# Copyright (C) 2005, 2006, 2007 Robert Schwebel <r.schwebel@pengutronix.de>
-# 2008, 2009 by Marc Kleine-Budde <mkl@pengutronix.de>
+# 2008, 2009, 2010 by Marc Kleine-Budde <mkl@pengutronix.de>
#
# See CREDITS for details about who has contributed to this project.
#
@@ -57,16 +57,17 @@ ptxd_make_xpkg_finish() {
#
# no perm file -> no files to package -> exit
#
- if [ \! -f "${pkg_xpkg_perms}" ]; then
- ptxd_warning "Packet '${pkg_xpkg}' is empty. not generating"
- rm -rf -- "${pkg_xpkg_tmp}"
+ if [ \! -s "${pkg_xpkg_cmds}" ]; then
+ ptxd_pedantic "Packet '${pkg_xpkg}' is empty. not generating" &&
+ rm -rf -- "${pkg_xpkg_tmp}" &&
- local xpkg_map="${STATEDIR}/${pkg_xpkg}.xpkg.map"
- sed -i -e "/^${pkg_xpkg}$/d" "${xpkg_map}" #FIXME: we rely in 1-to-1 mapping here
+ #FIXME: we rely in 1-to-1 mapping here
+ sed -i -e "/^${pkg_xpkg}$/d" "${pkg_xpkg_map}" &&
- if [ \! -s "${xpkg_map}" ]; then
- rm -f -- "${xpkg_map}"
+ if [ \! -s "${pkg_xpkg_map}" ]; then
+ rm -f -- "${pkg_xpkg_map}"
fi
+
return
fi
@@ -82,20 +83,18 @@ ptxd_make_xpkg_finish() {
#
# create pkg
#
- local ret=0
+ ptxd_make_xpkg_deps &&
- ptxd_make_xpkg_deps || return
+ echo "xpkg_finish: creating ${pkg_xpkg_type} package ... " &&
+ "ptxd_make_${pkg_xpkg_type}_finish" &&
+ rm -rf "${pkg_xpkg_tmp}" || {
+ local ret=$?
+ echo "failed"
+ return ${ret}
+ }
- echo -n "xpkg_finish: creating ${pkg_xpkg_type} package ... " &&
- "ptxd_make_${pkg_xpkg_type}_finish" || ret=$?
- rm -rf "${pkg_xpkg_tmp}"
+ echo "done."
- if [ $? -ne 0 -o ${ret} -ne 0 ]; then
- echo "failed."
- return 1
- else
- echo "done."
- fi
#
# post install
diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
new file mode 100644
index 000000000..bdc100a2c
--- /dev/null
+++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
@@ -0,0 +1,539 @@
+#!/bin/bash
+#
+# Copyright (C) 2010 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+ptxd_exist() {
+ for file in "${@}"; do
+ if [ ! -e "${file}" ]; then
+ echo -e "\nError: file not found: ${file}\n"
+ return 1
+ fi
+ done
+}
+export -f ptxd_exist
+
+ptxd_install_error() {
+ echo Error: "$@"
+ exit 1
+}
+export -f ptxd_install_error
+
+ptxd_install_setup() {
+ # all dirs
+ dirs=("${ptx_nfsroot}" "${ptx_nfsroot_dbg}" "${pkg_xpkg_tmp}")
+
+ # nfs root dirs
+ # no setuid/setguid bit here
+ ndirs=("${ptx_nfsroot}" "${ptx_nfsroot_dbg}")
+
+ # package dirs
+ # this goes into the ipkg, thus full file modes here
+ pdirs=("${pkg_xpkg_tmp}")
+
+ # strip dirs
+ sdirs=("${ptx_nfsroot}" "${pkg_xpkg_tmp}")
+
+ mod_nfs="$(printf "0%o" $(( 0${mod} & ~06000 )))"
+ mod_rw="$(printf "0%o" $(( 0${mod} | 0200 )))"
+
+}
+export -f ptxd_install_setup
+
+ptxd_install_setup_src() {
+ ptxd_install_setup
+
+ if [ "${src}" = "-" -a -n "${dst}" ]; then
+ src="${pkg_pkg_dir}${dst}"
+ fi
+
+ local -a list
+
+ if [ "${cmd}" = "alternative" ]; then
+ list=( \
+ "${PTXDIST_WORKSPACE}/projectroot${PTXDIST_PLATFORMSUFFIX}${src}" \
+ "${PTXDIST_WORKSPACE}/projectroot${src}${PTXDIST_PLATFORMSUFFIX}" \
+ "${PTXDIST_WORKSPACE}/projectroot${src}" \
+ "${PTXDIST_TOPDIR}/generic${src}" \
+ "${pkg_pkg_dir}${src}" \
+ "${pkg_dir}${src}" \
+ )
+ else
+ list=( \
+ "${src}${PTXDIST_PLATFORMSUFFIX}" \
+ "${src}" \
+ )
+ fi
+
+ for src in "${list[@]}"; do
+ if [ -e "${src}" ]; then
+ return
+ fi
+ done
+
+ echo -e "\nNo suitable file '${dst}' could be found in any of these locations:"
+ local orig_IFS="${IFS}"
+ local IFS="
+"
+ echo -e "${list[*]}\n"
+ IFS="${orig_IFS}"
+
+}
+export -f ptxd_install_setup_src
+
+ptxd_install_dir() {
+ local dir="$1"
+ local usr="$2"
+ local grp="$3"
+ local mod="$4"
+ local -a dirs ndirs pdirs sdirs
+ local mod_nfs mod_rw
+
+ echo "\
+install directory:
+ dir=${dir}
+ owner=${usr}
+ group=${grp}
+ permissions=${mod}
+"
+
+ ptxd_install_setup &&
+
+ install -m "${mod_nfs}" -d "${ndirs[@]/%/${dir}}" &&
+ install -m "${mod}" -o "${usr}" -g "${grp}" -d "${pdirs[@]/%/${dir}}" &&
+
+ echo "f:${dir}:${usr}:${grp}:${mod}" >> "${pkg_xpkg_perms}"
+}
+export -f ptxd_install_dir
+
+
+#
+# $@: files to strip
+#
+# $strip: k for kernel modules
+# y for normal executables and libraries
+#
+# $ptx_use_sstrip: "y" use sstrip, 'n' use binutils strip
+#
+#
+ptxd_install_file_strip() {
+ local -a strip_cmd
+
+ case "${strip:-y}${ptx_use_sstrip:-n}" in
+ k*) strip_cmd=( "${CROSS_STRIP}" --strip-debug ) ;;
+ yn) strip_cmd=( "${CROSS_STRIP}" -R .note -R .comment ) ;;
+ yy) strip_cmd=( sstrip ) ;;
+ *) ptxd_bailout "${FUNCNAME}: invalid values for strip='${strip}' or ptx_use_sstrip='${ptx_use_sstrip}'" ;;
+ esac
+
+ #
+ # create hardlink so that inode stays the same during strip
+ # (fixes 64 bit fakeroot <-> 32 bit strip issue)
+ #
+ local tmp="strip"
+ local file
+ for file in "${@}"; do
+ ln -f "${file}" "${file}.${tmp}" || return
+ done &&
+
+ "${strip_cmd[@]}" "${@}" &&
+ rm -f "${@/%/.${tmp}}"
+}
+export -f ptxd_install_file_strip
+
+
+ptxd_install_file_impl() {
+ local src="$1"
+ local dst="$2"
+ local usr="$3"
+ local grp="$4"
+ local mod="$5"
+ local strip="$6"
+ local -a dirs ndirs pdirs sdirs
+ local mod_nfs mod_rw
+
+ ptxd_install_setup_src &&
+ echo "\
+install ${cmd}:
+ src=$(ptxd_print_path "${src}")
+ dst=${dst}
+ owner=${usr}
+ group=${grp}
+ permissions=${mod}
+"
+
+ ptxd_exist "${src}" &&
+ rm -f "${dirs[@]/%/${dst}}" &&
+
+ # check if src is a link
+ if [ -L "${src}" ]; then
+ ptxd_pedantic "file '$(ptxd_print_path "${src}")' is a link" &&
+ src="$(readlink -f "${src}")" &&
+ echo "using '$(ptxd_print_path "${src}")' instead"
+ fi &&
+
+ # just install with r/w permissions for now
+ for d in "${dirs[@]/%/${dst}}"; do
+ install -m "${mod_rw}" -D "${src}" "${d}" || return
+ done &&
+
+ if file "${src}" | egrep -q ":.*(executable|shared object|ELF.*relocatable).*stripped"; then
+ case "${strip}" in
+ 0|n|no|N|NO) ;;
+ *) ptxd_install_file_strip "${sdirs[@]/%/${dst}}" ;;
+ esac
+ fi &&
+
+ # now change to requested permissions
+ chmod "${mod_nfs}" "${ndirs[@]/%/${dst}}" &&
+ chmod "${mod}" "${pdirs[@]/%/${dst}}" &&
+
+ # now change to requested user and group
+ chown "${usr}:${grp}" "${pdirs[@]/%/${dst}}" &&
+
+ echo "f:${dst}:${usr}:${grp}:${mod}" >> "${pkg_xpkg_perms}"
+}
+export -f ptxd_install_file_impl
+
+ptxd_install_ln() {
+ local src="$1"
+ local dst="$2"
+ local usr="${3:-0}"
+ local grp="${4:-0}"
+ local -a dirs ndirs pdirs sdirs
+ local mod_nfs mod_rw
+
+ echo "\
+install link:
+ src=${src}
+ dst=${dst}
+"
+
+ ptxd_install_setup &&
+
+ case "${src}" in
+ /*) echo "Error: absolute link detected, please fix!"
+ return 1
+ ;;
+ *) ;;
+ esac &&
+
+ rm -f "${dirs[@]/%/${dst}}" &&
+ install -d "${dirs[@]/%/$(dirname "${dst}")}" &&
+ for d in "${dirs[@]/%/${dst}}"; do
+ ln -s "${src}" "${d}" || return
+ done &&
+
+ chown --no-dereference "${usr}:${grp}" "${dirs[@]/%/${dst}}"
+}
+export -f ptxd_install_ln
+
+ptxd_install_mknod() {
+ local dst="$1"
+ local usr="$2"
+ local grp="$3"
+ local mod="$4"
+ local type="$5"
+ local major="$6"
+ local minor="$7"
+ local -a dirs ndirs pdirs sdirs
+ local mod_nfs mod_rw
+
+ echo "\
+install device node:
+ owner=${usr}
+ group=${grp}
+ permissions=${mod}
+ type=${type}
+ major=${major}
+ minor=${minor}
+ name=${dst}
+"
+
+ ptxd_install_setup &&
+
+ rm -f "${pdirs[@]/%/${dst}}" &&
+ for d in "${pdirs[@]/%/${dst}}"; do
+ mknod -m "${mod}" "${d}" "${type}" "${major}" "${minor}" || return
+ done &&
+ chown "${usr}:${grp}" "${pdirs[@]/%/${dst}}" &&
+
+ echo "n:${dst}:${usr}:${grp}:${mod}:${type}:${major}:${minor}" >> "${pkg_xpkg_perms}"
+}
+export -f ptxd_install_mknod
+
+ptxd_install_alternative() {
+ local cmd="alternative"
+ local src="${1}"
+ local dst="${2}"
+ shift 2
+ ptxd_install_file_impl "${src}" "${dst:-${src}}" "${@}" ||
+ ptxd_install_error "install_alternative failed!"
+}
+export -f ptxd_install_alternative
+
+ptxd_install_file() {
+ local cmd="file"
+ ptxd_install_file_impl "$@" ||
+ ptxd_install_error "install_file failed!"
+}
+export -f ptxd_install_file
+
+ptxd_install_link() {
+ ptxd_install_ln "$@" ||
+ ptxd_install_error "install_link failed!"
+}
+export -f ptxd_install_link
+
+ptxd_install_node() {
+ ptxd_install_mknod "$@" ||
+ ptxd_install_error "install_node failed!"
+}
+export -f ptxd_install_node
+
+ptxd_install_replace() {
+ local dst="$1"
+ local placeholder="$2"
+ local value="$3"
+ local -a dirs ndirs pdirs sdirs
+ local mod_nfs mod_rw
+
+ echo "\
+"
+
+ ptxd_install_setup &&
+
+ ptxd_exist "${dirs[@]/%/${dst}}" &&
+ sed -i -e "s,${placeholder},${value},g" "${dirs[@]/%/${dst}}" ||
+
+ ptxd_install_error "install_replace failed!"
+}
+export -f ptxd_install_replace
+
+ptxd_install_generic() {
+ local file="$1"
+ local dst="$2"
+ local usr="$3"
+ local grp="$4"
+
+ local -a stat
+ stat=( $(stat -c "%u %g %a %t %T" "${file}") ) &&
+ local usr="${usr:-${stat[0]}}" &&
+ local grp="${grp:-${stat[1]}}" &&
+ local mod="${stat[2]}" &&
+ local major="${stat[3]}" &&
+ local minor="${stat[4]}" &&
+ local type="$(stat -c "%F" "${file}")" &&
+
+ case "${type}" in
+ "directory")
+ ptxd_install_dir "${dst}" "${usr}" "${grp}" "${mod}"
+ ;;
+ "character special file")
+ ptxd_install_mknod "${dst}" "${usr}" "${grp}" "${mod}" c "${major}" "${minor}"
+ ;;
+ "block special file")
+ ptxd_install_mknod "${dst}" "${usr}" "${grp}" "${mod}" b "${major}" "${minor}"
+ ;;
+ "symbolic link")
+ local src="$(readlink "${file}")" &&
+ ptxd_install_ln "${src}" "${dst}" "${usr}" "${grp}"
+ ;;
+ "regular file"|"regular empty file")
+ ptxd_install_file "${file}" "${dst}" "${usr}" "${grp}" "${mod}"
+ ;;
+ *)
+ echo "Error: File type '${type}' unkown!"
+ return 1
+ ;;
+ esac
+}
+export -f ptxd_install_generic
+
+ptxd_install_find() {
+ local dir="${1%/}"
+ local dstdir="${2%/}"
+ local usr="${3#-}"
+ local grp="${4#-}"
+
+ test -d "${dir}" &&
+
+ find "${dir}" -path "*/.svn" -prune -o -path "*/.git" -prune -o \
+ -path "*/.pc" -prune -o -path "*/CVS" -prune -o \
+ ! -path "${dir}" -print | while read file; do
+ local dst="${dstdir}${file#${dir}}"
+ ptxd_install_generic "${file}" "${dst}" "${usr}" "${grp}" || return
+ done
+}
+export -f ptxd_install_find
+
+ptxd_install_tree() {
+ ptxd_install_find "$@" ||
+ ptxd_install_error "install_tree failed!"
+}
+export -f ptxd_install_tree
+
+ptxd_install_archive() {
+ local archive="$1"
+ shift
+
+ local dir="$(mktemp -d "${PTXDIST_TEMPDIR}/install_archive.XXXXXX")" &&
+
+ ptxd_make_extract_archive "${archive}" "${dir}" &&
+ ptxd_install_find "${dir}" "$@" &&
+
+ rm -rf "${dir}" ||
+
+ ptxd_install_error "install_archive failed!"
+}
+export -f ptxd_install_archive
+
+#
+# $1: path to spec file
+#
+# From linux/Documentation/filesystems/ramfs-rootfs-initramfs.txt:
+#
+# file <name> <location> <mode> <uid> <gid> [<hard links>]
+# dir <name> <mode> <uid> <gid>
+# nod <name> <mode> <uid> <gid> <dev_type> <maj> <min>
+# slink <name> <target> <mode> <uid> <gid>
+# pipe <name> <mode> <uid> <gid>
+# sock <name> <mode> <uid> <gid>
+#
+ptxd_install_spec() {
+ local specfile="${1}"
+ local type args
+ local orig_IFS="${IFS}"
+
+ ptxd_exist "${specfile}"
+
+ while read type args; do
+ set -- ${args}
+ case "${type}" in
+ "file")
+ local name="$1"
+ local location="$2"
+ local mode="$3"
+ local uid="$4"
+ local gid="$5"
+
+ case "${location}" in
+ /*)
+ ptxd_install_file "${location}" "${name}" "${uid}" "${gid}" "${mode}"
+ ;;
+ *)
+ ptxd_install_alternative "/${location}" "${name}" "${uid}" "${gid}" "${mode}"
+ ;;
+ esac
+ ;;
+
+ "dir")
+ local name="$1"
+ local mode="$2"
+ local uid="$3"
+ local gid="$4"
+
+ ptxd_install_dir "${name}" "${uid}" "${gid}" "${mode}"
+ ;;
+
+ "nod")
+ local name="$1"
+ local mode="$2"
+ local uid="$3"
+ local gid="$4"
+ local dev_type="$5"
+ local maj="$6"
+ local min="$7"
+
+ ptxd_install_node "${name}" "${uid}" "${gid}" "${mode}" "${dev_type}" "${maj}" "${min}"
+ ;;
+
+ "slink")
+ local name="$1"
+ local target="$2"
+ local mode="$3"
+ local uid="$4"
+ local gid="$5"
+
+ ptxd_install_link "${name}" "${target}" "${uid}" "${gid}"
+ ;;
+
+ "pipe"|"sock")
+ ptxd_install_error "${type} not supported: ${type} ${args}"
+ ;;
+
+ \#*|"")
+ ;;
+ *)
+ ptxd_install_error "Unknown type ${type}"
+ ;;
+ esac
+ done < "${specfile}"
+}
+export -f ptxd_install_spec
+
+ptxd_install_package() {
+ for dir in "${pkg_pkg_dir}/"{,usr/}{bin,sbin,libexec}; do
+ find "${dir}" \( -type f -o -type l \) \
+ -executable 2>/dev/null | while read file; do
+ ptxd_install_generic - "${file#${pkg_pkg_dir}}" ||
+ ptxd_install_error "install_package failed!"
+ done
+ done
+
+ for dir in "${pkg_pkg_dir}/"{,usr/}lib; do
+ find "${dir}" \( -type f -o -type l \) \
+ -a -name "*.so*" 2>/dev/null | while read file; do
+ ptxd_install_generic - "${file#${pkg_pkg_dir}}" ||
+ ptxd_install_error "install_package failed!"
+ done
+ done
+}
+export -f ptxd_install_package
+
+ptxd_install_shared() {
+ local src="$1"
+ local dst="$2"
+ local usr="$3"
+ local grp="$4"
+ local mod="$5"
+ local filename="$(basename "${src}")"
+
+ ptxd_install_file "${src}" "${dst}/${filename}" "${usr}" "${grp}" "${mod}" &&
+
+ find "$(dirname "${src}")" -type l | while read file; do
+ if [ "$(basename "$(readlink -f "${file}")")" = "${filename}" ]; then
+ local link="${dst}/$(basename "${file}")"
+ ptxd_install_ln "${filename}" "${link}" "${usr}" "${grp}" || return
+ fi
+ done
+}
+export -f ptxd_install_shared
+
+ptxd_install_lib() {
+ local lib="$1"
+ shift
+
+ local file="$(for dir in "${pkg_pkg_dir}/"{,usr/}lib; do
+ find "${dir}" -type f -name "${lib}.so*"; done 2>/dev/null)"
+ [ -f "${file}" ] &&
+
+ local dst="$(dirname "${file#${pkg_pkg_dir}}")" &&
+ ptxd_install_shared "${file}" "${dst}" "${@}" ||
+ ptxd_install_error "ptxd_install_lib failed!"
+}
+export -f ptxd_install_lib
+
+ptxd_make_xpkg_pkg() {
+ local pkg_xpkg_tmp="$1"
+ local pkg_xpkg_cmds="$2"
+ local pkg_xpkg_perms="$3"
+
+ . "${pkg_xpkg_cmds}"
+}
+export -f ptxd_make_xpkg_pkg