Init, adding corrade,magnum,magnum-plugins,magnum-integration,magnum-extras, and magnum-examples 2025.47_1
This commit is contained in:
7
common/build-style/R-cran.sh
Normal file
7
common/build-style/R-cran.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# This helper is for templates using R-cran.
|
||||
#
|
||||
do_install() {
|
||||
mkdir -p ${DESTDIR}/usr/lib/R/library
|
||||
( cd .. && R CMD INSTALL -l ${DESTDIR}/usr/lib/R/library ${pkgname#R-cran-} )
|
||||
}
|
||||
12
common/build-style/README
Normal file
12
common/build-style/README
Normal file
@@ -0,0 +1,12 @@
|
||||
BUILD STYLES
|
||||
============
|
||||
|
||||
These shell snippets provide support for multiple build systems, i.e GNU configure,
|
||||
CMake, etc. A build style file must provide at least the following functions:
|
||||
|
||||
- do_configure
|
||||
- do_build
|
||||
- do_install
|
||||
|
||||
If a source package defines its own do_xxx() function, the function defined in
|
||||
the build style file is simply ignored.
|
||||
66
common/build-style/cabal.sh
Normal file
66
common/build-style/cabal.sh
Normal file
@@ -0,0 +1,66 @@
|
||||
#
|
||||
# This helper is for building haskell projects using Cabal.
|
||||
#
|
||||
|
||||
do_configure() {
|
||||
: ${cabal_cmd:=cabal}
|
||||
|
||||
local _cabal_project_file="cabal.project"
|
||||
|
||||
if [ -e "${FILESDIR}/${_cabal_project_file}.freeze" ]; then
|
||||
cp "${FILESDIR}/${_cabal_project_file}.freeze" .
|
||||
fi
|
||||
|
||||
if [ -n "${cabal_index_state}" ]; then
|
||||
# index-state alone is enough to fully fix a cabal build
|
||||
configure_args+=" --index-state=${cabal_index_state}"
|
||||
elif [ -e "${_cabal_project_file}.freeze" ]; then
|
||||
# With a freeze file we have to make sure that it fixes
|
||||
# the index also
|
||||
if ! grep -q '^index-state:' "${_cabal_project_file}.freeze"; then
|
||||
msg_error "${_cabal_project_file}.freeze is missing index-state\n"
|
||||
fi
|
||||
elif [ -e "${_cabal_project_file}" ]; then
|
||||
if ! grep -q '^index-state:' "${_cabal_project_file}"; then
|
||||
msg_error "${_cabal_project_file} is missing index-state\n"
|
||||
fi
|
||||
else
|
||||
msg_error "cabal build not fixed, set cabal_index_state or add a freeze file to FILESDIR\n"
|
||||
fi
|
||||
|
||||
${cabal_cmd} update
|
||||
${cabal_cmd} configure --prefix=/usr ${configure_args}
|
||||
}
|
||||
|
||||
do_build() {
|
||||
: ${make_cmd:=cabal}
|
||||
|
||||
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
|
||||
make_build_args+=" --ghc-option=-latomic"
|
||||
fi
|
||||
|
||||
${make_cmd} build ${make_build_target} ${makejobs} ${make_build_args}
|
||||
}
|
||||
|
||||
do_check() {
|
||||
: ${make_cmd:=cabal}
|
||||
: ${make_check_target:=test}
|
||||
|
||||
${make_check_pre} ${make_cmd} ${make_check_target} ${make_check_args}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_cmd:=cabal}
|
||||
: ${make_install_target:=all}
|
||||
|
||||
if ${make_cmd} list-bin ${make_install_target} >/dev/null 2>&1; then
|
||||
vbin $(${make_cmd} list-bin ${make_install_target})
|
||||
else
|
||||
for name in $(${make_cmd} list-bin ${make_install_target} 2>&1 | tr -d '\n ' | grep -Eo "theexecutable'[^']+'" | tr "'" ' ' | awk '{ print $2 }'); do
|
||||
local _bin=$(${make_cmd} list-bin exe:$name)
|
||||
if [ -s "$_bin" ]; then
|
||||
vbin "$_bin"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
28
common/build-style/cargo.sh
Normal file
28
common/build-style/cargo.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# This helper is for building rust projects which use cargo for building
|
||||
#
|
||||
|
||||
do_build() {
|
||||
: ${make_cmd:=cargo auditable}
|
||||
|
||||
${make_cmd} build --release --locked --target ${RUST_TARGET} \
|
||||
${configure_args} ${make_build_args}
|
||||
}
|
||||
|
||||
do_check() {
|
||||
: ${make_cmd:=cargo auditable}
|
||||
|
||||
${make_check_pre} ${make_cmd} test --release --locked --target ${RUST_TARGET} \
|
||||
${configure_args} ${make_check_args}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_cmd:=cargo auditable}
|
||||
: ${make_install_args:=--path .}
|
||||
|
||||
${make_cmd} install --target ${RUST_TARGET} --root="${DESTDIR}/usr" \
|
||||
--offline --locked ${configure_args} ${make_install_args}
|
||||
|
||||
rm -f "${DESTDIR}"/usr/.crates.toml
|
||||
rm -f "${DESTDIR}"/usr/.crates2.json
|
||||
}
|
||||
140
common/build-style/cmake.sh
Normal file
140
common/build-style/cmake.sh
Normal file
@@ -0,0 +1,140 @@
|
||||
#
|
||||
# This helper is for templates using cmake.
|
||||
#
|
||||
do_configure() {
|
||||
local cmake_args=
|
||||
[ ! -d ${cmake_builddir:=build} ] && mkdir -p ${cmake_builddir}
|
||||
cd ${cmake_builddir}
|
||||
|
||||
if [ -z "$CHROOT_READY" ]; then
|
||||
cat >bootstrap.cmake <<_EOF
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
SET(CMAKE_C_COMPILER ${CC})
|
||||
SET(CMAKE_CXX_COMPILER ${CXX})
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH "${XBPS_MASTERDIR}/usr;${XBPS_MASTERDIR}")
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
_EOF
|
||||
configure_args+=" -DCMAKE_TOOLCHAIN_FILE=bootstrap.cmake"
|
||||
elif [ "$CROSS_BUILD" ]; then
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
x86_64*) _CMAKE_SYSTEM_PROCESSOR=x86_64 ;;
|
||||
i686*) _CMAKE_SYSTEM_PROCESSOR=x86 ;;
|
||||
aarch64*) _CMAKE_SYSTEM_PROCESSOR=aarch64 ;;
|
||||
arm*) _CMAKE_SYSTEM_PROCESSOR=arm ;;
|
||||
mips*) _CMAKE_SYSTEM_PROCESSOR=mips ;;
|
||||
ppc64le*) _CMAKE_SYSTEM_PROCESSOR=ppc64le ;;
|
||||
ppc64*) _CMAKE_SYSTEM_PROCESSOR=ppc64 ;;
|
||||
ppcle*) _CMAKE_SYSTEM_PROCESSOR=ppcle ;;
|
||||
ppc*) _CMAKE_SYSTEM_PROCESSOR=ppc ;;
|
||||
riscv64*) _CMAKE_SYSTEM_PROCESSOR=riscv64 ;;
|
||||
*) _CMAKE_SYSTEM_PROCESSOR=generic ;;
|
||||
esac
|
||||
cat > cross_${XBPS_CROSS_TRIPLET}.cmake <<_EOF
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
SET(CMAKE_C_COMPILER ${CC})
|
||||
SET(CMAKE_CXX_COMPILER ${CXX})
|
||||
SET(Rust_CARGO_TARGET ${XBPS_CROSS_RUST_TARGET})
|
||||
SET(CMAKE_CROSSCOMPILING TRUE)
|
||||
|
||||
SET(CMAKE_SYSTEM_PROCESSOR ${_CMAKE_SYSTEM_PROCESSOR})
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH "${XBPS_CROSS_BASE}/usr;${XBPS_CROSS_BASE}")
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
_EOF
|
||||
cmake_args+=" -DCMAKE_TOOLCHAIN_FILE=${wrksrc}/${build_wrksrc}/${cmake_builddir}/cross_${XBPS_CROSS_TRIPLET}.cmake"
|
||||
fi
|
||||
cmake_args+=" -DCMAKE_INSTALL_PREFIX:PATH=/usr"
|
||||
cmake_args+=" -DCMAKE_BUILD_TYPE=None"
|
||||
cmake_args+=" -DCMAKE_INSTALL_LIBDIR:PATH=lib${XBPS_TARGET_WORDSIZE}"
|
||||
cmake_args+=" -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc"
|
||||
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
cmake_args+=" -DQT_HOST_PATH=/usr"
|
||||
# QT_HOST_PATH isn't enough in my system,
|
||||
# which have binfmts support on and off
|
||||
cmake_args+=" -DQT_HOST_PATH_CMAKE_DIR=/usr/lib/cmake"
|
||||
cmake_args+=" -DKF6_HOST_TOOLING=/usr/lib/cmake"
|
||||
fi
|
||||
|
||||
if [[ $build_helper = *"qemu"* ]]; then
|
||||
echo "SET(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static)" \
|
||||
>> cross_${XBPS_CROSS_TRIPLET}.cmake
|
||||
fi
|
||||
|
||||
cmake_args+=" -DCMAKE_INSTALL_SBINDIR:PATH=bin"
|
||||
|
||||
export CMAKE_GENERATOR="${CMAKE_GENERATOR:-Ninja}"
|
||||
# Remove -pipe: https://gitlab.kitware.com/cmake/cmake/issues/19590
|
||||
CFLAGS="-DNDEBUG ${CFLAGS/ -pipe / }" CXXFLAGS="-DNDEBUG ${CXXFLAGS/ -pipe / }" \
|
||||
cmake ${cmake_args} ${configure_args} \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
${LIBS:+-DCMAKE_C_STANDARD_LIBRARIES="$LIBS"} \
|
||||
${LIBS:+-DCMAKE_CXX_STANDARD_LIBRARIES="$LIBS"} \
|
||||
${wrksrc}/${build_wrksrc}
|
||||
|
||||
# Replace -isystem with -I
|
||||
if [ "$CMAKE_GENERATOR" = "Unix Makefiles" ]; then
|
||||
find . -name flags.make -exec sed -i -e 's/-isystem/-I/g' "{}" +
|
||||
elif [ "$CMAKE_GENERATOR" = Ninja ]; then
|
||||
sed -i -e 's/-isystem/-I/g' build.ninja
|
||||
fi
|
||||
}
|
||||
|
||||
do_build() {
|
||||
: ${make_cmd:=ninja}
|
||||
|
||||
cd ${cmake_builddir:=build}
|
||||
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
|
||||
}
|
||||
|
||||
do_check() {
|
||||
: ${make_cmd:=ninja}
|
||||
|
||||
cd ${cmake_builddir:=build}
|
||||
|
||||
if [ -z "$make_check_target" ]; then
|
||||
case $make_cmd in
|
||||
make)
|
||||
if make -q test 2>/dev/null; then
|
||||
:
|
||||
else
|
||||
if [ $? -eq 2 ]; then
|
||||
msg_warn 'No target to "make test".\n'
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
ninja)
|
||||
if ! ninja -t query test >/dev/null 2>&1; then
|
||||
msg_warn 'No target to "ninja test".\n'
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
msg_warn "Can't run tests with '$make_cmd', define do_check.\n"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
: ${make_check_target:=test}
|
||||
|
||||
${make_check_pre} ${make_cmd} ${makejobs} ${make_check_args} ${make_check_target}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_cmd:=ninja}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
cd ${cmake_builddir:=build}
|
||||
DESTDIR=${DESTDIR} ${make_cmd} ${make_install_args} ${make_install_target}
|
||||
}
|
||||
40
common/build-style/configure.sh
Normal file
40
common/build-style/configure.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# This helper is for templates using configure scripts (not generated
|
||||
# by the GNU autotools).
|
||||
#
|
||||
do_configure() {
|
||||
: ${configure_script:=./configure}
|
||||
|
||||
${configure_script} ${configure_args}
|
||||
}
|
||||
|
||||
do_build() {
|
||||
: ${make_cmd:=make}
|
||||
|
||||
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
|
||||
}
|
||||
|
||||
do_check() {
|
||||
if [ -z "$make_cmd" ] && [ -z "$make_check_target" ]; then
|
||||
if make -q check 2>/dev/null; then
|
||||
:
|
||||
else
|
||||
if [ $? -eq 2 ]; then
|
||||
msg_warn 'No target to "make check".\n'
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
: ${make_cmd:=make}
|
||||
: ${make_check_target:=check}
|
||||
|
||||
${make_check_pre} ${make_cmd} ${makejobs} ${make_check_args} ${make_check_target}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_cmd:=make}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
|
||||
}
|
||||
12
common/build-style/fetch.sh
Normal file
12
common/build-style/fetch.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
# fetch build_style: fetches and copies files to ${wrksrc}.
|
||||
|
||||
do_extract() {
|
||||
local f curfile
|
||||
|
||||
mkdir -p "${wrksrc}"
|
||||
for f in ${distfiles}; do
|
||||
curfile="${f#*>}"
|
||||
curfile="${curfile##*/}"
|
||||
cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${curfile} "${wrksrc}/${curfile}"
|
||||
done
|
||||
}
|
||||
69
common/build-style/gem.sh
Normal file
69
common/build-style/gem.sh
Normal file
@@ -0,0 +1,69 @@
|
||||
#
|
||||
# This helper is for templates using gem files from RubyGems.
|
||||
#
|
||||
do_install() {
|
||||
: ${gem_cmd:=gem}
|
||||
: ${gemname:=${pkgname#ruby-}}
|
||||
|
||||
local _GEMDIR _INSTDIR
|
||||
|
||||
_GEMDIR=$($gem_cmd env gemdir)
|
||||
_INSTDIR=${DESTDIR}/${_GEMDIR}/gems/${gemname}-${version}
|
||||
|
||||
$gem_cmd install \
|
||||
--local \
|
||||
--install-dir ${DESTDIR}/${_GEMDIR} \
|
||||
--bindir ${DESTDIR}/usr/bin \
|
||||
--ignore-dependencies \
|
||||
--no-document \
|
||||
--verbose \
|
||||
${XBPS_SRCDISTDIR}/${pkgname}-${version}/${gemname}-${version}.gem
|
||||
|
||||
# Remove cache
|
||||
rm -rf ${DESTDIR}/${_GEMDIR}/cache
|
||||
|
||||
# Remove ext directory. they are only source code and configuration
|
||||
# The actual extensions are guarded in an arch path
|
||||
rm -rf ${_INSTDIR}/ext
|
||||
|
||||
# Remove installed tests and benchmarks
|
||||
rm -rf ${_INSTDIR}/{test,tests,autotest,benchmark,benchmarks,script,examples,demo}
|
||||
|
||||
# Remove files shipped on the root of the gem, most of the time they are useless
|
||||
find ${_INSTDIR} -maxdepth 1 -type f -delete
|
||||
|
||||
# Remove unnecessary files
|
||||
find ${DESTDIR}/${_GEMDIR}/extensions \( -name mkmf.log -o -name gem_make.out \) -delete
|
||||
|
||||
# Place manpages in usr/share/man/man[0-9]
|
||||
if [ -d ${_INSTDIR}/man ]; then
|
||||
find ${_INSTDIR}/man -type f -name '*.[0-8n]' | while read -r m; do
|
||||
vman ${m}
|
||||
done
|
||||
fi
|
||||
|
||||
rm -rf "${_INSTDIR}/man"
|
||||
|
||||
# Place executables in /usr/bin
|
||||
if [ -d "${_INSTDIR}/bin" ]; then
|
||||
for f in "${_INSTDIR}"/bin/*; do
|
||||
vbin "${f}"
|
||||
done
|
||||
fi
|
||||
|
||||
rm -rf ${_INSTDIR}/bin
|
||||
|
||||
# Place conf files in their places
|
||||
if [ -d ${_INSTDIR}/etc ]; then
|
||||
find ${_INSTDIR}/etc -type f | while read -r c; do
|
||||
vmkdir ${c%/*}/
|
||||
mv ${c} "${DESTDIR}/${c##*${_INSTDIR}/etc/}/"
|
||||
done
|
||||
fi
|
||||
|
||||
rm -rf ${_INSTDIR}/etc
|
||||
|
||||
# Ignore the ~> operator, replace it with >=
|
||||
sed 's|~>|>=|g' \
|
||||
-i ${DESTDIR}/${_GEMDIR}/specifications/${gemname}-${version}.gemspec
|
||||
}
|
||||
190
common/build-style/gemspec.sh
Normal file
190
common/build-style/gemspec.sh
Normal file
@@ -0,0 +1,190 @@
|
||||
#
|
||||
# This helper is for templates using gemspec files from upstream or Rubygems.
|
||||
#
|
||||
do_build() {
|
||||
: ${gem_cmd:=gem}
|
||||
: ${gemspec:=${pkgname#ruby-}.gemspec}
|
||||
|
||||
# Fix packages that keep Gem.gemspec as the name instead of the proper
|
||||
# $pkgname.gemspec
|
||||
if [ -f Gem.gemspec ]; then
|
||||
gemspec=Gem.gemspec
|
||||
fi
|
||||
|
||||
if [ -f .gemspec ]; then
|
||||
gemspec=.gemspec
|
||||
fi
|
||||
|
||||
# Hardcode name and version just in case they try something funny like
|
||||
# requiring RELEASE to be on the environment to not append -rc0 to version
|
||||
# Some even forget to update the version in the gemspec after releasing
|
||||
sed -ri "s|(\.name .*)=.*|\1 = \"${pkgname#ruby-}\"|g" $gemspec
|
||||
sed -ri "s|(\.version .*)=.*|\1 = \"${version}\"|g" $gemspec
|
||||
|
||||
# Replace use of `git ls-files` with find, use printf so we can print without starting
|
||||
# dot-slash path
|
||||
sed -i 's|`git ls-files`|`find . -type f -printf "%P\\n"`|g' $gemspec
|
||||
|
||||
# Sadly ruby isn't capable of handling nullbytes in a command so we have to use
|
||||
# -print0, then try using sed to remove the suffix
|
||||
# The end result is:
|
||||
# `find . -type f -print0 | sed -e "s@\\./@@g"`
|
||||
sed -i 's|`git ls-files -z`|`find . -type f -print0 \| sed -e "s@\\\\./@@g"`|g' $gemspec
|
||||
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
|
||||
local _TARGET_PLATFORM
|
||||
|
||||
_TARGET_PLATFORM="$(ruby -r \
|
||||
$(find ${XBPS_CROSS_BASE}/usr/lib/ruby -iname rbconfig.rb) \
|
||||
-e 'puts RbConfig::CONFIG["arch"]' 2>/dev/null)"
|
||||
|
||||
# Patch all instances of extconf that use create_makefile
|
||||
for f in $(find . -type f -name 'extconf.rb'); do
|
||||
if [ ! -f ${f}.orig ]; then
|
||||
# Create a .extconf file that forces the Makefile to use our environment
|
||||
# this allows us to cross-compile like it is done with meson cross-files
|
||||
cat<<EOF>append
|
||||
\$CPPFLAGS = ENV['CPPFLAGS'] if ENV['CPPFLAGS']
|
||||
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
||||
RbConfig::MAKEFILE_CONFIG['CXX'] = ENV['CXX'] if ENV['CXX']
|
||||
RbConfig::MAKEFILE_CONFIG['LD'] = ENV['LD'] if ENV['LD']
|
||||
RbConfig::MAKEFILE_CONFIG['CFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS']
|
||||
RbConfig::MAKEFILE_CONFIG['CPPFLAGS'] = ENV['CPPFLAGS'] if ENV['CPPFLAGS']
|
||||
RbConfig::MAKEFILE_CONFIG['CXXFLAGS'] = ENV['CXXFLAGS'] if ENV['CXXFLAGS']
|
||||
EOF
|
||||
cat $f > append2
|
||||
# Use sed and enable verbose mode
|
||||
cat<<EOF>>append2
|
||||
system("sed -i 's|^V =.*|V = 1|' Makefile")
|
||||
system("sed -i 's|^CFLAGS.*|CFLAGS = \$(CCDLFLAGS) ${VOID_TARGET_CFLAGS} \$(ARCH_FLAG)|' Makefile")
|
||||
system("sed -i 's|^topdir.*|topdir = ${XBPS_CROSS_BASE}/usr/include/ruby-\$(ruby_version)|' Makefile")
|
||||
system("sed -i 's|^hdrdir.*|hdrdir = ${XBPS_CROSS_BASE}/usr/include/ruby-\$(ruby_version)|' Makefile")
|
||||
system("sed -i 's|^arch_hdrdir.*|arch_hdrdir = ${XBPS_CROSS_BASE}/usr/include/ruby-\$(ruby_version)/\$(arch)|' Makefile")
|
||||
system("sed -i 's|^arch =.*|arch = ${_TARGET_PLATFORM}|' Makefile")
|
||||
system("sed -i 's|^dldflags =.*|dldflags = ${LDFLAGS}|' Makefile")
|
||||
EOF
|
||||
|
||||
# Create a backup which we will restore later
|
||||
cp $f ${f}.orig
|
||||
|
||||
# Patch extconf.rb for cross compile
|
||||
cat append append2 > $f
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# If we are downloading a gem file then create a spec out of it
|
||||
for f in $distfiles; do
|
||||
if [ "${f##*.}" = "gem" ]; then
|
||||
$gem_cmd spec \
|
||||
"${XBPS_SRCDISTDIR}/${pkgname}-${version}/${f##*/}" \
|
||||
--ruby > $gemspec
|
||||
fi
|
||||
done
|
||||
|
||||
sed 's|~>|>=|g' -i $gemspec
|
||||
|
||||
$gem_cmd build --verbose ${gemspec}
|
||||
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
# Restore previous extconf.rb which we ship.
|
||||
find . -type f -name 'extconf.rb.orig' | while read -r f; do
|
||||
mv $f ${f%.*}
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${gem_cmd:=gem}
|
||||
|
||||
local _GEMDIR _INSTDIR
|
||||
|
||||
_GEMDIR=$($gem_cmd env gemdir)
|
||||
_INSTDIR=${DESTDIR}/${_GEMDIR}/gems/${pkgname#ruby-}-${version}
|
||||
|
||||
# Ruby is very eager to add CFLAGS everywhere there is a compilation
|
||||
# but we do both cross compilation of the modules and host compilation
|
||||
# for checks, so unset CFLAGS and keep it in a separate value.
|
||||
# We will manually pass CFLAGS as VOID_TAGET_CFLAGS to cross-compilation
|
||||
# And ruby will use rbconfig.rb to get the proper CFLAGS for host compilation
|
||||
VOID_TARGET_CFLAGS="$CFLAGS"
|
||||
export VOID_TARGET_CFLAGS
|
||||
unset CFLAGS
|
||||
|
||||
$gem_cmd install \
|
||||
--local \
|
||||
--install-dir ${DESTDIR}/${_GEMDIR} \
|
||||
--bindir ${DESTDIR}/usr/bin \
|
||||
--ignore-dependencies \
|
||||
--no-document \
|
||||
--verbose \
|
||||
"${pkgname#ruby-}-${version}.gem" \
|
||||
-- $configure_args
|
||||
|
||||
# Remove cache
|
||||
rm -rf ${DESTDIR}/${_GEMDIR}/cache
|
||||
|
||||
# Remove ext directory, they are only source code and configuration
|
||||
# The actual extensions are in a arch path guarded
|
||||
rm -rf ${_INSTDIR}/ext
|
||||
|
||||
# Remove duplicated library that is available in a arch guarded
|
||||
# extension
|
||||
rm -rf ${_INSTDIR}/lib/*.so
|
||||
|
||||
# Remove installed tests and benchmarks
|
||||
rm -rf ${_INSTDIR}/{test,tests,autotest,benchmark,benchmarks,script,examples,demo}
|
||||
|
||||
# Remove files shipped on the root of the gem, most of the time they are useless
|
||||
find ${_INSTDIR} -maxdepth 1 -type f -delete
|
||||
|
||||
# Remove unnecessary files
|
||||
find ${DESTDIR}/${_GEMDIR}/extensions \( -name mkmf.log -o -name gem_make.out \) -delete
|
||||
|
||||
# Place manpages in usr/share/man/man[0-9]
|
||||
if [ -d ${_INSTDIR}/man ]; then
|
||||
find ${_INSTDIR}/man -type f -name '*.[0-8n]' | while read -r m; do
|
||||
vman ${m}
|
||||
done
|
||||
fi
|
||||
|
||||
rm -rf "${_INSTDIR}/man"
|
||||
|
||||
# Place executables in /usr/bin
|
||||
if [ -d "${_INSTDIR}/bin" ]; then
|
||||
for f in "${_INSTDIR}"/bin/*; do
|
||||
vbin "${f}"
|
||||
done
|
||||
fi
|
||||
|
||||
rm -rf ${_INSTDIR}/bin
|
||||
|
||||
# Place conf files in their places
|
||||
if [ -d ${_INSTDIR}/etc ]; then
|
||||
find ${_INSTDIR}/etc -type f | while read -r c; do
|
||||
vmkdir ${c%/*}/
|
||||
mv ${c} "${DESTDIR}/${c##*${_INSTDIR}/etc/}/"
|
||||
done
|
||||
fi
|
||||
|
||||
rm -rf ${_INSTDIR}/etc
|
||||
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
|
||||
local _TARGET_PLATFORM _TARGET_EXT_DIR
|
||||
|
||||
# Get arch of the target and host platform by reading the rbconfig.rb
|
||||
# of the cross ruby
|
||||
_TARGET_PLATFORM="$(ruby -r \
|
||||
$(find ${XBPS_CROSS_BASE}/usr/lib/ruby -iname rbconfig.rb) \
|
||||
-e 'puts RbConfig::CONFIG["arch"]' 2>/dev/null)"
|
||||
|
||||
# Path to the extensions on a package, ruby installs against the platform
|
||||
# of the host, so we have to move them to the correct place
|
||||
_TARGET_EXT_DIR="${DESTDIR}/${_GEMDIR}/extensions/${_TARGET_PLATFORM}"
|
||||
|
||||
find ${DESTDIR}/${_GEMDIR}/extensions -maxdepth 1 -type d \
|
||||
-exec mv '{}' ${_TARGET_EXT_DIR} \;
|
||||
fi
|
||||
}
|
||||
41
common/build-style/gnu-configure.sh
Normal file
41
common/build-style/gnu-configure.sh
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# This helper is for templates using GNU configure scripts.
|
||||
#
|
||||
do_configure() {
|
||||
: ${configure_script:=./configure}
|
||||
|
||||
export lt_cv_sys_lib_dlsearch_path_spec="/usr/lib64 /usr/lib32 /usr/lib /lib /usr/local/lib"
|
||||
${configure_script} ${configure_args}
|
||||
}
|
||||
|
||||
do_build() {
|
||||
: ${make_cmd:=make}
|
||||
|
||||
export lt_cv_sys_lib_dlsearch_path_spec="/usr/lib64 /usr/lib32 /usr/lib /lib /usr/local/lib"
|
||||
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
|
||||
}
|
||||
|
||||
do_check() {
|
||||
if [ -z "$make_cmd" ] && [ -z "$make_check_target" ]; then
|
||||
if make -q check 2>/dev/null; then
|
||||
:
|
||||
else
|
||||
if [ $? -eq 2 ]; then
|
||||
msg_warn 'No target to "make check".\n'
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
: ${make_cmd:=make}
|
||||
: ${make_check_target:=check}
|
||||
|
||||
${make_check_pre} ${make_cmd} ${makejobs} ${make_check_args} ${make_check_target}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_cmd:=make}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
|
||||
}
|
||||
43
common/build-style/gnu-makefile.sh
Normal file
43
common/build-style/gnu-makefile.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# This helper is for templates using GNU Makefiles.
|
||||
#
|
||||
do_build() {
|
||||
: ${make_cmd:=make}
|
||||
|
||||
if [ -z "$make_use_env" ]; then
|
||||
${make_cmd} \
|
||||
CC="$CC" CXX="$CXX" LD="$LD" AR="$AR" RANLIB="$RANLIB" \
|
||||
CPP="$CPP" AS="$AS" OBJCOPY="$OBJCOPY" OBJDUMP="$OBJDUMP" \
|
||||
CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \
|
||||
PREFIX=/usr prefix=/usr \
|
||||
${makejobs} ${make_build_args} ${make_build_target}
|
||||
else
|
||||
export PREFIX=/usr prefix=/usr
|
||||
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
|
||||
fi
|
||||
}
|
||||
|
||||
do_check() {
|
||||
if [ -z "$make_cmd" ] && [ -z "$make_check_target" ]; then
|
||||
if make -q check 2>/dev/null; then
|
||||
:
|
||||
else
|
||||
if [ $? -eq 2 ]; then
|
||||
msg_warn 'No target to "make check".\n'
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
: ${make_cmd:=make}
|
||||
: ${make_check_target:=check}
|
||||
|
||||
${make_check_pre} ${make_cmd} ${makejobs} ${make_check_args} ${make_check_target}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_cmd:=make}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
${make_cmd} STRIP=true PREFIX=/usr prefix=/usr DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
|
||||
}
|
||||
75
common/build-style/go.sh
Normal file
75
common/build-style/go.sh
Normal file
@@ -0,0 +1,75 @@
|
||||
#
|
||||
# This helper is for templates for Go packages.
|
||||
#
|
||||
|
||||
do_configure() {
|
||||
# $go_import_path must be set, or we can't link $PWD into $GOSRCPATH
|
||||
# nor build from modules
|
||||
if [ -z "$go_import_path" ]; then
|
||||
msg_error "\"\$go_import_path\" not set on $pkgname template.\n"
|
||||
fi
|
||||
|
||||
# This isn't really configuration, but its needed by packages
|
||||
# that do unusual things with the build where the expect to be
|
||||
# able to cd into the $GOSRCPATH
|
||||
if [ "${go_mod_mode}" != "off" ] && [ -f go.mod ]; then
|
||||
# Skip GOPATH symlink for Go modules
|
||||
msg_normal "Building $pkgname using Go modules.\n"
|
||||
else
|
||||
mkdir -p ${GOSRCPATH%/*}/
|
||||
ln -fs "$PWD" "${GOSRCPATH}"
|
||||
fi
|
||||
}
|
||||
|
||||
do_build() {
|
||||
# remove -s and -w from go_ldflags, we should let xbps-src strip binaries itself
|
||||
for wd in $go_ldflags; do
|
||||
if [ "$wd" == "-s" ] || [ "$wd" == "-w" ]; then
|
||||
msg_error "$pkgname: remove -s and -w from go_ldflags\n"
|
||||
fi
|
||||
done
|
||||
|
||||
: ${go_package:=$go_import_path}
|
||||
# Build using Go modules if there's a go.mod file
|
||||
if [ "${go_mod_mode}" != "off" ] && [ -f go.mod ]; then
|
||||
|
||||
if [[ -n "${_go_mod_path}" ]]; then
|
||||
pushd $(dirname ${_go_mod_path})
|
||||
fi
|
||||
|
||||
# Check if go_import_path matches module
|
||||
if [ "module $go_import_path" != "$(grep '^module' go.mod | head -n1)" ]; then
|
||||
msg_error "\"\$go_import_path\" doesn't match the one defined in go.mod!\n"
|
||||
fi
|
||||
|
||||
if [ -z "${go_mod_mode}" ] && [ -d vendor ]; then
|
||||
msg_normal "Using vendor dir for $pkgname Go dependencies.\n"
|
||||
go_mod_mode=vendor
|
||||
elif [ "${go_mod_mode}" = "default" ]; then
|
||||
# Allow templates to explicitly opt into the go tool's
|
||||
# default behavior.
|
||||
go_mod_mode=
|
||||
fi
|
||||
go install -p "$XBPS_MAKEJOBS" -mod="${go_mod_mode}" -modcacherw -v -tags "${go_build_tags}" -ldflags "${go_ldflags}" ${go_package}
|
||||
if [[ -n "${_go_mod_path}" ]]; then
|
||||
popd
|
||||
fi
|
||||
else
|
||||
# Otherwise, build using GOPATH
|
||||
go install -p "$XBPS_MAKEJOBS" -v -tags "${go_build_tags}" -ldflags "${go_ldflags}" ${go_package}
|
||||
fi
|
||||
}
|
||||
|
||||
do_check() {
|
||||
: ${make_check_target:=./...}
|
||||
|
||||
${make_check_pre} go test -p "$XBPS_MAKEJOBS" -tags "${go_build_tags}" -ldflags "${go_ldflags}" ${make_check_args} ${make_check_target}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
for f in ${GOPATH}/bin/* ${GOPATH}/bin/**/*; do
|
||||
if [ -f "$f" ] && [ -x "$f" ]; then
|
||||
vbin "$f"
|
||||
fi
|
||||
done
|
||||
}
|
||||
37
common/build-style/haskell-stack.sh
Normal file
37
common/build-style/haskell-stack.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# This helper is for templates built using Haskell stack.
|
||||
#
|
||||
# make_build_args="stack-build-flags"
|
||||
# stackage="lts-X.Y" # or include a stack.yaml in $FILESDIR
|
||||
#
|
||||
do_build() {
|
||||
# use --skip-ghc-check to really force stack to use the ghc in the system
|
||||
# --system-ghc still downloads if stackage ghc version does not match ours
|
||||
# this fails on all platforms other than x86_64 glibc when we bump ghc
|
||||
local _stack_args="--system-ghc --skip-ghc-check"
|
||||
|
||||
if [ -f "${FILESDIR}/stack.yaml" ]; then
|
||||
msg_normal "Using stack config in stack.yaml.\n"
|
||||
cp "${FILESDIR}/stack.yaml" .
|
||||
elif [ -z "$stackage" -a -f "stack.yaml" ]; then
|
||||
msg_normal "Using stack.yaml from downloaded source.\n"
|
||||
else
|
||||
if [ -z "$stackage" ]; then
|
||||
msg_error "Stackage version not set in \$stackage.\n"
|
||||
fi
|
||||
msg_normal "Using stackage resolver ${stackage}.\n"
|
||||
STACK_ROOT="$wrksrc/.stack" \
|
||||
stack init ${_stack_args} --force --resolver ${stackage}
|
||||
fi
|
||||
|
||||
STACK_ROOT="$wrksrc/.stack" stack ${_stack_args} ${makejobs} build \
|
||||
${make_build_args}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
local _stack_args="--system-ghc --skip-ghc-check"
|
||||
|
||||
vmkdir usr/bin
|
||||
STACK_ROOT="$wrksrc/.stack" stack ${_stack_args} install \
|
||||
${make_build_args} --local-bin-path=${DESTDIR}/usr/bin
|
||||
}
|
||||
68
common/build-style/meson.sh
Normal file
68
common/build-style/meson.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
#
|
||||
# This helper is for templates using meson.
|
||||
#
|
||||
|
||||
do_configure() {
|
||||
: ${meson_cmd:=meson}
|
||||
: ${meson_builddir:=build}
|
||||
: ${meson_crossfile:="${XBPS_WRAPPERDIR}/meson/xbps_meson.cross"}
|
||||
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
configure_args+=" --cross-file=${meson_crossfile}"
|
||||
fi
|
||||
|
||||
# binutils ar needs a plugin when LTO is used on static libraries, so we
|
||||
# have to use the gcc-ar wrapper that calls the correct plugin.
|
||||
# As seen in https://github.com/mesonbuild/meson/issues/1646 (and its
|
||||
# solution, https://github.com/mesonbuild/meson/pull/1649), meson fixed
|
||||
# issues with static libraries + LTO by defaulting to gcc-ar themselves.
|
||||
# We also force gcc-ar usage in the crossfile above.
|
||||
export AR="gcc-ar"
|
||||
|
||||
# unbuffered output for continuous logging
|
||||
${meson_cmd} setup \
|
||||
--prefix=/usr \
|
||||
--libdir=/usr/lib${XBPS_TARGET_WORDSIZE} \
|
||||
--libexecdir=/usr/libexec \
|
||||
--bindir=/usr/bin \
|
||||
--sbindir=/usr/bin \
|
||||
--includedir=/usr/include \
|
||||
--datadir=/usr/share \
|
||||
--mandir=/usr/share/man \
|
||||
--infodir=/usr/share/info \
|
||||
--localedir=/usr/share/locale \
|
||||
--sysconfdir=/etc \
|
||||
--localstatedir=/var \
|
||||
--sharedstatedir=/var/lib \
|
||||
--buildtype=plain \
|
||||
--auto-features=auto \
|
||||
--wrap-mode=nodownload \
|
||||
-Db_lto=true -Db_ndebug=true \
|
||||
-Db_staticpic=true \
|
||||
-Dpkgconfig.relocatable=false \
|
||||
${configure_args} . ${meson_builddir}
|
||||
}
|
||||
|
||||
do_build() {
|
||||
: ${make_cmd:=ninja}
|
||||
: ${make_build_target:=all}
|
||||
: ${meson_builddir:=build}
|
||||
|
||||
${make_cmd} -C ${meson_builddir} ${makejobs} ${make_build_args} ${make_build_target}
|
||||
}
|
||||
|
||||
do_check() {
|
||||
: ${make_cmd:=meson}
|
||||
: ${make_check_target:=test}
|
||||
: ${meson_builddir:=build}
|
||||
|
||||
${make_check_pre} ${make_cmd} ${make_check_target} -C ${meson_builddir} ${makejobs} ${make_check_args}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_cmd:=ninja}
|
||||
: ${make_install_target:=install}
|
||||
: ${meson_builddir:=build}
|
||||
|
||||
DESTDIR=${DESTDIR} ${make_cmd} -C ${meson_builddir} ${make_install_args} ${make_install_target}
|
||||
}
|
||||
52
common/build-style/perl-ModuleBuild.sh
Normal file
52
common/build-style/perl-ModuleBuild.sh
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# This helper does the required steps to be able to build and install
|
||||
# perl modules with the Module::Build method into the correct location.
|
||||
#
|
||||
# Required vars to be set by a template:
|
||||
#
|
||||
# build_style=perl-ModuleBuild
|
||||
#
|
||||
do_configure() {
|
||||
if [ -f Build.PL ]; then
|
||||
# When cross compiling Module::Build reads in the build flags from the host perl, not the target:
|
||||
# extract the target specific flags (the ones also set in perl’s template) from
|
||||
# the target perl configuration and use them to override Module::Build’s default
|
||||
_conf="${XBPS_CROSS_BASE}/usr/lib/perl5/core_perl/Config_heavy.pl"
|
||||
_optimize=$(sed -n "s;^optimize='\(.*\)';\1;p" $_conf)
|
||||
_ccflags=$(sed -n "s;^ccflags='\(.*\)';\1;p" $_conf)
|
||||
_lddlflags=$(sed -n "s;^lddlflags='\(.*\)';\1;p" $_conf)
|
||||
_ldflags=$(sed -n "s;^ldflags='\(.*\)';\1;p" $_conf)
|
||||
_archlibexp=$(sed -n "s;^archlibexp='\(.*\)';\1;p" $_conf)
|
||||
|
||||
PERL_MM_USE_DEFAULT=1 PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$DESTDIR'" \
|
||||
PERL_MB_OPT="--installdirs vendor --destdir '$DESTDIR'" \
|
||||
LD="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
|
||||
perl Build.PL --config optimize="$_optimize" --config ccflags="$_ccflags" \
|
||||
--config lddlflags="$_lddlflags" --config ldflags="$_ldflags" \
|
||||
--config archlibexp="${XBPS_CROSS_BASE}${_archlibexp}" \
|
||||
${configure_args} INSTALLDIRS=vendor
|
||||
else
|
||||
msg_error "$pkgver: cannot find Build.PL for perl module!\n"
|
||||
fi
|
||||
}
|
||||
|
||||
do_build() {
|
||||
if [ ! -x ./Build ]; then
|
||||
msg_error "$pkgver: cannot find ./Build script!\n"
|
||||
fi
|
||||
LD="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ./Build ${make_build_args}
|
||||
}
|
||||
|
||||
do_check() {
|
||||
if [ ! -x ./Build ]; then
|
||||
msg_error "$pkgver: cannot find ./Build script!\n"
|
||||
fi
|
||||
${make_check_pre} ./Build test
|
||||
}
|
||||
|
||||
do_install() {
|
||||
if [ ! -x ./Build ]; then
|
||||
msg_error "$pkgver: cannot find ./Build script!\n"
|
||||
fi
|
||||
./Build ${make_install_args} install
|
||||
}
|
||||
90
common/build-style/perl-module.sh
Normal file
90
common/build-style/perl-module.sh
Normal file
@@ -0,0 +1,90 @@
|
||||
#
|
||||
# This helper does the required steps to be able to build and install
|
||||
# perl modules that use MakeMaker into the correct location.
|
||||
#
|
||||
# Required vars to be set by a template:
|
||||
#
|
||||
# build_style=perl-module
|
||||
#
|
||||
# Optionally if the module needs more directories to be configured other
|
||||
# than $XBPS_BUILDDIR/$wrksrc/$build_wrksrc, one can use (relative to
|
||||
# $wrksrc/$build_wrksrc):
|
||||
#
|
||||
# perl_configure_dirs="blob/bob foo/blah"
|
||||
#
|
||||
do_configure() {
|
||||
local perlmkf
|
||||
|
||||
local perlprefix=${XBPS_STATEDIR}/perlprefix-${XBPS_TARGET_MACHINE}
|
||||
mkdir -p $perlprefix
|
||||
if [ -d "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl" ]; then
|
||||
cp "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl/Config"*.p? $perlprefix
|
||||
cp "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl/Errno.pm" $perlprefix
|
||||
sed -i -e "s;archlibexp => '\(.*\)';archlibexp => '${XBPS_CROSS_BASE}\1';" \
|
||||
${perlprefix}/Config.pm
|
||||
sed -i -e "s;^archlibexp='\(.*\)';archlibexp='${XBPS_CROSS_BASE}\1';" \
|
||||
${perlprefix}/Config_heavy.pl
|
||||
else
|
||||
cp "/usr/lib/perl5/core_perl/Config"*.p? $perlprefix
|
||||
cp "/usr/lib/perl5/core_perl/Errno.pm" $perlprefix
|
||||
fi
|
||||
export PERL5LIB=$perlprefix
|
||||
|
||||
if [ -f "${wrksrc}/${build_wrksrc:+$build_wrksrc/}Makefile.PL" ]; then
|
||||
sed -i "s,/usr/include,${XBPS_CROSS_BASE}/usr/include,g" \
|
||||
"${wrksrc}/${build_wrksrc:+$build_wrksrc/}Makefile.PL"
|
||||
fi
|
||||
|
||||
if [ -z "$perl_configure_dirs" ]; then
|
||||
perlmkf="$wrksrc/${build_wrksrc:+$build_wrksrc/}Makefile.PL"
|
||||
if [ ! -f "$perlmkf" ]; then
|
||||
msg_error "*** ERROR couldn't find $perlmkf, aborting ***\n"
|
||||
fi
|
||||
|
||||
cd "$wrksrc/${build_wrksrc:+$build_wrksrc}"
|
||||
PERL_MM_USE_DEFAULT=1 GCC="$CC" CC="$CC" LD="$CC" \
|
||||
OPTIMIZE="$CFLAGS" \
|
||||
CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \
|
||||
LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
||||
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib" \
|
||||
perl -I. Makefile.PL ${configure_args} INSTALLDIRS=vendor
|
||||
fi
|
||||
|
||||
for i in ${perl_configure_dirs}; do
|
||||
perlmkf="$wrksrc/${build_wrksrc:+$build_wrksrc/}$i/Makefile.PL"
|
||||
if [ -f "$perlmkf" ]; then
|
||||
cd "$wrksrc/${build_wrksrc:+$build_wrksrc/}$i"
|
||||
PERL_MM_USE_DEFAULT=1 GCC="$CC" CC="$CC" LD="$CC" \
|
||||
OPTIMIZE="$CFLAGS" \
|
||||
CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \
|
||||
LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
||||
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
||||
perl -I. Makefile.PL ${make_build_args} INSTALLDIRS=vendor
|
||||
else
|
||||
msg_error "*** ERROR: couldn't find $perlmkf, aborting **\n"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
do_build() {
|
||||
: ${make_cmd:=make}
|
||||
|
||||
${make_cmd} CC="$CC" LD="$CC" CFLAGS="$CFLAGS" OPTIMIZE="$CFLAGS" \
|
||||
LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
||||
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
||||
${makejobs} ${make_build_args} ${make_build_target}
|
||||
}
|
||||
|
||||
do_check() {
|
||||
: ${make_cmd:=make}
|
||||
: ${make_check_target:=test}
|
||||
|
||||
${make_check_pre} ${make_cmd} ${makejobs} ${make_check_args} ${make_check_target}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_cmd:=make}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
|
||||
}
|
||||
34
common/build-style/python2-module.sh
Normal file
34
common/build-style/python2-module.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# This helper is for templates installing python2-only modules.
|
||||
#
|
||||
|
||||
do_build() {
|
||||
if [ -n "$CROSS_BUILD" ]; then
|
||||
PYPREFIX="$XBPS_CROSS_BASE"
|
||||
CFLAGS+=" -I${XBPS_CROSS_BASE}/${py2_inc} -I${XBPS_CROSS_BASE}/usr/include"
|
||||
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py2_lib} -L${XBPS_CROSS_BASE}/usr/lib"
|
||||
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
|
||||
LDSHARED="${CC} -shared $LDFLAGS"
|
||||
env CC="$CC" LDSHARED="$LDSHARED" \
|
||||
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
|
||||
LDFLAGS="$LDFLAGS" python2 setup.py build ${make_build_args}
|
||||
else
|
||||
python2 setup.py build ${make_build_args}
|
||||
fi
|
||||
}
|
||||
|
||||
do_install() {
|
||||
if [ -n "$CROSS_BUILD" ]; then
|
||||
PYPREFIX="$XBPS_CROSS_BASE"
|
||||
CFLAGS+=" -I${XBPS_CROSS_BASE}/${py2_inc} -I${XBPS_CROSS_BASE}/usr/include"
|
||||
LDFLAGS+=" -L${XBPS_CROSS_BASE}/${py2_lib} -L${XBPS_CROSS_BASE}/usr/lib"
|
||||
CC="${XBPS_CROSS_TRIPLET}-gcc -pthread $CFLAGS $LDFLAGS"
|
||||
LDSHARED="${CC} -shared $LDFLAGS"
|
||||
env CC="$CC" LDSHARED="$LDSHARED" \
|
||||
PYPREFIX="$PYPREFIX" CFLAGS="$CFLAGS" \
|
||||
LDFLAGS="$LDFLAGS" python2 setup.py \
|
||||
install --prefix=/usr --root=${DESTDIR} ${make_install_args}
|
||||
else
|
||||
python2 setup.py install --prefix=/usr --root=${DESTDIR} ${make_install_args}
|
||||
fi
|
||||
}
|
||||
34
common/build-style/python3-module.sh
Normal file
34
common/build-style/python3-module.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# This helper is for templates installing python3-only modules.
|
||||
#
|
||||
|
||||
do_build() {
|
||||
python3 setup.py build ${make_build_args}
|
||||
}
|
||||
|
||||
do_check() {
|
||||
local testjobs
|
||||
if python3 -c 'import pytest' >/dev/null 2>&1; then
|
||||
if python3 -c 'import xdist' >/dev/null 2>&1; then
|
||||
testjobs="-n $XBPS_MAKEJOBS"
|
||||
fi
|
||||
PYTHONPATH="$(cd build/lib* && pwd)" PY_IGNORE_IMPORTMISMATCH=1 \
|
||||
${make_check_pre} \
|
||||
python3 -m pytest ${testjobs} ${make_check_args} ${make_check_target}
|
||||
else
|
||||
# Fall back to deprecated setup.py test orchestration without pytest
|
||||
if [ -z "$make_check_target" ]; then
|
||||
if ! python3 setup.py --help test >/dev/null 2>&1; then
|
||||
msg_warn "No command 'test' defined by setup.py.\n"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
: ${make_check_target:=test}
|
||||
${make_check_pre} python3 setup.py ${make_check_target} ${make_check_args}
|
||||
fi
|
||||
}
|
||||
|
||||
do_install() {
|
||||
python3 setup.py install --prefix=/usr --root=${DESTDIR} ${make_install_args}
|
||||
}
|
||||
46
common/build-style/python3-pep517.sh
Normal file
46
common/build-style/python3-pep517.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# This style is for templates installing python3 modules adhering to PEP517
|
||||
#
|
||||
|
||||
do_build() {
|
||||
: ${make_build_target:=.}
|
||||
|
||||
if [ "${CROSS_BUILD}" ] && [[ "${build_helper}" = *meson* ]]; then
|
||||
local mcross="-Csetup-args=--cross-file=${XBPS_WRAPPERDIR}/meson"
|
||||
make_build_args+=" ${mcross}/xbps_meson.cross"
|
||||
|
||||
if [[ "${build_helper}" = *numpy* ]]; then
|
||||
make_build_args+=" ${mcross}/xbps_numpy.cross"
|
||||
fi
|
||||
fi
|
||||
|
||||
python3 -m build --no-isolation --wheel \
|
||||
${make_build_args} ${make_build_target}
|
||||
}
|
||||
|
||||
do_check() {
|
||||
if ! python3 -c 'import pytest' >/dev/null 2>&1; then
|
||||
msg_warn "Testing of python3-pep517 templates requires pytest\n"
|
||||
return 0
|
||||
fi
|
||||
|
||||
local testjobs
|
||||
if python3 -c 'import xdist' >/dev/null 2>&1; then
|
||||
testjobs="-n $XBPS_MAKEJOBS"
|
||||
fi
|
||||
|
||||
local testdir="${wrksrc}/.xbps-testdir/$(date +%s)"
|
||||
python3 -m installer --destdir "${testdir}" \
|
||||
${make_install_args} ${make_install_target:-dist/*.whl}
|
||||
|
||||
PATH="${testdir}/usr/bin:${PATH}" PYTHONPATH="${testdir}/${py3_sitelib}" PY_IGNORE_IMPORTMISMATCH=1 \
|
||||
${make_check_pre} pytest3 ${testjobs} ${make_check_args} ${make_check_target}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_install_args:=--no-compile-bytecode}
|
||||
: ${make_install_target:="dist/*.whl"}
|
||||
|
||||
python3 -m installer --destdir ${DESTDIR} \
|
||||
${make_install_args} ${make_install_target}
|
||||
}
|
||||
156
common/build-style/qmake.sh
Normal file
156
common/build-style/qmake.sh
Normal file
@@ -0,0 +1,156 @@
|
||||
#
|
||||
# This helper is for templates using Qt5/Qt6 qmake.
|
||||
#
|
||||
do_configure() {
|
||||
local qmake
|
||||
local qmake_args
|
||||
local qt=${QT:-}
|
||||
local builddir="${wrksrc}/${build_wrksrc}"
|
||||
cd ${builddir}
|
||||
if [ "${QT}" ]; then
|
||||
qt=${QT}
|
||||
if [ ! -x "/usr/lib/${qt}/bin/qmake" ]; then
|
||||
msg_error "${QT} is requested, but not found\n"
|
||||
fi
|
||||
elif [ -x "/usr/lib/qt5/bin/qmake" ]; then
|
||||
qt="qt5"
|
||||
elif [ -x "/usr/lib/qt6/bin/qmake" ]; then
|
||||
qt="qt6"
|
||||
else
|
||||
msg_error "${pkgver}: Could not find qmake - missing in hostmakedepends?\n"
|
||||
fi
|
||||
qmake="/usr/lib/${qt}/bin/qmake"
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
case $XBPS_TARGET_MACHINE in
|
||||
i686*) _qt_arch=i386;;
|
||||
x86_64*) _qt_arch=x86_64;;
|
||||
aarch64*) _qt_arch=arm64;;
|
||||
arm*) _qt_arch=arm;;
|
||||
mips*) _qt_arch=mips;;
|
||||
ppc64*) _qt_arch=power64;;
|
||||
ppc*) _qt_arch=power;;
|
||||
esac
|
||||
mkdir -p "${builddir}/.target-spec/linux-g++"
|
||||
cat > "${builddir}/.target-spec/linux-g++/qmake.conf" <<_EOF
|
||||
MAKEFILE_GENERATOR = UNIX
|
||||
CONFIG += incremental no_qt_rpath
|
||||
QMAKE_INCREMENTAL_STYLE = sublib
|
||||
|
||||
include(/usr/lib/${qt}/mkspecs/common/linux.conf)
|
||||
include(/usr/lib/${qt}/mkspecs/common/gcc-base-unix.conf)
|
||||
include(/usr/lib/${qt}/mkspecs/common/g++-unix.conf)
|
||||
|
||||
QMAKE_TARGET_CONFIG = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/qconfig.pri
|
||||
QMAKE_TARGET_MODULE = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/qmodule.pri
|
||||
QMAKEMODULES = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/modules
|
||||
QMAKE_CC = ${CC}
|
||||
QMAKE_CXX = ${CXX}
|
||||
QMAKE_LINK = ${CXX}
|
||||
QMAKE_LINK_C = ${CC}
|
||||
QMAKE_LINK_SHLIB = ${CXX}
|
||||
|
||||
QMAKE_AR = ${XBPS_CROSS_TRIPLET}-gcc-ar cqs
|
||||
QMAKE_OBJCOPY = ${OBJCOPY}
|
||||
QMAKE_NM = ${NM} -P
|
||||
QMAKE_STRIP = ${STRIP}
|
||||
|
||||
QMAKE_CFLAGS = ${CFLAGS}
|
||||
QMAKE_CXXFLAGS = ${CXXFLAGS}
|
||||
QMAKE_LFLAGS = ${LDFLAGS}
|
||||
load(qt_config)
|
||||
_EOF
|
||||
echo "#include \"${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/linux-g++/qplatformdefs.h\"" > "${builddir}/.target-spec/linux-g++/qplatformdefs.h"
|
||||
|
||||
mkdir -p "${builddir}/.host-spec/linux-g++"
|
||||
cat > "${builddir}/.host-spec/linux-g++/qmake.conf" <<_EOF
|
||||
MAKEFILE_GENERATOR = UNIX
|
||||
CONFIG += incremental no_qt_rpath
|
||||
QMAKE_INCREMENTAL_STYLE = sublib
|
||||
|
||||
include(/usr/lib/${qt}/mkspecs/common/linux.conf)
|
||||
include(/usr/lib/${qt}/mkspecs/common/gcc-base-unix.conf)
|
||||
include(/usr/lib/${qt}/mkspecs/common/g++-unix.conf)
|
||||
|
||||
QMAKE_TARGET_CONFIG = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/qconfig.pri
|
||||
QMAKE_TARGET_MODULE = ${XBPS_CROSS_BASE}/usr/lib/${qt}/mkspecs/qmodule.pri
|
||||
QMAKE_CC = ${CC_host}
|
||||
QMAKE_CXX = ${CXX_host}
|
||||
QMAKE_LINK = ${CXX_host}
|
||||
QMAKE_LINK_C = ${CC_host}
|
||||
QMAKE_LINK_SHLIB = ${CXX_host}
|
||||
|
||||
QMAKE_AR = gcc-ar cqs
|
||||
QMAKE_OBJCOPY = ${OBJCOPY_host}
|
||||
QMAKE_NM = ${NM_host} -P
|
||||
QMAKE_STRIP = ${STRIP_host}
|
||||
|
||||
QMAKE_CFLAGS = ${CFLAGS_host}
|
||||
QMAKE_CXXFLAGS = ${CXXFLAGS_host}
|
||||
QMAKE_LFLAGS = ${LDFLAGS_host}
|
||||
load(qt_config)
|
||||
_EOF
|
||||
echo '#include "/usr/lib/${qt}/mkspecs/linux-g++/qplatformdefs.h"' > "${builddir}/.host-spec/linux-g++/qplatformdefs.h"
|
||||
cat > "${builddir}/qt.conf" <<_EOF
|
||||
[Paths]
|
||||
Sysroot=${XBPS_CROSS_BASE}
|
||||
Prefix=/usr
|
||||
ArchData=${XBPS_CROSS_BASE}/usr/lib/${qt}
|
||||
Data=${XBPS_CROSS_BASE}/usr/share/${qt}
|
||||
Documentation=${XBPS_CROSS_BASE}/usr/share/doc/${qt}
|
||||
Headers=${XBPS_CROSS_BASE}/usr/include/${qt}
|
||||
Libraries=${XBPS_CROSS_BASE}/usr/lib
|
||||
LibraryExecutables=/usr/lib/${qt}/libexec
|
||||
Binaries=/usr/lib/${qt}/bin
|
||||
Tests=${XBPS_CROSS_BASE}/usr/tests
|
||||
Plugins=/usr/lib/${qt}/plugins
|
||||
Imports=${XBPS_CROSS_BASE}/usr/lib/${qt}/imports
|
||||
Qml2Imports=${XBPS_CROSS_BASE}/usr/lib/${qt}/qml
|
||||
Translations=${XBPS_CROSS_BASE}/usr/share/${qt}/translations
|
||||
Settings=${XBPS_CROSS_BASE}/etc/xdg
|
||||
Examples=${XBPS_CROSS_BASE}/usr/share/${qt}/examples
|
||||
HostPrefix=/usr
|
||||
HostData=/usr/lib/${qt}
|
||||
HostBinaries=/usr/lib/${qt}/bin
|
||||
HostLibraries=/usr/lib
|
||||
HostLibraryExecutables=/usr/lib/${qt}/libexec
|
||||
Spec=${builddir}/.host-spec/linux-g++
|
||||
TargetSpec=${builddir}/.target-spec/linux-g++
|
||||
_EOF
|
||||
qmake_args="-qtconf ${builddir}/qt.conf PKG_CONFIG_EXECUTABLE=${XBPS_WRAPPERDIR}/${PKG_CONFIG}"
|
||||
${qmake} ${qmake_args} \
|
||||
PREFIX=/usr \
|
||||
QT_INSTALL_PREFIX=/usr \
|
||||
LIB=/usr/lib \
|
||||
QT_TARGET_ARCH=$_qt_arch \
|
||||
${configure_args}
|
||||
else
|
||||
${qmake} ${qmake_args} \
|
||||
PREFIX=/usr \
|
||||
QT_INSTALL_PREFIX=/usr \
|
||||
LIB=/usr/lib \
|
||||
QMAKE_CC=$CC QMAKE_CXX=$CXX \
|
||||
QMAKE_LINK=$CXX QMAKE_LINK_C=$CC \
|
||||
QMAKE_CFLAGS="${CFLAGS}" \
|
||||
QMAKE_CXXFLAGS="${CXXFLAGS}" \
|
||||
QMAKE_LFLAGS="${LDFLAGS}" \
|
||||
CONFIG+=no_qt_rpath \
|
||||
${configure_args}
|
||||
fi
|
||||
}
|
||||
|
||||
do_build() {
|
||||
cd "${wrksrc}/${build_wrksrc}"
|
||||
: ${make_cmd:=make}
|
||||
|
||||
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target} \
|
||||
CC="$CC" CXX="$CXX" LINK="$CXX"
|
||||
}
|
||||
|
||||
do_install() {
|
||||
cd "${wrksrc}/${build_wrksrc}"
|
||||
: ${make_cmd:=make}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
${make_cmd} STRIP=true PREFIX=/usr DESTDIR=${DESTDIR} \
|
||||
INSTALL_ROOT=${DESTDIR} ${make_install_args} ${make_install_target}
|
||||
}
|
||||
16
common/build-style/raku-dist.sh
Normal file
16
common/build-style/raku-dist.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# This helper is for Raku package templates.
|
||||
#
|
||||
|
||||
do_check() {
|
||||
RAKULIB=lib ${make_check_pre} prove -r -e raku t/
|
||||
}
|
||||
|
||||
do_install() {
|
||||
export RAKUDO_LOG_PRECOMP=1
|
||||
export RAKUDO_RERESOLVE_DEPENDENCIES=0
|
||||
raku-install-dist \
|
||||
--to=${DESTDIR}/usr/lib/raku/vendor \
|
||||
--for=vendor \
|
||||
--from=.
|
||||
}
|
||||
13
common/build-style/ruby-module.sh
Normal file
13
common/build-style/ruby-module.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# This helper is for templates installing ruby modules.
|
||||
#
|
||||
|
||||
do_install() {
|
||||
local _vendorlibdir=$(ruby -e 'puts RbConfig::CONFIG["vendorlibdir"]')
|
||||
|
||||
if [ "$XBPS_WORDSIZE" != "$XBPS_TARGET_WORDSIZE" ]; then
|
||||
_vendorlibdir="${_vendorlibdir//lib$XBPS_WORDSIZE/lib$XBPS_TARGET_WORDSIZE}"
|
||||
fi
|
||||
|
||||
LANG=C ruby install.rb --destdir=${DESTDIR} --sitelibdir=${_vendorlibdir} ${make_install_args}
|
||||
}
|
||||
35
common/build-style/scons.sh
Normal file
35
common/build-style/scons.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# This helper is for templates using scons.
|
||||
#
|
||||
do_build() {
|
||||
: ${make_cmd:=scons}
|
||||
|
||||
${make_cmd} ${makejobs} CC=$CC CXX=$CXX CCFLAGS="$CFLAGS" \
|
||||
cc=$CC cxx=$CXX ccflags="$CFLAGS" \
|
||||
CXXFLAGS="$CXXFLAGS" LINKFLAGS="$LDFLAGS" \
|
||||
cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" \
|
||||
RANLIB="$RANLIB" ranlib="$RANLIB" \
|
||||
prefix=/usr \
|
||||
${scons_use_destdir:+DESTDIR="${DESTDIR}"} \
|
||||
${scons_use_destdir:+destdir="${DESTDIR}"} \
|
||||
${make_build_args} ${make_build_target}
|
||||
}
|
||||
do_install() {
|
||||
: ${make_cmd:=scons}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
local _sandbox=
|
||||
|
||||
if [ -z "$scons_use_destdir" ]; then _sandbox=yes ; fi
|
||||
|
||||
${make_cmd} ${makejobs} CC=$CC CXX=$CXX CCFLAGS="$CFLAGS" \
|
||||
cc=$CC cxx=$CXX ccflags="$CFLAGS" \
|
||||
CXXFLAGS="$CXXFLAGS" LINKFLAGS="$LDFLAGS" \
|
||||
cxxflags="$CXXFLAGS" linkflags="$LDFLAGS" \
|
||||
RANLIB="$RANLIB" ranlib="$RANLIB" \
|
||||
prefix=/usr \
|
||||
${scons_use_destdir:+DESTDIR="${DESTDIR}"} \
|
||||
${scons_use_destdir:+destdir="${DESTDIR}"} \
|
||||
${_sandbox:+--install-sandbox="${DESTDIR}"} \
|
||||
${make_install_args} ${make_install_target}
|
||||
}
|
||||
147
common/build-style/sip-build.sh
Normal file
147
common/build-style/sip-build.sh
Normal file
@@ -0,0 +1,147 @@
|
||||
#
|
||||
# This helper is for templates using sip-build.
|
||||
#
|
||||
|
||||
do_configure() {
|
||||
local _qt=
|
||||
local _spec=
|
||||
local _mkspec=
|
||||
|
||||
: "${sip_builddir:=build}"
|
||||
mkdir -p "$sip_builddir"
|
||||
|
||||
if [ ! -d /$py3_sitelib/pyqtbuild ]; then
|
||||
: "who uses sip-build without qmake anyway?"
|
||||
elif [ -x /usr/lib/qt6/bin/qmake ]; then
|
||||
_qt=qt6
|
||||
elif [ -x /usr/lib/qt5/bin/qmake ]; then
|
||||
_qt=qt5
|
||||
else
|
||||
msg_error 'qmake not found\n'
|
||||
fi
|
||||
|
||||
if [ ! "$_qt" ]; then
|
||||
: "who use sip-build without qmake anyway?"
|
||||
elif [ "$CROSS_BUILD" ]; then
|
||||
_mkspec="usr/lib/$_qt/mkspecs"
|
||||
_spec="$XBPS_WRAPPERDIR/sip-build/target-spec/linux-g++"
|
||||
mkdir -p "$_spec"
|
||||
cat >"$_spec/qmake.conf" <<-_EOF
|
||||
MAKEFILE_GENERATOR = UNIX
|
||||
CONFIG += incremental no_qt_rpath
|
||||
QMAKE_INCREMENTAL_STYLE = sublib
|
||||
|
||||
include(/$_mkspec/common/linux.conf)
|
||||
include(/$_mkspec/common/gcc-base-unix.conf)
|
||||
include(/$_mkspec/common/g++-unix.conf)
|
||||
|
||||
QMAKE_TARGET_CONFIG = $XBPS_CROSS_BASE/$_mkspec/qconfig.pri
|
||||
QMAKE_TARGET_MODULE = $XBPS_CROSS_BASE/$_mkspec/qmodule.pri
|
||||
QMAKEMODULES = $XBPS_CROSS_BASE/$_mkspec/modules
|
||||
QMAKE_CC = $CC
|
||||
QMAKE_CXX = $CXX
|
||||
QMAKE_LINK = $CXX
|
||||
QMAKE_LINK_C = $CC
|
||||
QMAKE_LINK_SHLIB = $CXX
|
||||
|
||||
QMAKE_AR = $XBPS_CROSS_TRIPLET-gcc-ar cqs
|
||||
QMAKE_OBJCOPY = $OBJCOPY
|
||||
QMAKE_NM = $NM -P
|
||||
QMAKE_STRIP = $STRIP
|
||||
|
||||
QMAKE_CFLAGS = $CFLAGS -I$XBPS_CROSS_BASE/usr/include/python$py3_ver
|
||||
QMAKE_CXXFLAGS = $CXXFLAGS -I$XBPS_CROSS_BASE/usr/include/python$py3_ver
|
||||
QMAKE_LFLAGS = -L$XBPS_CROSS_BASE/usr/lib $LDFLAGS
|
||||
load(qt_config)
|
||||
_EOF
|
||||
|
||||
printf '#include "%s/%s/linux-g++/qplatformdefs.h"\n' \
|
||||
"$XBPS_CROSS_BASE" "$_mkspec" >"$_spec/qplatformdefs.h"
|
||||
cat >"$XBPS_WRAPPERDIR/sip-build/qt.conf" <<-_EOF
|
||||
[Paths]
|
||||
Sysroot=$XBPS_CROSS_BASE
|
||||
Prefix=$XBPS_CROSS_BASE/usr
|
||||
ArchData=$XBPS_CROSS_BASE/usr/lib/$_qt
|
||||
Data=$XBPS_CROSS_BASE/usr/share/$_qt
|
||||
Documentation=$XBPS_CROSS_BASE/usr/share/doc/$_qt
|
||||
Headers=$XBPS_CROSS_BASE/usr/include/$_qt
|
||||
Libraries=$XBPS_CROSS_BASE/usr/lib
|
||||
LibraryExecutables=/usr/lib/$_qt/libexec
|
||||
Binaries=/usr/lib/$_qt/bin
|
||||
Tests=$XBPS_CROSS_BASE/usr/tests
|
||||
Plugins=/usr/lib/$_qt/plugins
|
||||
Imports=$XBPS_CROSS_BASE/usr/lib/$_qt/imports
|
||||
Qml2Imports=$XBPS_CROSS_BASE/usr/lib/$_qt/qml
|
||||
Translations=$XBPS_CROSS_BASE/usr/share/$_qt/translations
|
||||
Settings=$XBPS_CROSS_BASE/etc/xdg
|
||||
Examples=$XBPS_CROSS_BASE/usr/share/$_qt/examples
|
||||
HostPrefix=/usr
|
||||
HostData=/usr/lib/$_qt
|
||||
HostBinaries=/usr/lib/$_qt/bin
|
||||
HostLibraries=/usr/lib
|
||||
HostLibraryExecutables=/usr/lib/$_qt/libexec
|
||||
Spec=linux-g++
|
||||
TargetSpec=$_spec
|
||||
_EOF
|
||||
# Call it sip-qmake to not override qmake build-helper
|
||||
#
|
||||
# XXX: Intentionally quote {C,CXX,LD}FLAGS here but not native.
|
||||
# - Cross Build:
|
||||
# + base flags will be picked up from QMAKE_{C,CXX,LD}FLAGS
|
||||
# + hardening flags will be picked up from environment variables
|
||||
# - Native Build:
|
||||
# + hardening flags will be picked up first (Makefile, qt.conf?)
|
||||
# + base flags will be picked up from QMAKE_{C,CXX,LD}FLAGS
|
||||
# Maybe there're better workaround, I don't know.
|
||||
cat >"$XBPS_WRAPPERDIR/sip-qmake" <<-_EOF
|
||||
#!/bin/sh
|
||||
exec /usr/lib/$_qt/bin/qmake "\$@" \\
|
||||
-qtconf "$XBPS_WRAPPERDIR/sip-build/qt.conf" \\
|
||||
PKG_CONFIG_EXECUTABLE=${XBPS_WRAPPERDIR}/${PKG_CONFIG} \\
|
||||
QMAKE_CFLAGS+="\$CFLAGS" \\
|
||||
QMAKE_CXXFLAGS+="\$CXXFLAGS" \\
|
||||
QMAKE_LFLAGS+="\$LDFLAGS"
|
||||
_EOF
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/sip-qmake
|
||||
else
|
||||
cat >"${XBPS_WRAPPERDIR}/sip-qmake" <<-_EOF
|
||||
#!/bin/sh
|
||||
exec /usr/lib/$_qt/bin/qmake \\
|
||||
"\$@" \\
|
||||
PREFIX=/usr \\
|
||||
QT_INSTALL_PREFIX=/usr \\
|
||||
LIB=/usr/lib \\
|
||||
QMAKE_CC="$CC" QMAKE_CXX="$CXX" \\
|
||||
QMAKE_LINK="$CXX" QMAKE_LINK_C="$CC" \\
|
||||
QMAKE_CFLAGS+="$CFLAGS" \\
|
||||
QMAKE_CXXFLAGS+="$CXXFLAGS" \\
|
||||
QMAKE_LFLAGS+="$LDFLAGS" \\
|
||||
CONFIG+=no_qt_rpath
|
||||
_EOF
|
||||
chmod 755 ${XBPS_WRAPPERDIR}/sip-qmake
|
||||
fi
|
||||
|
||||
sip-build --no-make \
|
||||
${_qt:+--qmake "$XBPS_WRAPPERDIR/sip-qmake"} \
|
||||
--api-dir /usr/share/$_qt/qsci/api/python \
|
||||
$configure_args \
|
||||
--build-dir "$sip_builddir"
|
||||
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
# -I/usr/include/python$py3_ver is set by sip-build :(
|
||||
find "$sip_builddir" -name Makefile |
|
||||
xargs sed -i "s,-I\\(/usr/include\\),-I$XBPS_CROSS_BASE\\1,g"
|
||||
fi
|
||||
}
|
||||
|
||||
do_build() {
|
||||
: "${sip_builddir:=build}"
|
||||
make -C "${sip_builddir}" ${makejobs}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: "${sip_builddir:=build}"
|
||||
make -C "${sip_builddir}" \
|
||||
DESTDIR=${DESTDIR} INSTALL_ROOT=${DESTDIR} \
|
||||
install
|
||||
}
|
||||
33
common/build-style/slashpackage.sh
Normal file
33
common/build-style/slashpackage.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# This helper is for templates building slashpackage software.
|
||||
# http://cr.yp.to/slashpackage.html
|
||||
#
|
||||
# required variables
|
||||
#
|
||||
# build_style=slashpackage
|
||||
# build_wrksrc=${pkgname}-${version}
|
||||
# distfiles=<download link>
|
||||
#
|
||||
# example (daemontools)
|
||||
#
|
||||
# Template file for 'daemontools'
|
||||
# pkgname=daemontools
|
||||
# version=0.76
|
||||
# revision=1
|
||||
# build_wrksrc=${pkgname}-${version}
|
||||
# build_style=slashpackage
|
||||
# short_desc="A collection of tools for managing UNIX services"
|
||||
# maintainer="bougyman <tj@geoforce.com>"
|
||||
# license="Public Domain"
|
||||
# homepage="http://cr.yp.to/daemontools.html"
|
||||
# distfiles="http://cr.yp.to/daemontools/${pkgname}-${version}.tar.gz"
|
||||
|
||||
do_build() {
|
||||
package/compile
|
||||
}
|
||||
|
||||
do_install() {
|
||||
for command in command/*; do
|
||||
vbin $command
|
||||
done
|
||||
}
|
||||
67
common/build-style/texmf.sh
Normal file
67
common/build-style/texmf.sh
Normal file
@@ -0,0 +1,67 @@
|
||||
do_build() {
|
||||
local f p
|
||||
# Extract the source files
|
||||
mkdir -p "build/usr/share/texmf-dist"
|
||||
find . -maxdepth 1 -print -name "*.tar.xz" \
|
||||
-exec bsdtar \
|
||||
-s '|^texmf-dist/||' \
|
||||
-C "build/usr/share/texmf-dist" \
|
||||
-xf {} \;
|
||||
cd "build/usr/share/texmf-dist/"
|
||||
# LICENSEs are unneeded
|
||||
rm -f LICENSE*
|
||||
|
||||
# We have some conflicting files between different packages. To work
|
||||
# around this, we use an ownership file that maps which conflicting
|
||||
# files should be in which packages. Here, each file in the map list is
|
||||
# checked whether it is in the package, and if it shouldn't be it is
|
||||
# removed.
|
||||
while IFS=' ' read -r f p ; do
|
||||
if [ "$p" = "$pkgname" ] && ! [ -e "$f" ]; then
|
||||
# Error out if the ownership map expects this package to have a
|
||||
# file but it dosen't
|
||||
msg_error "$pkgver: missing file $f\n"
|
||||
elif [ "$p" != "$pkgname" ] && [ -e "$f" ]; then
|
||||
# Remove a file that according to the ownership map belongs to
|
||||
# another file
|
||||
echo "removed $f"
|
||||
# Install a file that lists the removed packages
|
||||
mkdir -p ../texlive/removed
|
||||
echo "$f" >> ../texlive/removed/$pkgname.txt
|
||||
rm -f "$f"
|
||||
fi
|
||||
done < "${XBPS_COMMONDIR}/environment/build-style/texmf/ownership.txt"
|
||||
}
|
||||
|
||||
do_check() {
|
||||
# This is essentially a helper for generating the ownership map. It checks
|
||||
# to see if there are any conflicts between all of the different packages.
|
||||
local f p current_ver current_rev exitcode=0
|
||||
cd build
|
||||
|
||||
while read p; do
|
||||
# Don't check against the texlive-bin* packages, ourselves, -dbg or -32bit pkgs
|
||||
if [[ ${p%-*} =~ .*-bin$ ]] || [ "${p%-*}" = "$pkgname" ] || [[ ${p%-*} =~ .*-dbg$ ]] || [[ ${p%-*} =~ .*-32bit$ ]]; then
|
||||
continue
|
||||
fi
|
||||
# Don't check against any version other than the version in the source tree
|
||||
current_ver="$(grep -m 1 version= ${XBPS_SRCPKGDIR}/${p%-*}/template | cut -d= -f2)"
|
||||
current_rev="$(grep -m 1 revision= ${XBPS_SRCPKGDIR}/${p%-*}/template | cut -d= -f2)"
|
||||
if [ "${p%-*}-${current_ver}_${current_rev}" != "${p}" ]; then
|
||||
# They are not the same version
|
||||
continue
|
||||
fi
|
||||
echo checking conflicts with ${p}...
|
||||
while IFS= read -r f; do
|
||||
if [ -e ".$f" ]; then
|
||||
msg_red "both contain file $f\n"
|
||||
exitcode=1
|
||||
fi
|
||||
done < <(xbps-query -Rf $p | sed 's/ -> .*//')
|
||||
done < <(xbps-query -Rs texlive -p pkgver | cut -d : -f 1)
|
||||
return $exitcode
|
||||
}
|
||||
|
||||
do_install() {
|
||||
vcopy build/usr .
|
||||
}
|
||||
681
common/build-style/void-cross.sh
Normal file
681
common/build-style/void-cross.sh
Normal file
@@ -0,0 +1,681 @@
|
||||
#
|
||||
# This helper is for void system crosstoolchain templates.
|
||||
#
|
||||
# Optional variables:
|
||||
#
|
||||
# - cross_gcc_skip_go - do not build gccgo support
|
||||
# - cross_binutils_configure_args
|
||||
# - cross_gcc_bootstrap_configure_args
|
||||
# - cross_gcc_configure_args
|
||||
# - cross_glibc_cflags
|
||||
# - cross_glibc_ldflags
|
||||
# - cross_glibc_configure_args
|
||||
# - cross_musl_cflags
|
||||
# - cross_musl_ldflags
|
||||
# - cross_musl_configure_args
|
||||
#
|
||||
# configure_args is passed to both bootstrap gcc and final gcc
|
||||
# if you need to pass some to one and not the other, use the
|
||||
# respective cross_ variables for final gcc and bootstrap gcc
|
||||
#
|
||||
|
||||
_void_cross_apply_patch() {
|
||||
local pname="$(basename $1)"
|
||||
if [ ! -f ".${pname}_done" ]; then
|
||||
patch -Np1 $args -i $1
|
||||
touch .${pname}_done
|
||||
fi
|
||||
}
|
||||
|
||||
_void_cross_build_binutils() {
|
||||
[ -f ${wrksrc}/.binutils_done ] && return 0
|
||||
|
||||
local tgt=$1
|
||||
local ver=$2
|
||||
|
||||
msg_normal "Patching binutils for ${tgt}\n"
|
||||
|
||||
cd ${wrksrc}/binutils-${ver}
|
||||
if [ -d "${XBPS_SRCPKGDIR}/binutils/patches" ]; then
|
||||
for f in ${XBPS_SRCPKGDIR}/binutils/patches/*.patch; do
|
||||
_void_cross_apply_patch "$f"
|
||||
done
|
||||
fi
|
||||
cd ..
|
||||
|
||||
msg_normal "Building binutils for ${tgt}\n"
|
||||
|
||||
mkdir -p ${wrksrc}/binutils_build
|
||||
cd ${wrksrc}/binutils_build
|
||||
|
||||
../binutils-${ver}/configure \
|
||||
--prefix=/usr \
|
||||
--sbindir=/usr/bin \
|
||||
--libdir=/usr/lib \
|
||||
--libexecdir=/usr/lib \
|
||||
--sysconfdir=/etc \
|
||||
--target=${tgt} \
|
||||
--with-sysroot=/usr/${tgt} \
|
||||
--disable-nls \
|
||||
--disable-shared \
|
||||
--disable-multilib \
|
||||
--disable-werror \
|
||||
--disable-gold \
|
||||
--disable-gprofng \
|
||||
--enable-relro \
|
||||
--enable-new-dtags \
|
||||
--enable-plugins \
|
||||
--enable-64-bit-bfd \
|
||||
--enable-deterministic-archives \
|
||||
--enable-default-hash-style=gnu \
|
||||
--with-system-zlib \
|
||||
--with-mmap \
|
||||
--with-pic \
|
||||
${cross_binutils_configure_args}
|
||||
|
||||
make configure-host
|
||||
make ${makejobs}
|
||||
|
||||
make install DESTDIR=${wrksrc}/build_root
|
||||
|
||||
touch ${wrksrc}/.binutils_done
|
||||
}
|
||||
|
||||
_void_cross_build_bootstrap_gcc() {
|
||||
[ -f ${wrksrc}/.gcc_bootstrap_done ] && return 0
|
||||
|
||||
local tgt=$1
|
||||
local ver=$2
|
||||
|
||||
msg_normal "Patching GCC for ${tgt}\n"
|
||||
|
||||
cd ${wrksrc}/gcc-${ver}
|
||||
|
||||
# Do not run fixincludes
|
||||
sed -i 's@./fixinc.sh@-c true@' Makefile.in
|
||||
|
||||
for f in ${XBPS_SRCPKGDIR}/gcc/patches/*.patch; do
|
||||
_void_cross_apply_patch "$f"
|
||||
done
|
||||
if [ -f ${wrksrc}/.musl_version ]; then
|
||||
for f in ${XBPS_SRCPKGDIR}/gcc/files/*-musl.patch; do
|
||||
_void_cross_apply_patch "$f"
|
||||
done
|
||||
fi
|
||||
cd ..
|
||||
|
||||
msg_normal "Building bootstrap GCC for ${tgt}\n"
|
||||
|
||||
mkdir -p gcc_bootstrap
|
||||
cd gcc_bootstrap
|
||||
|
||||
local extra_args
|
||||
if [ -f ${wrksrc}/.musl_version ]; then
|
||||
extra_args+=" --with-newlib"
|
||||
extra_args+=" --disable-symvers"
|
||||
extra_args+=" libat_cv_have_ifunc=no"
|
||||
else
|
||||
extra_args+=" --without-headers"
|
||||
fi
|
||||
|
||||
../gcc-${ver}/configure \
|
||||
--prefix=/usr \
|
||||
--sbindir=/usr/bin \
|
||||
--libdir=/usr/lib \
|
||||
--libexecdir=/usr/lib \
|
||||
--target=${tgt} \
|
||||
--disable-nls \
|
||||
--disable-multilib \
|
||||
--disable-shared \
|
||||
--disable-libquadmath \
|
||||
--disable-decimal-float \
|
||||
--disable-libgomp \
|
||||
--disable-libmpx \
|
||||
--disable-libmudflap \
|
||||
--disable-libssp \
|
||||
--disable-libitm \
|
||||
--disable-libatomic --disable-autolink-libatomic \
|
||||
--disable-gcov \
|
||||
--disable-threads \
|
||||
--disable-sjlj-exceptions \
|
||||
--enable-languages=c \
|
||||
--with-gnu-ld \
|
||||
--with-gnu-as \
|
||||
${extra_args} \
|
||||
${configure_args} \
|
||||
${cross_gcc_bootstrap_configure_args}
|
||||
|
||||
make ${makejobs}
|
||||
make install DESTDIR=${wrksrc}/build_root
|
||||
|
||||
local ptrs=$(${tgt}-gcc -dM -E - < /dev/null | \
|
||||
grep __SIZEOF_POINTER__)
|
||||
local ws=${ptrs##* }
|
||||
|
||||
case ${ws} in
|
||||
8) echo 64 > ${wrksrc}/.gcc_wordsize ;;
|
||||
4) echo 32 > ${wrksrc}/.gcc_wordsize ;;
|
||||
*) msg_error "Unknown word size: ${ws}\n" ;;
|
||||
esac
|
||||
|
||||
touch ${wrksrc}/.gcc_bootstrap_done
|
||||
}
|
||||
|
||||
_void_cross_build_kernel_headers() {
|
||||
[ -f ${wrksrc}/.linux_headers_done ] && return 0
|
||||
|
||||
local tgt=$1
|
||||
local ver=$2
|
||||
local arch
|
||||
|
||||
msg_normal "Patching Linux headers for ${tgt}\n"
|
||||
|
||||
cd ${wrksrc}/linux-${ver}
|
||||
if [ -d "${XBPS_SRCPKGDIR}/kernel-libc-headers/patches" ]; then
|
||||
for f in ${XBPS_SRCPKGDIR}/kernel-libc-headers/patches/*.patch; do
|
||||
_void_cross_apply_patch "$f"
|
||||
done
|
||||
fi
|
||||
cd ..
|
||||
|
||||
msg_normal "Building Linux headers for ${tgt}\n"
|
||||
|
||||
cd linux-${ver}
|
||||
|
||||
case "$tgt" in
|
||||
x86_64*|i686*) arch=x86 ;;
|
||||
powerpc*) arch=powerpc ;;
|
||||
mips*) arch=mips ;;
|
||||
aarch64*) arch=arm64 ;;
|
||||
arm*) arch=arm ;;
|
||||
riscv*) arch=riscv ;;
|
||||
s390*) arch=s390 ;;
|
||||
*) msg_error "Unknown Linux arch for ${tgt}\n" ;;
|
||||
esac
|
||||
|
||||
make ARCH=${arch} headers
|
||||
find usr/include -name '.*' -delete
|
||||
rm usr/include/Makefile
|
||||
rm -r usr/include/drm
|
||||
cp -a usr/include ${wrksrc}/build_root/usr/${tgt}/usr
|
||||
|
||||
touch ${wrksrc}/.linux_headers_done
|
||||
}
|
||||
|
||||
_void_cross_build_glibc_headers() {
|
||||
[ -f ${wrksrc}/.glibc_headers_done ] && return 0
|
||||
|
||||
local tgt=$1
|
||||
local ver=$2
|
||||
|
||||
msg_normal "Patching glibc for ${tgt}\n"
|
||||
|
||||
cd ${wrksrc}/glibc-${ver}
|
||||
if [ -d "${XBPS_SRCPKGDIR}/glibc/patches" ]; then
|
||||
for f in ${XBPS_SRCPKGDIR}/glibc/patches/*.patch; do
|
||||
_void_cross_apply_patch "$f"
|
||||
done
|
||||
fi
|
||||
cd ..
|
||||
|
||||
msg_normal "Building glibc headers for ${tgt}\n"
|
||||
|
||||
mkdir -p glibc_headers
|
||||
cd glibc_headers
|
||||
|
||||
echo "libc_cv_forced_unwind=yes" > config.cache
|
||||
echo "libc_cv_c_cleanup=yes" >> config.cache
|
||||
|
||||
# we don't need any custom args here, it's just headers
|
||||
CC="${tgt}-gcc" CXX="${tgt}-g++" CPP="${tgt}-cpp" LD="${tgt}-ld" \
|
||||
AS="${tgt}-as" NM="${tgt}-nm" CFLAGS="-pipe" CXXFLAGS="" CPPFLAGS="" \
|
||||
LDFLAGS="" \
|
||||
../glibc-${ver}/configure \
|
||||
--prefix=/usr \
|
||||
--host=${tgt} \
|
||||
--with-headers=${wrksrc}/build_root/usr/${tgt}/usr/include \
|
||||
--config-cache \
|
||||
--enable-kernel=2.6.27 \
|
||||
${cross_glibc_configure_args}
|
||||
|
||||
make -k install-headers cross_compiling=yes \
|
||||
install_root=${wrksrc}/build_root/usr/${tgt}
|
||||
|
||||
touch ${wrksrc}/.glibc_headers_done
|
||||
}
|
||||
|
||||
_void_cross_build_glibc() {
|
||||
[ -f ${wrksrc}/.glibc_build_done ] && return 0
|
||||
|
||||
local tgt=$1
|
||||
local ver=$2
|
||||
|
||||
msg_normal "Building glibc for ${tgt}\n"
|
||||
|
||||
mkdir -p ${wrksrc}/glibc_build
|
||||
cd ${wrksrc}/glibc_build
|
||||
|
||||
local ws=$(cat ${wrksrc}/.gcc_wordsize)
|
||||
|
||||
echo "slibdir=/usr/lib${ws}" > configparms
|
||||
|
||||
echo "libc_cv_forced_unwind=yes" > config.cache
|
||||
echo "libc_cv_c_cleanup=yes" >> config.cache
|
||||
|
||||
CC="${tgt}-gcc" CXX="${tgt}-g++" CPP="${tgt}-cpp" LD="${tgt}-ld" \
|
||||
AR="${tgt}-ar" AS="${tgt}-as" NM="${tgt}-nm" \
|
||||
OBJDUMP="${tgt}-objdump" OBJCOPY="${tgt}-objcopy" \
|
||||
CFLAGS="-pipe ${cross_glibc_cflags}" \
|
||||
CXXFLAGS="-pipe ${cross_glibc_cflags}" \
|
||||
CPPFLAGS="" \
|
||||
LDFLAGS="${cross_glibc_ldflags}" \
|
||||
../glibc-${ver}/configure \
|
||||
--prefix=/usr \
|
||||
--libdir=/usr/lib${ws} \
|
||||
--libexecdir=/usr/libexec \
|
||||
--host=${tgt} \
|
||||
--with-headers=${wrksrc}/build_root/usr/${tgt}/usr/include \
|
||||
--config-cache \
|
||||
--disable-profile \
|
||||
--disable-werror \
|
||||
--enable-kernel=2.6.27 \
|
||||
${cross_glibc_configure_args}
|
||||
|
||||
make ${makejobs}
|
||||
make install_root=${wrksrc}/build_root/usr/${tgt} install
|
||||
|
||||
touch ${wrksrc}/.glibc_build_done
|
||||
}
|
||||
|
||||
_void_cross_build_musl() {
|
||||
[ -f ${wrksrc}/.musl_build_done ] && return 0
|
||||
|
||||
local tgt=$1
|
||||
local ver=$2
|
||||
|
||||
msg_normal "Patching musl for ${tgt}\n"
|
||||
|
||||
case "${ver}" in
|
||||
1.1.*) _musl_pkgname="musl1.1" ;;
|
||||
*) _musl_pkgname="musl" ;;
|
||||
esac
|
||||
|
||||
cd ${wrksrc}/musl-${ver}
|
||||
if [ -d "${XBPS_SRCPKGDIR}/${_musl_pkgname}/patches" ]; then
|
||||
for f in ${XBPS_SRCPKGDIR}/${_musl_pkgname}/patches/*.patch; do
|
||||
_void_cross_apply_patch "$f"
|
||||
done
|
||||
fi
|
||||
cd ..
|
||||
|
||||
msg_normal "Building musl for ${tgt}\n"
|
||||
|
||||
mkdir -p musl_build
|
||||
cd musl_build
|
||||
|
||||
CC="${tgt}-gcc" CXX="${tgt}-g++" CPP="${tgt}-cpp" LD="${tgt}-ld" \
|
||||
AR="${tgt}-ar" AS="${tgt}-as" NM="${tgt}-nm" \
|
||||
CFLAGS="-pipe -fPIC ${cross_musl_cflags}" \
|
||||
CPPFLAGS="${cross_musl_cflags}" LDFLAGS="${cross_musl_ldflags}" \
|
||||
../musl-${ver}/configure \
|
||||
--prefix=/usr \
|
||||
--host=${tgt} \
|
||||
${cross_musl_configure_args}
|
||||
|
||||
make ${makejobs}
|
||||
make DESTDIR=${wrksrc}/build_root/usr/${tgt} install
|
||||
|
||||
CFLAGS="-pipe -fPIC ${cross_musl_cflags}" \
|
||||
CPPFLAGS="${cross_musl_cflags}" LDFLAGS="${cross_musl_ldflags}" \
|
||||
${tgt}-gcc -pipe -fPIC ${cross_musl_cflags} ${cross_musl_ldflags} -fpie \
|
||||
-c ${XBPS_SRCPKGDIR}/${_musl_pkgname}/files/__stack_chk_fail_local.c \
|
||||
-o __stack_chk_fail_local.o
|
||||
${tgt}-ar r libssp_nonshared.a __stack_chk_fail_local.o
|
||||
cp libssp_nonshared.a ${wrksrc}/build_root/usr/${tgt}/usr/lib
|
||||
|
||||
touch ${wrksrc}/.musl_build_done
|
||||
}
|
||||
|
||||
_void_cross_build_libucontext() {
|
||||
[ -n "$cross_gcc_skip_go" ] && return 0
|
||||
[ -f ${wrksrc}/.libucontext_build_done ] && return 0
|
||||
|
||||
local tgt=$1
|
||||
local ver=$2
|
||||
local arch incpath
|
||||
|
||||
msg_normal "Building libucontext for ${tgt}\n"
|
||||
|
||||
case "$tgt" in
|
||||
x86_64*) arch=x86_64 ;;
|
||||
i686*) arch=x86 ;;
|
||||
powerpc64*) arch=ppc64 ;;
|
||||
powerpc*) arch=ppc ;;
|
||||
mips*64*) arch=mips64 ;;
|
||||
mips*) arch=mips ;;
|
||||
aarch64*) arch=aarch64 ;;
|
||||
arm*) arch=arm ;;
|
||||
riscv64*) arch=riscv64 ;;
|
||||
s390x*) arch=s390x ;;
|
||||
*) msg_error "Unknown libucontext arch for ${tgt}\n" ;;
|
||||
esac
|
||||
|
||||
cd ${wrksrc}/libucontext-${ver}
|
||||
# a terrible hack but seems to work for now
|
||||
# we build a static-only library to prevent linking to a runtime
|
||||
# since it's tiny it can be linked into libgo and we don't have
|
||||
# to keep it around (which would possibly conflict with crossdeps)
|
||||
incpath="${wrksrc}/build_root/usr/${tgt}/usr/include"
|
||||
CC="${tgt}-gcc" AS="${tgt}-as" AR="${tgt}-ar" \
|
||||
make ARCH=$arch libucontext.a \
|
||||
CFLAGS="${cross_musl_cflags} -g0 -nostdinc -isystem ${incpath}"
|
||||
|
||||
cp libucontext.a ${wrksrc}/build_root/usr/${tgt}/usr/lib
|
||||
|
||||
touch ${wrksrc}/.libucontext_build_done
|
||||
}
|
||||
|
||||
_void_cross_build_gcc() {
|
||||
[ -f ${wrksrc}/.gcc_build_done ] && return 0
|
||||
|
||||
local tgt=$1
|
||||
local ver=$2
|
||||
|
||||
msg_normal "Building gcc for ${tgt}\n"
|
||||
|
||||
# GIANT HACK: create an empty libatomic.a so gcc cross-compile
|
||||
# below works.
|
||||
ar r ${wrksrc}/build_root/usr/${tgt}/usr/lib/libatomic.a
|
||||
|
||||
mkdir -p ${wrksrc}/gcc_build
|
||||
cd ${wrksrc}/gcc_build
|
||||
|
||||
local langs="c,c++,fortran,objc,obj-c++,ada,lto"
|
||||
if [ -z "$cross_gcc_skip_go" ]; then
|
||||
langs+=",go"
|
||||
fi
|
||||
|
||||
local extra_args
|
||||
if [ -f ${wrksrc}/.musl_version ]; then
|
||||
# otherwise glibc hosts get confused and use the gnu impl
|
||||
extra_args+=" --enable-clocale=generic"
|
||||
extra_args+=" --disable-symvers"
|
||||
extra_args+=" --disable-gnu-unique-object"
|
||||
extra_args+=" libat_cv_have_ifunc=no"
|
||||
else
|
||||
extra_args+=" --enable-clocale=gnu"
|
||||
extra_args+=" --enable-gnu-unique-object"
|
||||
fi
|
||||
|
||||
# note on --disable-libquadmath:
|
||||
# on some platforms the library is actually necessary for the
|
||||
# fortran frontend to build, platforms where this is a problem
|
||||
# should explicitly force libquadmath to be on via cross_gcc_configure_args
|
||||
#
|
||||
../gcc-${ver}/configure \
|
||||
--prefix=/usr \
|
||||
--sbindir=/usr/bin \
|
||||
--libdir=/usr/lib \
|
||||
--libexecdir=/usr/lib \
|
||||
--target=${tgt} \
|
||||
--with-sysroot=/usr/${tgt} \
|
||||
--with-build-sysroot=${wrksrc}/build_root/usr/${tgt} \
|
||||
--enable-languages=${langs} \
|
||||
--disable-nls \
|
||||
--disable-multilib \
|
||||
--disable-sjlj-exceptions \
|
||||
--disable-libquadmath \
|
||||
--disable-libmudflap \
|
||||
--disable-libitm \
|
||||
--disable-libvtv \
|
||||
--disable-libsanitizer \
|
||||
--disable-libstdcxx-pch \
|
||||
--disable-libssp \
|
||||
--enable-shared \
|
||||
--enable-threads=posix \
|
||||
--enable-__cxa_atexit \
|
||||
--enable-linker-build-id \
|
||||
--enable-libada \
|
||||
--enable-lto \
|
||||
--enable-default-pie \
|
||||
--enable-default-ssp \
|
||||
--with-gnu-ld \
|
||||
--with-gnu-as \
|
||||
--with-linker-hash-style=gnu \
|
||||
${extra_args} \
|
||||
${configure_args} \
|
||||
${cross_gcc_configure_args}
|
||||
|
||||
make ${makejobs}
|
||||
|
||||
touch ${wrksrc}/.gcc_build_done
|
||||
}
|
||||
|
||||
_void_cross_test_ver() {
|
||||
local proj=$1
|
||||
local noerr=$2
|
||||
local ver cver
|
||||
for p in ${proj}-*; do
|
||||
cver=${p#${proj}-}
|
||||
if [ -z "$noerr" -a -n "$ver" ]; then
|
||||
msg_error "multiple versions of ${proj} found: ${ver}, ${cver}"
|
||||
fi
|
||||
ver=${cver}
|
||||
done
|
||||
if [ -d "${proj}-${ver}" ]; then
|
||||
echo ${ver} > ${wrksrc}/.${proj}_version
|
||||
return
|
||||
fi
|
||||
if [ -z "$noerr" ]; then
|
||||
msg_error "project ${proj} not available for build\n"
|
||||
fi
|
||||
}
|
||||
|
||||
_void_cross_test_gcc_ver() {
|
||||
local ver basever
|
||||
_void_cross_test_ver gcc
|
||||
ver=$(cat .gcc_version)
|
||||
if [ -d "gcc-${ver}" ] && [ -f "gcc-${ver}/gcc/BASE-VER" ] && [ -f "gcc-${ver}/gcc/DATESTAMP" ]; then
|
||||
basever="$(cat "gcc-${ver}/gcc/BASE-VER")_$(cat "gcc-${ver}/gcc/DATESTAMP")"
|
||||
mv "gcc-${ver}" "gcc-${basever}"
|
||||
echo ${basever} > ${wrksrc}/.gcc_version
|
||||
return
|
||||
fi
|
||||
msg_error "could not determine gcc base version\n"
|
||||
}
|
||||
|
||||
do_build() {
|
||||
# Verify toolchain versions
|
||||
cd ${wrksrc}
|
||||
|
||||
local binutils_ver linux_ver gcc_ver libc_ver libucontext_ver
|
||||
local tgt=${sourcepkg/cross-}
|
||||
|
||||
export CFLAGS="${CFLAGS/-D_FORTIFY_SOURCE=2/}"
|
||||
export CXXFLAGS="${CXXFLAGS/-D_FORTIFY_SOURCE=2/}"
|
||||
|
||||
# Disable explicit -fno-PIE, gcc/binutils/libc will figure this out itself.
|
||||
export CFLAGS="${CFLAGS//-fno-PIE/}"
|
||||
export CXXFLAGS="${CXXFLAGS//-fno-PIE/}"
|
||||
export LDFLAGS="${LDFLAGS//-no-pie/}"
|
||||
|
||||
_void_cross_test_ver binutils
|
||||
_void_cross_test_ver linux
|
||||
_void_cross_test_gcc_ver
|
||||
|
||||
binutils_ver=$(cat .binutils_version)
|
||||
linux_ver=$(cat .linux_version)
|
||||
gcc_ver=$(cat .gcc_version)
|
||||
|
||||
_void_cross_test_ver musl noerr
|
||||
if [ ! -f .musl_version ]; then
|
||||
_void_cross_test_ver glibc
|
||||
libc_ver=$(cat .glibc_version)
|
||||
else
|
||||
libc_ver=$(cat .musl_version)
|
||||
if [ -z "$cross_gcc_skip_go" ]; then
|
||||
_void_cross_test_ver libucontext
|
||||
libucontext_ver=$(cat .libucontext_version)
|
||||
fi
|
||||
fi
|
||||
|
||||
local sysroot="/usr/${tgt}"
|
||||
|
||||
# Prepare environment
|
||||
cd ${wrksrc}
|
||||
|
||||
# Core directories for the build root
|
||||
mkdir -p build_root/usr/{bin,lib,include,share}
|
||||
mkdir -p build_root/usr/${tgt}/usr/{bin,lib,include,share}
|
||||
|
||||
# Host root uses host wordsize
|
||||
ln -sf usr/lib build_root/lib
|
||||
ln -sf usr/lib build_root/lib${XBPS_TARGET_WORDSIZE}
|
||||
ln -sf lib build_root/usr/lib${XBPS_TARGET_WORDSIZE}
|
||||
|
||||
# Prepare target sysroot
|
||||
ln -sf usr/lib build_root/${sysroot}/lib
|
||||
ln -sf lib build_root/${sysroot}/usr/libexec
|
||||
|
||||
_void_cross_build_binutils ${tgt} ${binutils_ver}
|
||||
|
||||
# Prepare environment so we can use temporary prefix
|
||||
local oldpath="$PATH"
|
||||
local oldldlib="$LD_LIBRARY_PATH"
|
||||
|
||||
export PATH="${wrksrc}/build_root/usr/bin:$PATH"
|
||||
export LD_LIBRARY_PATH="${wrksrc}/build_root/usr/lib:$PATH"
|
||||
|
||||
_void_cross_build_bootstrap_gcc ${tgt} ${gcc_ver}
|
||||
_void_cross_build_kernel_headers ${tgt} ${linux_ver}
|
||||
|
||||
local ws=$(cat ${wrksrc}/.gcc_wordsize)
|
||||
|
||||
# Now that we know the target wordsize, prepare symlinks
|
||||
ln -sf usr/lib ${wrksrc}/build_root/${sysroot}/lib${ws}
|
||||
ln -sf lib ${wrksrc}/build_root/${sysroot}/usr/lib${ws}
|
||||
|
||||
if [ -f ${wrksrc}/.musl_version ]; then
|
||||
_void_cross_build_musl ${tgt} ${libc_ver}
|
||||
_void_cross_build_libucontext ${tgt} ${libucontext_ver}
|
||||
else
|
||||
_void_cross_build_glibc_headers ${tgt} ${libc_ver}
|
||||
_void_cross_build_glibc ${tgt} ${libc_ver}
|
||||
fi
|
||||
|
||||
_void_cross_build_gcc ${tgt} ${gcc_ver}
|
||||
|
||||
# restore this stuff in case later hooks depend on it
|
||||
export PATH="$oldpath"
|
||||
export LD_LIBRARY_PATH="$oldldlib"
|
||||
}
|
||||
|
||||
do_install() {
|
||||
# We need to be able to access binutils in the root
|
||||
local oldpath="$PATH"
|
||||
local oldldlib="$LD_LIBRARY_PATH"
|
||||
export PATH="${wrksrc}/build_root/usr/bin:$PATH"
|
||||
export LD_LIBRARY_PATH="${wrksrc}/build_root/usr/lib:$PATH"
|
||||
|
||||
local tgt=${sourcepkg/cross-}
|
||||
local sysroot="/usr/${tgt}"
|
||||
local ws=$(cat ${wrksrc}/.gcc_wordsize)
|
||||
|
||||
# Core directories for the sysroot
|
||||
#
|
||||
# libexec is created for sysroot but not for dest, since in sysroot
|
||||
# we configure glibc with separate libexec, elsewhere it's just lib
|
||||
# and we want to delete the libexec from glibc afterwards to save space
|
||||
mkdir -p ${DESTDIR}/${sysroot}/usr/{bin,lib,libexec,include,share}
|
||||
# Sysroot base symlinks
|
||||
ln -sf usr/bin ${DESTDIR}/${sysroot}/bin
|
||||
ln -sf usr/lib ${DESTDIR}/${sysroot}/lib
|
||||
ln -sf usr/lib ${DESTDIR}/${sysroot}/lib${ws}
|
||||
ln -sf lib ${DESTDIR}/${sysroot}/usr/lib${ws}
|
||||
ln -sf usr/include ${DESTDIR}/${sysroot}/include
|
||||
|
||||
# Install Linux headers
|
||||
cd ${wrksrc}/linux-$(cat ${wrksrc}/.linux_version)
|
||||
cp -a usr/include ${DESTDIR}/${sysroot}/usr
|
||||
|
||||
# Install binutils
|
||||
cd ${wrksrc}/binutils_build
|
||||
make install DESTDIR=${DESTDIR}
|
||||
|
||||
# Install final gcc
|
||||
cd ${wrksrc}/gcc_build
|
||||
make install DESTDIR=${DESTDIR}
|
||||
|
||||
# Move libcc1.so* to the sysroot
|
||||
mv ${DESTDIR}/usr/lib/libcc1.so* ${DESTDIR}/${sysroot}/usr/lib
|
||||
|
||||
local gcc_ver=$(cat ${wrksrc}/.gcc_version)
|
||||
local gcc_patch=${gcc_ver/_*}
|
||||
local gcc_minor=${gcc_patch%.*}
|
||||
local gcc_major=${gcc_minor%.*}
|
||||
|
||||
if [ -f ${wrksrc}/.musl_version ]; then
|
||||
# Install musl
|
||||
cd ${wrksrc}/musl_build
|
||||
make DESTDIR=${DESTDIR}/${sysroot} install
|
||||
|
||||
# Remove useless headers
|
||||
rm -rf ${DESTDIR}/usr/lib/gcc/${tgt}/*/include-fixed
|
||||
|
||||
# Make ld-musl.so symlinks relative
|
||||
for f in ${DESTDIR}/${sysroot}/usr/lib/ld-musl-*.so.*; do
|
||||
ln -sf libc.so ${f}
|
||||
done
|
||||
|
||||
cp libssp_nonshared.a ${DESTDIR}/${sysroot}/usr/lib/
|
||||
else
|
||||
# Install glibc
|
||||
cd ${wrksrc}/glibc_build
|
||||
make install_root=${DESTDIR}/${sysroot} install install-headers
|
||||
|
||||
# Remove bad header
|
||||
rm -f ${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_patch}/include-fixed/bits/statx.h
|
||||
fi
|
||||
|
||||
# minor-versioned symlinks
|
||||
mv ${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_patch} \
|
||||
${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_minor}
|
||||
ln -sfr ${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_minor} \
|
||||
${DESTDIR}/usr/lib/gcc/${tgt}/${gcc_patch}
|
||||
|
||||
# ditto for c++ headers
|
||||
mv ${DESTDIR}/${sysroot}/usr/include/c++/${gcc_patch} \
|
||||
${DESTDIR}/${sysroot}/usr/include/c++/${gcc_minor}
|
||||
ln -sfr ${DESTDIR}/${sysroot}/usr/include/c++/${gcc_minor} \
|
||||
${DESTDIR}/${sysroot}/usr/include/c++/${gcc_patch}
|
||||
|
||||
# Symlinks for gnarl and gnat shared libraries
|
||||
local adalib=usr/lib/gcc/${tgt}/${gcc_patch}/adalib
|
||||
mv ${DESTDIR}/${adalib}/libgnarl-${gcc_major}.so \
|
||||
${DESTDIR}/${sysroot}/usr/lib
|
||||
mv ${DESTDIR}/${adalib}/libgnat-${gcc_major}.so \
|
||||
${DESTDIR}/${sysroot}/usr/lib
|
||||
ln -sf libgnarl-${gcc_major}.so ${DESTDIR}/${sysroot}/usr/lib/libgnarl.so
|
||||
ln -sf libgnat-${gcc_major}.so ${DESTDIR}/${sysroot}/usr/lib/libgnat.so
|
||||
rm -vf ${DESTDIR}/${adalib}/libgna{rl,t}.so
|
||||
|
||||
# Remove libgomp library because it conflicts with libgomp and
|
||||
# libgomp-devel packages
|
||||
rm -f ${DESTDIR}/${sysroot}/usr/lib/libgomp*
|
||||
|
||||
# Remove libdep linker plugin because it conflicts with system binutils
|
||||
rm -f ${DESTDIR}/usr/lib/bfd-plugins/libdep*
|
||||
|
||||
# Remove leftover symlinks
|
||||
rm -f ${DESTDIR}/usr/lib${XBPS_TARGET_WORDSIZE}
|
||||
rm -f ${DESTDIR}/lib*
|
||||
rm -f ${DESTDIR}/*bin
|
||||
# Remove unnecessary stuff
|
||||
rm -rf ${DESTDIR}/${sysroot}/{sbin,etc,var,libexec}
|
||||
rm -rf ${DESTDIR}/${sysroot}/usr/{sbin,share,libexec}
|
||||
rm -rf ${DESTDIR}/usr/share
|
||||
rm -f ${DESTDIR}/usr/lib*/libiberty.a
|
||||
|
||||
export PATH="$oldpath"
|
||||
export LD_LIBRARY_PATH="$oldldlib"
|
||||
}
|
||||
29
common/build-style/waf3.sh
Normal file
29
common/build-style/waf3.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# This helper is for templates using WAF with python3 to build/install.
|
||||
#
|
||||
do_configure() {
|
||||
: ${configure_script:=waf}
|
||||
local cross_args
|
||||
|
||||
if [[ $build_helper = *"qemu"* ]] && [ "$CROSS_BUILD" ]; then
|
||||
# If the qemu build helper is specified, use it for cross builds
|
||||
cross_args="--cross-compile --hostcc=${CC_FOR_BUILD}
|
||||
--cross-execute=qemu-${XBPS_TARGET_QEMU_MACHINE}-static"
|
||||
fi
|
||||
|
||||
PYTHON=/usr/bin/python3 python3 ${configure_script} configure \
|
||||
--prefix=/usr --libdir=/usr/lib${XBPS_TARGET_WORDSIZE} \
|
||||
${configure_args} ${cross_args}
|
||||
}
|
||||
|
||||
do_build() {
|
||||
: ${configure_script:=waf}
|
||||
|
||||
PYTHON=/usr/bin/python3 python3 ${configure_script} build ${make_build_args}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${configure_script:=waf}
|
||||
|
||||
PYTHON=/usr/bin/python3 python3 ${configure_script} install --destdir=${DESTDIR} ${make_install_args}
|
||||
}
|
||||
47
common/build-style/zig-build.sh
Normal file
47
common/build-style/zig-build.sh
Normal file
@@ -0,0 +1,47 @@
|
||||
do_build() {
|
||||
local zig_target zig_cpu
|
||||
|
||||
# TODO: This duplication between build-profiles and cross-profiles
|
||||
# is totally unnecessary. It would be nice if there was some way to
|
||||
# avoid it.
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
zig_target="${XBPS_CROSS_ZIG_TARGET}"
|
||||
zig_cpu="${XBPS_CROSS_ZIG_CPU}"
|
||||
else
|
||||
zig_target="${XBPS_ZIG_TARGET}"
|
||||
zig_cpu="${XBPS_ZIG_CPU}"
|
||||
fi
|
||||
|
||||
# Inform zig of the required libc include paths.
|
||||
cat > xbps_zig_libc.txt <<-EOF
|
||||
include_dir=${XBPS_CROSS_BASE}/usr/include
|
||||
sys_include_dir=${XBPS_CROSS_BASE}/usr/include
|
||||
crt_dir=${XBPS_CROSS_BASE}/usr/lib
|
||||
msvc_lib_dir=
|
||||
kernel32_lib_dir=
|
||||
gcc_dir=
|
||||
EOF
|
||||
|
||||
# The Zig build system only has a single install step, there is no
|
||||
# way to build artifacts for a given prefix and then install those artifacts
|
||||
# to that prefix at some later time. Therefore, we build and install to the zig-out
|
||||
# directory and later copy the artifacts to the destdir in do_install().
|
||||
# We use zig-out to avoid path conflicts as it is the default install
|
||||
# prefix used by the zig build system.
|
||||
DESTDIR="zig-out" zig build \
|
||||
-j"${XBPS_MAKEJOBS}" \
|
||||
--sysroot "${XBPS_CROSS_BASE}" \
|
||||
--search-prefix "${XBPS_CROSS_BASE}/usr" \
|
||||
--prefix /usr \
|
||||
--global-cache-dir /host/zig \
|
||||
--libc xbps_zig_libc.txt \
|
||||
--release=safe \
|
||||
--verbose \
|
||||
-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
|
||||
install \
|
||||
${configure_args}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
cp -r zig-out/* "${DESTDIR}"
|
||||
}
|
||||
Reference in New Issue
Block a user