abuild: adopt stuff to the Termux's file system style (rootfs in $PREFIX)

In Termux all package stuff is located under $PREFIX.
This commit is contained in:
Leonid Pliushch 2018-11-19 14:12:52 +02:00 committed by Fredrik Fornwall
parent 58fa8e3192
commit 2ecc0e95f2
6 changed files with 322 additions and 4 deletions

View File

@ -0,0 +1,12 @@
diff -uNr abuild-3.2.0/abuild-fetch.c abuild-3.2.0.mod/abuild-fetch.c
--- abuild-3.2.0/abuild-fetch.c 2018-06-22 10:24:10.000000000 +0300
+++ abuild-3.2.0.mod/abuild-fetch.c 2018-11-18 13:46:36.361440934 +0200
@@ -163,7 +163,7 @@
int main(int argc, char *argv[])
{
int opt, r=0, i;
- char *destdir = "/var/cache/distfiles";
+ char *destdir = "@TERMUX_PREFIX@/var/cache/distfiles";
program = argv[0];
while ((opt = getopt(argc, argv, "hd:")) != -1) {

View File

@ -0,0 +1,11 @@
--- abuild-3.2.0/abuild-sign.in 2018-06-22 10:24:10.000000000 +0300
+++ abuild-3.2.0.mod/abuild-sign.in 2018-11-18 20:28:48.283970248 +0200
@@ -51,7 +51,7 @@
-e, --installed Check only of there exist a private key for signing
-k, --private KEY The private key to use for signing
-p, --public KEY The name of public key. apk add will look for
- /etc/apk/keys/KEY
+ \$PREFIX/etc/apk/keys/KEY
-q, --quiet
-h, --help Show this help

View File

@ -1,6 +1,5 @@
diff -uNr abuild-3.2.0/abuild.in abuild-3.2.0.mod/abuild.in
--- abuild-3.2.0/abuild.in 2018-06-22 10:24:10.000000000 +0300
+++ abuild-3.2.0.mod/abuild.in 2018-11-18 15:51:27.863075393 +0200
+++ abuild-3.2.0.mod/abuild.in 2018-11-19 00:34:07.861614858 +0200
@@ -1,4 +1,4 @@
-#!/bin/ash -e
+#!/bin/bash -e
@ -19,6 +18,24 @@ diff -uNr abuild-3.2.0/abuild.in abuild-3.2.0.mod/abuild.in
apk_opt_wait="--wait 30"
@@ -427,7 +423,7 @@
initdcheck || return 1
mkdir -p "$srcdir"
local gunzip=$(command -v pigz || echo gunzip)
- [ $gunzip = "/usr/bin/pigz" ] && gunzip="$gunzip -d"
+ [ $gunzip = "@TERMUX_PREFIX@/bin/pigz" ] && gunzip="$gunzip -d"
for u in $source; do
local s
if is_remote "$u"; then
@@ -455,7 +451,7 @@
*.tar.xz)
msg "Unpacking $s..."
local threads_opt
- if [ $(readlink -f $(command -v unxz)) != "/bin/busybox" ]; then
+ if [ $(realpath $(command -v unxz)) != "@TERMUX_PREFIX@/bin/busybox" ]; then
threads_opt="--threads=0"
fi
unxz $threads_opt -c "$s" | tar -C "$srcdir" -x || return 1;;
@@ -544,26 +540,6 @@
return 0
}
@ -46,6 +63,86 @@ diff -uNr abuild-3.2.0/abuild.in abuild-3.2.0.mod/abuild.in
# helper to update config.sub to a recent version
update_config_sub() {
find . -name config.sub | (local changed=false; while read f; do
@@ -671,10 +647,10 @@
find "$dir" -name '*.la' -type f -delete
fi
- # look for /usr/lib/charset.alias
- if [ -e "$dir"/usr/lib/charset.alias ] \
+ # look for @TERMUX_PREFIX@/lib/charset.alias
+ if [ -e "$dir"/@TERMUX_PREFIX@/lib/charset.alias ] \
&& ! options_has "charset.alias"; then
- error "Found /usr/lib/charset.alias"
+ error "Found @TERMUX_PREFIX@/lib/charset.alias"
return 1
fi
# look for /etc/init.d and /etc/conf.d
@@ -682,18 +658,18 @@
&& ! is_openrc_pkg "$name"; then
warning "Found OpenRC directory (/etc/conf.d or /etc/init.d) but name doesn't end with -openrc"
fi
- # look for /usr/share/doc
- if [ -e "$dir"/usr/share/doc ] \
+ # look for @TERMUX_PREFIX@/share/doc
+ if [ -e "$dir"/@TERMUX_PREFIX@/share/doc ] \
&& ! is_doc_pkg "$name"; then
- warning "Found /usr/share/doc but package name doesn't end with -doc"
+ warning "Found @TERMUX_PREFIX@/share/doc but package name doesn't end with -doc"
fi
- # look for /usr/share/man
- if [ -e "$dir"/usr/share/man ]; then
+ # look for @TERMUX_PREFIX@/share/man
+ if [ -e "$dir"/@TERMUX_PREFIX@/share/man ]; then
if ! is_doc_pkg "$name"; then
- warning "Found /usr/share/man but package name doesn't end with -doc"
+ warning "Found @TERMUX_PREFIX@/share/man but package name doesn't end with -doc"
fi
# check for uncompressed man pages
- i=$(find "$dir"/usr/share/man -name '*.[0-8]' -type f | sed "s|^$dir|\t|")
+ i=$(find "$dir"/@TERMUX_PREFIX@/share/man -name '*.[0-8]' -type f | sed "s|^$dir|\t|")
if [ -n "$i" ]; then
error "Found uncompressed man pages:"
echo "$i"
@@ -758,9 +734,9 @@
&& postcheck "$pkgbasedir/$subpkgname" "$subpkgname" ) || return 1
done
postcheck "$pkgdir" "$pkgname" || return 1
- # post check for /usr/share/locale
- if [ -d "$pkgdir"/usr/share/locale ]; then
- warning "Found /usr/share/locale"
+ # post check for @TERMUX_PREFIX@/share/locale
+ if [ -d "$pkgdir"/@TERMUX_PREFIX@/share/locale ]; then
+ warning "Found @TERMUX_PREFIX@/share/locale"
warning2 "Maybe add \$pkgname-lang to subpackages?"
fi
}
@@ -770,7 +746,7 @@
install_if="$pkgname=$pkgver-r$pkgrel lang"
local dir
- for dir in ${langdir:-/usr/share/locale}; do
+ for dir in ${langdir:-@TERMUX_PREFIX@/share/locale}; do
mkdir -p "$subpkgdir"/${dir%/*}
mv "$pkgdir"/"$dir" "$subpkgdir"/"$dir" || return 1
done
@@ -789,7 +765,7 @@
install_if="$pkgname=$pkgver-r$pkgrel lang-$lang"
local dir
- for dir in ${langdir:-/usr/share/locale}; do
+ for dir in ${langdir:-@TERMUX_PREFIX@/share/locale}; do
mkdir -p "$subpkgdir"/$dir
mv "$pkgdir"/$dir/$lang* \
"$subpkgdir"/$dir/ \
@@ -844,7 +820,7 @@
check_license() {
local ret=0
- local license_list=/usr/share/spdx/license.lst
+ local license_list=@TERMUX_PREFIX@/share/spdx/license.lst
local exclude="AND OR WITH"
if options_has "!spdx" || ! [ -f "$license_list" ]; then
return 0
@@ -933,7 +909,7 @@
echo "# Generated by $(basename $0) $program_version" >"$pkginfo"
@ -55,6 +152,98 @@ diff -uNr abuild-3.2.0/abuild.in abuild-3.2.0.mod/abuild.in
fi
echo "# $(date -u)" >> "$pkginfo"
cat >> "$pkginfo" <<-EOF
@@ -953,9 +929,9 @@
for i in $install $triggers; do
local s=${i%=*}
[ "$name" != "${s%.*}" ] && continue
- if head -n 1 "$startdir/$s" | grep '^#!/bin/sh' >/dev/null ; then
- msg "Script found. /bin/sh added as a dependency for $pkg"
- deps="$deps /bin/sh"
+ if head -n 1 "$startdir/$s" | grep '^#!@TERMUX_PREFIX@/bin/sh' >/dev/null ; then
+ msg "Script found. @TERMUX_PREFIX@/bin/sh added as a dependency for $pkg"
+ deps="$deps @TERMUX_PREFIX@/bin/sh"
break
fi
done
@@ -1025,8 +1001,8 @@
scanelf --quiet --recursive --rpath "$dir" \
| sed -e 's/[[:space:]].*//' -e 's/:/\n/' | sort -u \
>"$controldir"/.rpaths
- if grep -q -x '/usr/lib' "$controldir"/.rpaths; then
- warning "Redundant /usr/lib in rpath found"
+ if grep -q -x '@TERMUX_PREFIX@/lib' "$controldir"/.rpaths; then
+ warning "Redundant @TERMUX_PREFIX@/lib in rpath found"
fi
if grep '^/home/' "$controldir"/.rpaths; then
error "Has /home/... in rpath"
@@ -1052,12 +1028,12 @@
local dir="${subpkgdir:-$pkgdir}"
options_has "!tracedeps" && return 0
cd "$dir" || return 1
- for i in usr/lib/pkgconfig/*.pc; do
+ for i in ./@TERMUX_PREFIX@/lib/pkgconfig/*.pc; do
if ! [ -e "$i" ]; then
continue
fi
local f=${i##*/}
- local v=$(PKG_CONFIG_PATH="$dir"/usr/lib/pkgconfig PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH=1 pkg-config \
+ local v=$(PKG_CONFIG_PATH="$dir"/@TERMUX_PREFIX@/lib/pkgconfig PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH=1 pkg-config \
--modversion ${f%.pc})
echo "${f%.pc}=${v:-0}" >> "$controldir"/.provides-pc
done
@@ -1147,12 +1123,12 @@
return 1
}
-# search rpaths and /usr/lib /lib for given so files
+# search rpaths and @TERMUX_PREFIX@/lib for given so files
find_so_files() {
local rpaths=$(cat "$1")
shift
while [ $# -gt 0 ]; do
- real_so_path "$1" /usr/lib /lib $rpaths || return 1
+ real_so_path "$1" @TERMUX_PREFIX@/lib $rpaths || return 1
shift
done
return 0
@@ -1185,8 +1161,8 @@
esac
msg "Tracing dependencies..."
- # add pkgconfig if usr/lib/pkgconfig is found
- if [ -d "$pkgbasedir"/$name/usr/lib/pkgconfig ] \
+ # add pkgconfig if @TERMUX_PREFIX@/lib/pkgconfig is found
+ if [ -d "$pkgbasedir"/$name/@TERMUX_PREFIX@/lib/pkgconfig ] \
&& ! grep -q '^depend = pkgconfig' "$dir"/.PKGINFO; then
autodeps="$autodeps pkgconfig"
fi
@@ -1244,7 +1220,7 @@
autodeps="$autodeps pc:$i"
else
warning "Could not find any provider for pc:$i"
- local pcfile=/usr/lib/pkgconfig/"${i%%[<>=]*}".pc
+ local pcfile=@TERMUX_PREFIX@/lib/pkgconfig/"${i%%[<>=]*}".pc
if [ -e "$pcfile" ]; then
local owner=$($APK $apkroot info --quiet --who-owns $pcfile)
warning "${owner:-package providing $pcfile} needs to be rebuilt"
@@ -1276,7 +1252,7 @@
find_scanelf_paths() {
local datadir="$1"
- local paths="$datadir/lib:$datadir/usr/lib" i= rpaths=
+ local paths="$datadir/lib" i= rpaths=
if [ -n "$ldpath" ]; then
paths="$paths:$(echo "${datadir}${ldpath}" | sed "s|:|:$datadir|g")"
fi
@@ -1422,7 +1398,7 @@
name="$(pkginfo_val pkgname "$controldir"/.PKGINFO)"
datadir="$pkgbasedir"/$name
for i in $(sort -u "$provides_pc"); do
- PKG_CONFIG_PATH="$datadir"/usr/lib/pkgconfig pkg-config \
+ PKG_CONFIG_PATH="$datadir"/@TERMUX_PREFIX@/lib/pkgconfig pkg-config \
--print-requires \
--print-requires-private ${i%=*} \
| sed -E 's/\s*([<>=]+)\s*/\1/' \
@@ -1502,14 +1478,11 @@
}
@ -79,6 +268,71 @@ diff -uNr abuild-3.2.0/abuild.in abuild-3.2.0.mod/abuild.in
$_build
$_check
rootpkg
@@ -1590,14 +1562,14 @@
local i
for i in doc man info html sgml licenses gtk-doc ri help; do
- if [ -d "$pkgdir/usr/share/$i" ]; then
- mkdir -p "$subpkgdir/usr/share"
- mv "$pkgdir/usr/share/$i" "$subpkgdir/usr/share/"
+ if [ -d "$pkgdir/@TERMUX_PREFIX@/share/$i" ]; then
+ mkdir -p "$subpkgdir/@TERMUX_PREFIX@/share"
+ mv "$pkgdir/@TERMUX_PREFIX@/share/$i" "$subpkgdir/@TERMUX_PREFIX@/share/"
fi
done
# compress man pages
- local mandir="$subpkgdir"/usr/share/man
+ local mandir="$subpkgdir"/@TERMUX_PREFIX@/share/man
[ -d "$mandir" ] && find "$mandir" -type l \
-a \( -name \*.[0-8n] -o -name \*.[0-8][a-z]* \) \
-a \! \( -name '*.gz' -o -name '*.bz2' -o -name '*.xz' \) \
@@ -1629,10 +1601,10 @@
[ $islink -eq 0 ] && gzip -9 "$name"
done
- rm -f "$subpkgdir/usr/share/info/dir"
+ rm -f "$subpkgdir/@TERMUX_PREFIX@/share/info/dir"
# remove if empty, ignore error (not empty)
- rmdir "$pkgdir/usr/share" "$pkgdir/usr" 2>/dev/null || :
+ rmdir "$pkgdir/@TERMUX_PREFIX@/share" "$pkgdir" 2>/dev/null || :
}
doc() {
@@ -1648,8 +1620,8 @@
for f in $binfiles; do
srcdir=$(dirname $pkgdir/$f)
srcfile=$(basename $pkgdir/$f)
- dstdir=$(dirname $subpkgdir/usr/lib/debug/$f.debug)
- dstfile=$(basename $subpkgdir/usr/lib/debug/$f.debug)
+ dstdir=$(dirname $subpkgdir/@TERMUX_PREFIX@/lib/debug/$f.debug)
+ dstfile=$(basename $subpkgdir/@TERMUX_PREFIX@/lib/debug/$f.debug)
if [ ! -d $dstdir ] ; then
mkdir -p $dstdir
fi
@@ -1675,14 +1647,14 @@
pkgdesc="$pkgdesc (development files)"
cd "$pkgdir" || return 0
- local libdirs=usr/
+ local libdirs=./@TERMUX_PREFIX@/lib
[ -d lib/ ] && libdirs="lib/ $libdirs"
- for i in usr/include usr/lib/pkgconfig usr/share/aclocal\
- usr/share/gettext usr/bin/*-config \
- usr/share/vala/vapi usr/share/gir-[0-9]*\
- usr/share/qt*/mkspecs \
- usr/lib/qt*/mkspecs \
- usr/lib/cmake \
+ for i in include ./@TERMUX_PREFIX@/lib/pkgconfig ./@TERMUX_PREFIX@/share/aclocal \
+ ./@TERMUX_PREFIX@/share/gettext ./@TERMUX_PREFIX@/bin/*-config \
+ ./@TERMUX_PREFIX@/share/vala/vapi ./@TERMUX_PREFIX@/share/gir-[0-9]*\
+ ./@TERMUX_PREFIX@/share/qt*/mkspecs \
+ ./@TERMUX_PREFIX@/lib/qt*/mkspecs \
+ ./@TERMUX_PREFIX@/lib/cmake \
$(find . -name include -type d) \
$(find $libdirs -name '*.[acho]' \
-o -name '*.prl' 2>/dev/null); do
@@ -1747,33 +1719,17 @@
type "$1" 2>&1 | head -n 1 | egrep -q "is a (shell )?function"
}

View File

@ -0,0 +1,11 @@
--- abuild-3.2.0/checkapk.in 2018-06-22 10:24:10.000000000 +0300
+++ abuild-3.2.0.mod/checkapk.in 2018-11-18 20:27:51.357171116 +0200
@@ -64,7 +64,7 @@
[ -f "$filepath" ] || die "can't find $pkgfile"
# generate a temp repositories file with only the http(s) repos
- grep -E "^https?:" /etc/apk/repositories > $tmpdir/repositories
+ grep -E "^https?:" @TERMUX_PREFIX@/etc/apk/repositories > $tmpdir/repositories
oldpkg=$(apk fetch --repositories-file $tmpdir/repositories --simulate 2>&1 | sed 's/^Downloading //')
if [ "${oldpkg}" = "${pkg}" ]; then

View File

@ -1,6 +1,5 @@
diff -uNr abuild-3.2.0/functions.sh.in abuild-3.2.0.mod/functions.sh.in
--- abuild-3.2.0/functions.sh.in 2018-06-22 10:24:10.000000000 +0300
+++ abuild-3.2.0.mod/functions.sh.in 2018-11-18 15:43:21.526170573 +0200
+++ abuild-3.2.0.mod/functions.sh.in 2018-11-19 01:29:29.167093074 +0200
@@ -114,7 +114,7 @@
PACKAGER=${_PACKAGER-$PACKAGER}
USE_COLORS=${_USE_COLORS-$USE_COLORS}
@ -10,6 +9,20 @@ diff -uNr abuild-3.2.0/functions.sh.in abuild-3.2.0.mod/functions.sh.in
[ -z "$CHOST" ] && CHOST="$CBUILD"
[ -z "$CTARGET" ] && CTARGET="$CHOST"
[ "$(arch_to_hostspec $CBUILD)" != "unknown" ] && CBUILD="$(arch_to_hostspec $CBUILD)"
@@ -134,11 +134,11 @@
# setup build root
[ -z "$CBUILDROOT" ] && export CBUILDROOT="$HOME/sysroot-$CTARGET_ARCH/"
# prepare pkg-config for cross building
- [ -z "$PKG_CONFIG_PATH" ] && export PKG_CONFIG_PATH="${CBUILDROOT}/usr/lib/pkgconfig/"
+ [ -z "$PKG_CONFIG_PATH" ] && export PKG_CONFIG_PATH="${CBUILDROOT}/lib/pkgconfig/"
[ -z "$PKG_CONFIG_SYSROOT_DIR" ] && export PKG_CONFIG_SYSROOT_DIR="${CBUILDROOT}"
# libtool bug workaround for extra rpaths
[ -z "$lt_cv_sys_lib_dlsearch_path_spec" ] && \
- export lt_cv_sys_lib_dlsearch_path_spec="${CBUILDROOT}/lib ${CBUILDROOT}/usr/lib /usr/lib /lib /usr/local/lib"
+ export lt_cv_sys_lib_dlsearch_path_spec="${CBUILDROOT}/lib"
# setup cross-compiler
if [ -z "$CROSS_COMPILE" ]; then
export CROSS_COMPILE="${CHOST}-"
@@ -149,8 +149,8 @@
export HOSTCXXFLAGS="$CXXFLAGS"
export HOSTCFLAGS="$CFLAGS"

View File

@ -0,0 +1,17 @@
--- abuild-3.2.0/sample.APKBUILD 2018-06-22 10:24:10.000000000 +0300
+++ abuild-3.2.0.mod/sample.APKBUILD 2018-11-19 01:28:10.783277331 +0200
@@ -27,10 +27,10 @@
build() {
cd "$builddir"
- ./configure --prefix=/usr \
- --sysconfdir=/etc \
- --mandir=/usr/share/man \
- --infodir=/usr/share/info
+ ./configure --prefix=$PREFIX \
+ --sysconfdir=$PREFIX/etc \
+ --mandir=$PREFIX/share/man \
+ --infodir=$PREFIX/share/info
make
}