1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-21 18:49:46 +01:00

Make sysroot preparation & packaging overrideable package actions

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2020-04-19 08:37:21 +02:00
parent d7e7b47cae
commit 55d13e06fd
5 changed files with 67 additions and 62 deletions

1
mk.sh
View file

@ -47,7 +47,6 @@ export BUILD_PATH_PREFIX_MAP="$PKGSRCDIR=src:$BUILDROOT=build"
############################# include utilities ##############################
source "$SCRIPTDIR/util/pkgcmd.sh"
source "$SCRIPTDIR/util/misc.sh"
source "$SCRIPTDIR/util/override.sh"
source "$SCRIPTDIR/util/autotools.sh"
source "$SCRIPTDIR/util/build_package.sh"

View file

@ -12,27 +12,14 @@ build_package() {
return
fi
for f in $SUBPKG; do
rm -f "$REPODIR/${f}.pkg"
done
rm -rf "$SYSROOT" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
mkdir -p "$SYSROOT" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
if [ ! -z "$DEPENDS" ]; then
pkg install -omD $DEPENDS
fi
run_pkg_command "set_scene"
run_pkg_command "download"
run_pkg_command "build"
run_pkg_command "deploy"
deploy_dev_cleanup
strip_files ${PKGDEPLOYDIR}/{bin,lib}
for f in $SUBPKG; do
pkg pack -d "$PKGDEPLOYDIR/${f}.desc" \
-l "$PKGDEPLOYDIR/${f}.files"
done
run_pkg_command "package"
rm -rf "$SYSROOT" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
}

View file

@ -50,6 +50,52 @@ fetch_package() {
fi
}
strip_files() {
local f
for f in $@; do
[ ! -L "$f" ] || continue;
if [ -d "$f" ]; then
strip_files ${f}/*
fi
[ -f "$f" ] || continue;
if file -b $f | grep -q -i elf; then
${TARGET}-strip --discard-all "$f" 2> /dev/null || true
fi
done
}
deploy_dev_cleanup() {
local f
if [ -d "$PKGDEPLOYDIR/share/pkgconfig" ]; then
mkdir -p "$PKGDEPLOYDIR/lib/pkgconfig"
mv $PKGDEPLOYDIR/share/pkgconfig/* "$PKGDEPLOYDIR/lib/pkgconfig"
rmdir "$PKGDEPLOYDIR/share/pkgconfig"
fi
for f in $PKGDEPLOYDIR/lib/*.la; do
[ ! -e "$f" ] || rm "$f"
done
}
unfuck_libtool() {
local libdir="$PKGDEPLOYDIR/lib"
local f
for f in $(find $PKGBUILDDIR -type f -name '*.la' -o -name '*.lai'); do
sed -i "s#libdir='.*'#libdir='$libdir'#g" "$f"
done
sed -i -r "s/(finish_cmds)=.*$/\1=\"\"/" "$PKGBUILDDIR/libtool"
sed -i -r "s/(hardcode_into_libs)=.*$/\1=no/" "$PKGBUILDDIR/libtool"
sed -i "s#libdir='\$install_libdir'#libdir='$libdir'#g" "$PKGBUILDDIR/libtool"
}
download() {
fetch_package
}
@ -58,6 +104,12 @@ prepare() {
apply_patches
}
set_scene() {
if [ ! -z "$DEPENDS" ]; then
pkg install -omD $DEPENDS
fi
}
build() {
return
}
@ -66,6 +118,18 @@ deploy() {
return
}
package() {
deploy_dev_cleanup
strip_files ${PKGDEPLOYDIR}/{bin,lib}
for f in $SUBPKG; do
rm -f "$REPODIR/${f}.pkg"
pkg pack -d "$PKGDEPLOYDIR/${f}.desc" \
-l "$PKGDEPLOYDIR/${f}.files"
done
}
check_update() {
return
}

View file

@ -1,45 +0,0 @@
strip_files() {
local f
for f in $@; do
[ ! -L "$f" ] || continue;
if [ -d "$f" ]; then
strip_files ${f}/*
fi
[ -f "$f" ] || continue;
if file -b $f | grep -q -i elf; then
${TARGET}-strip --discard-all "$f" 2> /dev/null || true
fi
done
}
deploy_dev_cleanup() {
local f
if [ -d "$PKGDEPLOYDIR/share/pkgconfig" ]; then
mkdir -p "$PKGDEPLOYDIR/lib/pkgconfig"
mv $PKGDEPLOYDIR/share/pkgconfig/* "$PKGDEPLOYDIR/lib/pkgconfig"
rmdir "$PKGDEPLOYDIR/share/pkgconfig"
fi
for f in $PKGDEPLOYDIR/lib/*.la; do
[ ! -e "$f" ] || rm "$f"
done
}
unfuck_libtool() {
local libdir="$PKGDEPLOYDIR/lib"
local f
for f in $(find $PKGBUILDDIR -type f -name '*.la' -o -name '*.lai'); do
sed -i "s#libdir='.*'#libdir='$libdir'#g" "$f"
done
sed -i -r "s/(finish_cmds)=.*$/\1=\"\"/" "$PKGBUILDDIR/libtool"
sed -i -r "s/(hardcode_into_libs)=.*$/\1=no/" "$PKGBUILDDIR/libtool"
sed -i "s#libdir='\$install_libdir'#libdir='$libdir'#g" "$PKGBUILDDIR/libtool"
}

View file

@ -1,7 +1,7 @@
include_pkg() {
PKGNAME="$1" # globally visible package name
unset -f build deploy download prepare check_update
unset -f build deploy download prepare check_update package
unset -v VERSION TARBALL URL SRCDIR SHA256SUM DEPENDS SUBPKG
source "$SCRIPTDIR/util/emptypkg.sh"
source "$SCRIPTDIR/pkg/$PKGNAME/build"