ports: Auto-strip binaries, remove libtool .la files, add dependencies

This commit is contained in:
apio 2023-08-08 19:46:04 +02:00
parent b1e164f360
commit 3f55a70f6e
Signed by: apio
GPG Key ID: B8A7D06E42258954
5 changed files with 28 additions and 11 deletions

View File

@ -48,10 +48,13 @@ The `name` variable should be set to the name of the ported program.
The `version` variable should be set to the currently ported version of the program.
If the program has dependencies on any other library/program, the `dependencies` field should be set to a list of those. Note that these dependencies must also be ported to Luna! Thus, when porting programs, you'll have to start with porting their dependencies (unless those have already been ported).
Example:
```
name="example"
version="1.0.0"
dependencies=(foo bar)
```
#### Download options

View File

@ -10,6 +10,7 @@ sha256sum="d12ea6f239f1ffe3533ea11ad6e224ffcb89eb5d01bbea589e9158780fa11f10"
# Build instructions
default_build_make=true
default_install_make=true
do_patch()
{
@ -20,11 +21,3 @@ do_configure()
{
$srcdir/configure --host=$LUNA_ARCH-luna --disable-nls --disable-werror --enable-warn-rwx-segments=no --prefix=/usr --enable-gold=no --enable-ld=yes --enable-gprofng=no
}
do_install()
{
make install
cd $installdir/usr/bin
$LUNA_ARCH-luna-strip size objdump ar strings ranlib objcopy addr2line readelf elfedit nm strip c++filt as gprof ld.bfd ld
}

View File

@ -15,16 +15,23 @@ fi
source ports/$PORT_NAME/PACKAGE
IS_NEW_VERSION=0
if ! [ -f ports/out/$name-$version.tar.gz ]; then
tools/make-package.sh $PORT_NAME
IS_NEW_VERSION=1
fi
PORT_FILES=$LUNA_BASE/usr/share/pkgdb/$PORT_NAME.files
PORT_FILES=$LUNA_BASE/usr/share/pkgdb/$name.files
if [ -f $PORT_FILES ]
then
echo "Package $PORT_NAME is already installed! Updating."
tools/uninstall-package.sh $PORT_NAME
if [ "$IS_NEW_VERSION" -eq "0" ]; then
echo "Package $PORT_NAME version $version is already installed!"
exit 0
fi
echo "Package $PORT_NAME is already installed! Updating to version $version."
tools/uninstall-package.sh $name
fi
mkdir -p $LUNA_BASE/usr/share/pkgdb/

View File

@ -28,6 +28,13 @@ source ports/$PORT_NAME/PACKAGE
[ -z ${format+x} ] && show_error "error: The port's PACKAGE file does not have a 'format' key."
[ -z ${url+x} ] && show_error "error: The port's PACKAGE file does not have a 'url' key."
if ! [ -z ${dependencies+x} ]; then
echo "Installing dependencies of $name: ($dependencies)"
for dep in ${dependencies[@]}; do
tools/install-package.sh $dep
done
fi
export portdir=$LUNA_ROOT/ports/$name/
export srcdir=${srcdir:-$WORKDIR/$name-$version}
export builddir=$WORKDIR/build-$name
@ -109,6 +116,11 @@ else
do_install
fi
rm -f $installdir/usr/lib/*.la # remove all libtool .la files, as they use host stuff which we don't want at all
set +e
$LUNA_ARCH-luna-strip $installdir/usr/bin/* # strip all binaries
set -e
cd $installdir
tar czf $LUNA_ROOT/ports/out/$name-$version.tar.gz *

View File

@ -14,5 +14,7 @@ then
exit 1
fi
set +e
rm -v $(cat $LUNA_BASE/usr/share/pkgdb/$PORT_NAME.files)
rm -v $LUNA_BASE/usr/share/pkgdb/$PORT_NAME.files