2014-05-12 21:14:23 +02:00
|
|
|
# This hook creates wrappers for foo-config scripts in cross builds.
|
|
|
|
#
|
|
|
|
# Wrappers are created in ${wrksrc}/.xbps/bin and this path is appended
|
|
|
|
# to make configure scripts find them.
|
|
|
|
|
2014-05-13 10:42:47 +02:00
|
|
|
generic_wrapper() {
|
|
|
|
local wrapper="$1"
|
|
|
|
[ ! -x ${XBPS_CROSS_BASE}/usr/bin/${wrapper} ] && return 0
|
2014-12-19 10:54:48 +01:00
|
|
|
[ -x ${XBPS_WRAPPERDIR}/${wrapper} ] && return 0
|
2014-05-12 21:14:23 +02:00
|
|
|
|
2019-04-14 06:49:00 +02:00
|
|
|
cat >>${XBPS_WRAPPERDIR}/${wrapper}<<_EOF
|
|
|
|
#!/bin/sh
|
|
|
|
exec ${XBPS_CROSS_BASE}/usr/bin/${wrapper} --prefix=${XBPS_CROSS_BASE}/usr "\$@"
|
|
|
|
_EOF
|
|
|
|
|
2014-12-19 10:54:48 +01:00
|
|
|
chmod 755 ${XBPS_WRAPPERDIR}/${wrapper}
|
2014-05-13 08:27:38 +02:00
|
|
|
}
|
|
|
|
|
2014-06-05 01:10:08 +02:00
|
|
|
generic_wrapper2() {
|
2014-06-16 13:35:29 +02:00
|
|
|
local wrapper="$1"
|
2014-05-23 09:58:45 +02:00
|
|
|
|
2014-06-05 01:10:08 +02:00
|
|
|
[ ! -x ${XBPS_CROSS_BASE}/usr/bin/${wrapper} ] && return 0
|
2014-12-19 10:54:48 +01:00
|
|
|
[ -x ${XBPS_WRAPPERDIR}/${wrapper} ] && return 0
|
2014-06-05 01:10:08 +02:00
|
|
|
|
2014-12-19 10:54:48 +01:00
|
|
|
cat >>${XBPS_WRAPPERDIR}/${wrapper}<<_EOF
|
2014-05-23 09:58:45 +02:00
|
|
|
#!/bin/sh
|
|
|
|
if [ "\$1" = "--prefix" ]; then
|
|
|
|
echo "${XBPS_CROSS_BASE}/usr"
|
|
|
|
elif [ "\$1" = "--cflags" ]; then
|
2015-03-11 12:14:00 +01:00
|
|
|
${XBPS_CROSS_BASE}/usr/bin/${wrapper} --cflags | sed -e "s,-I/usr/include,-I${XBPS_CROSS_BASE}/usr/include,g"
|
2014-06-05 01:10:08 +02:00
|
|
|
elif [ "\$1" = "--libs" ]; then
|
2015-03-11 12:14:00 +01:00
|
|
|
${XBPS_CROSS_BASE}/usr/bin/${wrapper} --libs | sed -e "s,-L/usr/lib,-L${XBPS_CROSS_BASE}/usr/lib,g"
|
2014-05-23 09:58:45 +02:00
|
|
|
else
|
2014-06-05 01:10:08 +02:00
|
|
|
exec ${XBPS_CROSS_BASE}/usr/bin/${wrapper} "\$@"
|
2014-05-23 09:58:45 +02:00
|
|
|
fi
|
|
|
|
exit \$?
|
|
|
|
_EOF
|
2014-12-19 10:54:48 +01:00
|
|
|
chmod 755 ${XBPS_WRAPPERDIR}/${wrapper}
|
2014-05-23 09:58:45 +02:00
|
|
|
}
|
|
|
|
|
2014-06-25 09:29:25 +02:00
|
|
|
generic_wrapper3() {
|
|
|
|
local wrapper="$1"
|
|
|
|
[ ! -x ${XBPS_CROSS_BASE}/usr/bin/${wrapper} ] && return 0
|
2014-12-19 10:54:48 +01:00
|
|
|
[ -x ${XBPS_WRAPPERDIR}/${wrapper} ] && return 0
|
2014-06-25 09:29:25 +02:00
|
|
|
|
2014-12-19 10:54:48 +01:00
|
|
|
cp ${XBPS_CROSS_BASE}/usr/bin/${wrapper} ${XBPS_WRAPPERDIR}
|
2015-01-12 09:18:53 +01:00
|
|
|
sed -e "s,^libdir=.*,libdir=${XBPS_CROSS_BASE}/usr/lib,g" -i ${XBPS_WRAPPERDIR}/${wrapper}
|
|
|
|
sed -e "s,^prefix=.*,prefix=${XBPS_CROSS_BASE}/usr," -i ${XBPS_WRAPPERDIR}/${wrapper}
|
2014-09-28 07:47:14 +02:00
|
|
|
|
2014-12-19 10:54:48 +01:00
|
|
|
chmod 755 ${XBPS_WRAPPERDIR}/${wrapper}
|
2014-06-25 09:29:25 +02:00
|
|
|
}
|
|
|
|
|
2020-01-31 20:28:15 +01:00
|
|
|
apr_apu_wrapper() {
|
|
|
|
local wrapper="$1"
|
|
|
|
|
|
|
|
[ ! -x ${XBPS_CROSS_BASE}/usr/bin/${wrapper} ] && return 0
|
|
|
|
[ -x ${XBPS_WRAPPERDIR}/${wrapper} ] && return 0
|
|
|
|
|
|
|
|
cat >>${XBPS_WRAPPERDIR}/${wrapper}<<_EOF
|
|
|
|
#!/bin/sh
|
|
|
|
${XBPS_CROSS_BASE}/usr/bin/${wrapper} "\$@" | sed -e "s,/usr/,${XBPS_CROSS_BASE}/usr/,g"
|
|
|
|
exit \$?
|
|
|
|
_EOF
|
|
|
|
chmod 755 ${XBPS_WRAPPERDIR}/${wrapper}
|
|
|
|
}
|
|
|
|
|
2014-06-19 13:11:40 +02:00
|
|
|
python_wrapper() {
|
|
|
|
local wrapper="$1" version="$2"
|
|
|
|
|
2014-12-19 10:54:48 +01:00
|
|
|
[ -x ${XBPS_WRAPPERDIR}/${wrapper} ] && return 0
|
|
|
|
cat >>${XBPS_WRAPPERDIR}/${wrapper}<<_EOF
|
2014-06-19 13:11:40 +02:00
|
|
|
#!/bin/sh
|
2020-07-04 16:59:21 +02:00
|
|
|
case "\$1" in
|
|
|
|
--includes|--cflags)
|
|
|
|
echo "-I${XBPS_CROSS_BASE}/usr/include/python${version}" ;;
|
|
|
|
esac
|
|
|
|
exit 0
|
2014-06-19 13:11:40 +02:00
|
|
|
_EOF
|
2014-12-19 10:54:48 +01:00
|
|
|
chmod 755 ${XBPS_WRAPPERDIR}/${wrapper}
|
2014-06-19 13:11:40 +02:00
|
|
|
}
|
|
|
|
|
2014-09-25 14:37:06 +02:00
|
|
|
pkgconfig_wrapper() {
|
|
|
|
if [ ! -x /usr/bin/pkg-config ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
2014-12-19 10:54:48 +01:00
|
|
|
[ -x ${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-pkg-config ] && return 0
|
|
|
|
cat >>${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-pkg-config<<_EOF
|
2014-09-25 14:37:06 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
export PKG_CONFIG_SYSROOT_DIR="$XBPS_CROSS_BASE"
|
2016-01-21 00:07:05 +01:00
|
|
|
export PKG_CONFIG_PATH="$XBPS_CROSS_BASE/usr/lib/pkgconfig:$XBPS_CROSS_BASE/usr/share/pkgconfig\${PKG_CONFIG_PATH:+:\${PKG_CONFIG_PATH}}"
|
|
|
|
export PKG_CONFIG_LIBDIR="$XBPS_CROSS_BASE/usr/lib/pkgconfig\${PKG_CONFIG_LIBDIR:+:\${PKG_CONFIG_LIBDIR}}"
|
2014-09-25 14:37:06 +02:00
|
|
|
exec /usr/bin/pkg-config "\$@"
|
|
|
|
_EOF
|
2014-12-19 10:54:48 +01:00
|
|
|
chmod 755 ${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-pkg-config
|
2020-05-07 19:44:59 +02:00
|
|
|
if [ -z "$no_generic_pkgconfig_link" ]; then
|
|
|
|
ln -sf ${XBPS_CROSS_TRIPLET}-pkg-config ${XBPS_WRAPPERDIR}/pkg-config
|
|
|
|
fi
|
2014-09-25 14:37:06 +02:00
|
|
|
}
|
|
|
|
|
2019-02-05 19:44:21 +01:00
|
|
|
vapigen_wrapper() {
|
2020-11-24 15:06:13 +01:00
|
|
|
local _vala_version _file
|
2019-02-05 19:44:21 +01:00
|
|
|
if [ ! -x /usr/bin/vapigen ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
[ -x ${XBPS_WRAPPERDIR}/vapigen ] && return 0
|
2020-11-24 15:06:13 +01:00
|
|
|
for _file in /usr/bin/vapigen-*; do
|
|
|
|
if [ -x "${_file}" ]; then
|
|
|
|
_vala_version=${_file#*-}
|
|
|
|
fi
|
|
|
|
done
|
2019-02-05 19:44:21 +01:00
|
|
|
cat >>${XBPS_WRAPPERDIR}/vapigen<<_EOF
|
|
|
|
#!/bin/sh
|
|
|
|
exec /usr/bin/vapigen \\
|
2021-01-23 08:16:13 +01:00
|
|
|
"\$@" \\
|
2019-02-05 19:44:21 +01:00
|
|
|
--vapidir=${XBPS_CROSS_BASE}/usr/share/vala/vapi \\
|
2020-11-24 15:06:13 +01:00
|
|
|
--vapidir=${XBPS_CROSS_BASE}/usr/share/vala-${_vala_version}/vapi \\
|
2021-01-23 08:16:13 +01:00
|
|
|
--girdir=${XBPS_CROSS_BASE}/usr/share/gir-1.0
|
2019-02-05 19:44:21 +01:00
|
|
|
_EOF
|
|
|
|
chmod 755 ${XBPS_WRAPPERDIR}/vapigen
|
2020-11-24 15:06:13 +01:00
|
|
|
ln -sf vapigen ${XBPS_WRAPPERDIR}/vapigen-${_vala_version}
|
2019-02-05 19:44:21 +01:00
|
|
|
}
|
|
|
|
|
2019-02-06 22:04:36 +01:00
|
|
|
valac_wrapper() {
|
2020-11-24 15:06:13 +01:00
|
|
|
local _vala_version _file
|
2019-02-06 22:04:36 +01:00
|
|
|
if [ ! -x /usr/bin/valac ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
[ -x ${XBPS_WRAPPERDIR}/valac ] && return 0
|
2020-11-24 15:06:13 +01:00
|
|
|
for _file in /usr/bin/valac-*; do
|
|
|
|
if [ -x "${_file}" ]; then
|
|
|
|
_vala_version=${_file#*-}
|
|
|
|
fi
|
|
|
|
done
|
2019-02-06 22:04:36 +01:00
|
|
|
cat >>${XBPS_WRAPPERDIR}/valac<<_EOF
|
|
|
|
#!/bin/sh
|
|
|
|
exec /usr/bin/valac \\
|
2021-01-23 08:16:13 +01:00
|
|
|
"\$@" \\
|
2019-02-06 22:04:36 +01:00
|
|
|
--vapidir=${XBPS_CROSS_BASE}/usr/share/vala/vapi \\
|
2020-11-24 15:06:13 +01:00
|
|
|
--vapidir=${XBPS_CROSS_BASE}/usr/share/vala-${_vala_version}/vapi \\
|
2021-01-23 08:16:13 +01:00
|
|
|
--girdir=${XBPS_CROSS_BASE}/usr/share/gir-1.0
|
2019-02-06 22:04:36 +01:00
|
|
|
_EOF
|
|
|
|
chmod 755 ${XBPS_WRAPPERDIR}/valac
|
2020-11-24 15:06:13 +01:00
|
|
|
ln -sf valac ${XBPS_WRAPPERDIR}/valac-${_vala_version}
|
2019-02-06 22:04:36 +01:00
|
|
|
}
|
|
|
|
|
2015-04-21 10:29:58 +02:00
|
|
|
install_wrappers() {
|
2015-09-11 07:55:40 +02:00
|
|
|
local fname
|
|
|
|
|
2015-04-21 10:48:30 +02:00
|
|
|
for f in ${XBPS_COMMONDIR}/wrappers/*.sh; do
|
2015-09-11 07:55:40 +02:00
|
|
|
fname=${f##*/}
|
|
|
|
fname=${fname%.sh}
|
2020-03-02 00:52:34 +01:00
|
|
|
install -p -m0755 ${f} ${XBPS_WRAPPERDIR}/${fname}
|
2015-04-21 10:29:58 +02:00
|
|
|
done
|
2015-04-01 13:43:57 +02:00
|
|
|
}
|
|
|
|
|
2015-10-23 11:49:36 +02:00
|
|
|
install_cross_wrappers() {
|
2016-08-08 08:37:06 +02:00
|
|
|
local fname prefix
|
|
|
|
|
|
|
|
if [ -n "$XBPS_CCACHE" ]; then
|
|
|
|
[ -x "/usr/bin/ccache" ] && prefix="/usr/bin/ccache "
|
|
|
|
elif [ -n "$XBPS_DISTCC" ]; then
|
|
|
|
[ -x "/usr/bin/distcc" ] && prefix="/usr/bin/distcc "
|
|
|
|
fi
|
2015-10-23 11:49:36 +02:00
|
|
|
|
|
|
|
for fname in cc gcc; do
|
2016-08-08 08:37:06 +02:00
|
|
|
sed -e "s,@BIN@,${prefix}/usr/bin/$XBPS_CROSS_TRIPLET-gcc,g" \
|
2015-10-25 11:03:16 +01:00
|
|
|
${XBPS_COMMONDIR}/wrappers/cross-cc > \
|
2015-10-23 11:49:36 +02:00
|
|
|
${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-${fname}
|
|
|
|
chmod 755 ${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-${fname}
|
|
|
|
done
|
|
|
|
for fname in c++ g++; do
|
2016-08-08 08:37:06 +02:00
|
|
|
sed -e "s,@BIN@,${prefix}/usr/bin/$XBPS_CROSS_TRIPLET-g++,g" \
|
2015-10-25 11:03:16 +01:00
|
|
|
${XBPS_COMMONDIR}/wrappers/cross-cc > \
|
2015-10-23 11:49:36 +02:00
|
|
|
${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-${fname}
|
|
|
|
chmod 755 ${XBPS_WRAPPERDIR}/${XBPS_CROSS_TRIPLET}-${fname}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2021-01-01 15:27:02 +01:00
|
|
|
link_wrapper() {
|
|
|
|
local wrapper="$1"
|
|
|
|
[ ! -x "${XBPS_CROSS_BASE}/usr/bin/${wrapper}" ] && return 0
|
|
|
|
[ -L "${XBPS_WRAPPERDIR}/${wrapper}" ] && return 0
|
|
|
|
ln -sf "${XBPS_CROSS_BASE}/usr/bin/${wrapper}" "${XBPS_WRAPPERDIR}"
|
|
|
|
}
|
|
|
|
|
2014-05-12 21:14:23 +02:00
|
|
|
hook() {
|
2015-04-01 13:43:57 +02:00
|
|
|
export PATH="$XBPS_WRAPPERDIR:$PATH"
|
|
|
|
|
2015-04-21 10:29:58 +02:00
|
|
|
install_wrappers
|
2015-04-01 13:43:57 +02:00
|
|
|
|
2014-05-12 21:14:23 +02:00
|
|
|
[ -z "$CROSS_BUILD" ] && return 0
|
|
|
|
|
2015-10-23 11:49:36 +02:00
|
|
|
install_cross_wrappers
|
2014-09-25 14:37:06 +02:00
|
|
|
pkgconfig_wrapper
|
2019-02-05 19:44:21 +01:00
|
|
|
vapigen_wrapper
|
2019-02-06 22:04:36 +01:00
|
|
|
valac_wrapper
|
2021-01-01 15:27:02 +01:00
|
|
|
|
|
|
|
if [ -x /usr/bin/pkg-config ]; then
|
|
|
|
link_wrapper freetype-config
|
|
|
|
else
|
|
|
|
generic_wrapper freetype-config
|
|
|
|
fi
|
|
|
|
|
2014-05-13 10:42:47 +02:00
|
|
|
generic_wrapper icu-config
|
|
|
|
generic_wrapper libgcrypt-config
|
2014-05-13 11:14:07 +02:00
|
|
|
generic_wrapper sdl-config
|
2014-05-23 09:58:45 +02:00
|
|
|
generic_wrapper sdl2-config
|
2014-06-04 13:43:17 +02:00
|
|
|
generic_wrapper gpgme-config
|
2014-06-22 09:49:41 +02:00
|
|
|
generic_wrapper imlib2-config
|
2014-10-12 09:16:02 +02:00
|
|
|
generic_wrapper libmikmod-config
|
2015-04-13 14:14:23 +02:00
|
|
|
generic_wrapper pcre-config
|
2015-06-03 12:18:31 +02:00
|
|
|
generic_wrapper net-snmp-config
|
2017-11-11 23:05:20 +01:00
|
|
|
generic_wrapper wx-config
|
|
|
|
generic_wrapper wx-config-3.0
|
2018-09-09 08:01:33 +02:00
|
|
|
generic_wrapper wx-config-gtk3
|
2014-06-25 09:01:51 +02:00
|
|
|
generic_wrapper2 curl-config
|
2014-06-16 13:35:29 +02:00
|
|
|
generic_wrapper2 gpg-error-config
|
2015-01-18 17:05:08 +01:00
|
|
|
generic_wrapper2 libassuan-config
|
2015-03-11 12:14:00 +01:00
|
|
|
generic_wrapper2 mysql_config
|
2015-06-10 13:51:38 +02:00
|
|
|
generic_wrapper2 taglib-config
|
2015-06-24 14:08:26 +02:00
|
|
|
generic_wrapper2 nspr-config
|
2019-05-12 20:21:26 +02:00
|
|
|
generic_wrapper2 gdal-config
|
2015-02-11 15:10:17 +01:00
|
|
|
generic_wrapper3 libpng-config
|
2014-06-25 09:29:25 +02:00
|
|
|
generic_wrapper3 xmlrpc-c-config
|
2014-06-26 10:02:15 +02:00
|
|
|
generic_wrapper3 krb5-config
|
2014-07-22 08:51:27 +02:00
|
|
|
generic_wrapper3 cups-config
|
2014-07-25 19:17:26 +02:00
|
|
|
generic_wrapper3 Magick-config
|
2014-11-16 08:48:38 +01:00
|
|
|
generic_wrapper3 fltk-config
|
2014-11-19 07:31:30 +01:00
|
|
|
generic_wrapper3 xslt-config
|
|
|
|
generic_wrapper3 xml2-config
|
2015-01-12 09:18:53 +01:00
|
|
|
generic_wrapper3 fox-config
|
2015-02-22 08:39:09 +01:00
|
|
|
generic_wrapper3 xapian-config
|
2015-02-27 10:10:16 +01:00
|
|
|
generic_wrapper3 ncurses5-config
|
|
|
|
generic_wrapper3 ncursesw5-config
|
2015-03-30 08:33:00 +02:00
|
|
|
generic_wrapper3 libetpan-config
|
2016-01-26 07:46:00 +01:00
|
|
|
generic_wrapper3 giblib-config
|
2014-06-19 13:11:40 +02:00
|
|
|
python_wrapper python-config 2.7
|
2021-09-25 03:58:45 +02:00
|
|
|
python_wrapper python3-config 3.10
|
2020-01-31 20:28:15 +01:00
|
|
|
apr_apu_wrapper apr-1-config
|
|
|
|
apr_apu_wrapper apu-1-config
|
2014-05-12 21:14:23 +02:00
|
|
|
}
|