xbps-src: common/{,environment}/build_style -> common/${,environment}/build-style.
This commit is contained in:
parent
724426f8e7
commit
df4c861f97
19 changed files with 11 additions and 6 deletions
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.
|
51
common/build-style/cmake.sh
Normal file
51
common/build-style/cmake.sh
Normal file
|
@ -0,0 +1,51 @@
|
|||
#
|
||||
# This helper is for templates using cmake.
|
||||
#
|
||||
do_configure() {
|
||||
[ ! -d build ] && mkdir build
|
||||
cd build
|
||||
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
cat > cross_${XBPS_CROSS_TRIPLET}.cmake <<_EOF
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
SET(CMAKE_C_COMPILER ${XBPS_CROSS_TRIPLET}-gcc)
|
||||
SET(CMAKE_CXX_COMPILER ${XBPS_CROSS_TRIPLET}-g++)
|
||||
SET(CMAKE_CROSSCOMPILING TRUE)
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH ${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
|
||||
configure_args+=" -DCMAKE_TOOLCHAIN_FILE=cross_${XBPS_CROSS_TRIPLET}.cmake"
|
||||
fi
|
||||
configure_args+=" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release"
|
||||
|
||||
if [ "$XBPS_TARGET_MACHINE" = "i686" ]; then
|
||||
configure_args+=" -DCMAKE_INSTALL_LIBDIR=lib32"
|
||||
else
|
||||
configure_args+=" -DCMAKE_INSTALL_LIBDIR=lib"
|
||||
fi
|
||||
|
||||
configure_args+=" -DCMAKE_INSTALL_SBINDIR=sbin"
|
||||
|
||||
cmake ${configure_args} ..
|
||||
}
|
||||
|
||||
do_build() {
|
||||
: ${make_cmd:=make}
|
||||
|
||||
cd build
|
||||
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_cmd:=make}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
cd build
|
||||
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
|
||||
}
|
22
common/build-style/configure.sh
Normal file
22
common/build-style/configure.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
#
|
||||
# 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_install() {
|
||||
: ${make_cmd:=make}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
|
||||
}
|
11
common/build-style/fetch.sh
Normal file
11
common/build-style/fetch.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
# fetch build_style: fetches and copies files to ${wrksrc}.
|
||||
|
||||
do_extract() {
|
||||
local f curfile
|
||||
|
||||
mkdir -p ${wrksrc}
|
||||
for f in ${distfiles}; do
|
||||
curfile=$(basename "${f#*>}")
|
||||
cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${curfile} ${wrksrc}/${curfile}
|
||||
done
|
||||
}
|
21
common/build-style/gnu-configure.sh
Normal file
21
common/build-style/gnu-configure.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
# This helper is for templates using GNU configure scripts.
|
||||
#
|
||||
do_configure() {
|
||||
: ${configure_script:=./configure}
|
||||
|
||||
${configure_script} ${configure_args}
|
||||
}
|
||||
|
||||
do_build() {
|
||||
: ${make_cmd:=make}
|
||||
|
||||
${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_cmd:=make}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
|
||||
}
|
18
common/build-style/gnu-makefile.sh
Normal file
18
common/build-style/gnu-makefile.sh
Normal file
|
@ -0,0 +1,18 @@
|
|||
#
|
||||
# This helper is for templates using GNU Makefiles.
|
||||
#
|
||||
do_build() {
|
||||
: ${make_cmd:=make}
|
||||
|
||||
${make_cmd} \
|
||||
CC="$CC" CXX="$CXX" LD="$LD" AR="$AR" RANLIB="$RANLIB" \
|
||||
CPP="$CPP" AS="$AS" OBJDUMP="$OBJDUMP" STRIP=":" \
|
||||
${makejobs} ${make_build_args} ${make_build_target}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_cmd:=make}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
${make_cmd} STRIP=true PREFIX=/usr DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
|
||||
}
|
9
common/build-style/meta.sh
Normal file
9
common/build-style/meta.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
# meta pkg build style; do nothing.
|
||||
|
||||
do_fetch() {
|
||||
:
|
||||
}
|
||||
|
||||
do_install() {
|
||||
:
|
||||
}
|
32
common/build-style/perl-ModuleBuild.sh
Normal file
32
common/build-style/perl-ModuleBuild.sh
Normal file
|
@ -0,0 +1,32 @@
|
|||
#
|
||||
# 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
|
||||
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 ${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_install() {
|
||||
if [ ! -x ./Build ]; then
|
||||
msg_error "$pkgver: cannot find ./Build script!\n"
|
||||
fi
|
||||
./Build ${make_install_args} install
|
||||
}
|
62
common/build-style/perl-module.sh
Normal file
62
common/build-style/perl-module.sh
Normal file
|
@ -0,0 +1,62 @@
|
|||
#
|
||||
# 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, one can use (relative to $wrksrc):
|
||||
#
|
||||
# perl_configure_dirs="blob/bob foo/blah"
|
||||
#
|
||||
do_configure() {
|
||||
local perlmkf
|
||||
|
||||
if [ -z "$perl_configure_dirs" ]; then
|
||||
perlmkf="$wrksrc/Makefile.PL"
|
||||
if [ ! -f $perlmkf ]; then
|
||||
msg_error "*** ERROR couldn't find $perlmkf, aborting ***\n"
|
||||
fi
|
||||
|
||||
cd $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" \
|
||||
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib" \
|
||||
perl Makefile.PL ${configure_args} INSTALLDIRS=vendor
|
||||
fi
|
||||
|
||||
for i in "$perl_configure_dirs"; do
|
||||
perlmkf="$wrksrc/$i/Makefile.PL"
|
||||
if [ -f $perlmkf ]; then
|
||||
cd $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" \
|
||||
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib" \
|
||||
perl 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" \
|
||||
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib" \
|
||||
${makejobs} ${make_build_args} ${make_build_target}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${make_cmd:=make}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
|
||||
}
|
52
common/build-style/python-module.sh
Normal file
52
common/build-style/python-module.sh
Normal file
|
@ -0,0 +1,52 @@
|
|||
#
|
||||
# This helper is for templates installing python modules.
|
||||
#
|
||||
|
||||
do_build() {
|
||||
: ${python_versions:=2.7}
|
||||
local pyver= pysufx=
|
||||
|
||||
for pyver in $python_versions; do
|
||||
if [ -n "$CROSS_BUILD" ]; then
|
||||
PYPREFIX="$XBPS_CROSS_BASE"
|
||||
if [ "$pyver" != "2.7" ]; then
|
||||
pysufx=m
|
||||
fi
|
||||
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${pyver}${pysufx} -I${XBPS_CROSS_BASE}/usr/include"
|
||||
LDFLAGS+=" -L${XBPS_CROSS_BASE}/lib/python${pyver} -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" python${pyver} setup.py \
|
||||
build --build-base=build-${pyver} ${make_build_args}
|
||||
else
|
||||
python${pyver} setup.py build --build-base=build-${pyver} ${make_build_args}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
do_install() {
|
||||
: ${python_versions:=2.7}
|
||||
local pyver= pysufx=
|
||||
|
||||
for pyver in $python_versions; do
|
||||
if [ -n "$CROSS_BUILD" ]; then
|
||||
PYPREFIX="$XBPS_CROSS_BASE"
|
||||
if [ "$pyver" != "2.7" ]; then
|
||||
pysufx=m
|
||||
fi
|
||||
CFLAGS+=" -I${XBPS_CROSS_BASE}/include/python${pyver}${pysufx} -I${XBPS_CROSS_BASE}/usr/include"
|
||||
LDFLAGS+=" -L${XBPS_CROSS_BASE}/lib/python${pyver} -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" python${pyver} setup.py \
|
||||
build --build-base=build-${pyver} install ${make_install_args}
|
||||
else
|
||||
python${pyver} setup.py build --build-base=build-${pyver} \
|
||||
install --prefix=/usr --root=$DESTDIR ${make_install_args}
|
||||
fi
|
||||
done
|
||||
}
|
9
common/build-style/ruby-module.sh
Normal file
9
common/build-style/ruby-module.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# This helper is for templates installing ruby modules.
|
||||
#
|
||||
|
||||
do_install() {
|
||||
local _vendorlibdir=$(ruby -e 'puts RbConfig::CONFIG["vendorlibdir"]')
|
||||
|
||||
ruby install.rb --destdir=${DESTDIR} --sitelibdir=${_vendorlibdir} ${make_install_args}
|
||||
}
|
14
common/build-style/waf.sh
Normal file
14
common/build-style/waf.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# This helper is for templates using WAF to build/install.
|
||||
#
|
||||
do_configure() {
|
||||
python waf configure --prefix=/usr ${configure_args}
|
||||
}
|
||||
|
||||
do_build() {
|
||||
python waf build ${make_build_args}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
python waf install --destdir=${DESTDIR} ${make_install_args}
|
||||
}
|
14
common/build-style/waf3.sh
Normal file
14
common/build-style/waf3.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# This helper is for templates using WAF with python3 to build/install.
|
||||
#
|
||||
do_configure() {
|
||||
PYTHON=python3 python3 waf configure --prefix=/usr ${configure_args}
|
||||
}
|
||||
|
||||
do_build() {
|
||||
PYTHON=python3 python3 waf build ${make_build_args}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
PYTHON=python3 python3 waf install --destdir=${DESTDIR} ${make_install_args}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue