fukiame a753e0e862
buildjre8: improvements (#19)
* .github: move apt commands to workflow

the scripts are capable of running on other distros, so "let the host cook"
also explicitly use Python 3 here as the build env do not use Python 2

* treewide: use bash [[

./buildlibs.sh: line 18: [: : integer expression expected
...
./buildjdk.sh: line 53: [: : integer expression expected
...

all scripts has bash shebang anyways,
replace all single brackets [ with bash's double brackets [[

* [hack] tarjdk: force termux-elf-cleaner v2.2.0

g++: error: unrecognized command line option ‘-std=c++20’; did you mean ‘-std=c++2a’?

caused by a mix of our outdated toolchains and an upstream commit [1]
downgrade the version of termux-elf-cleaner we use to the latest stable tag to workaround the issue

[1]: 9578f2c4bc

Test: presubmit
Signed-off-by: fukiame <fukiame@proton.me>

* .github: update actions

The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions/setup-java@v1, actions/upload-artifact@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/

* .github: actions runner: update to ubuntu-22.04

a bit of future-proofing wont hurt... right?

* fixup! .github: java setup: its 7 not 1.7

i retartded

---------

Signed-off-by: fukiame <fukiame@proton.me>
2024-01-16 19:33:23 +03:00

92 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
set -e
## Usage:
## ./repackjre.sh [path_to_normal_jre_tarballs] [output_path]
# set args
export in="$1"
export out="$2"
# set working dirs
work="$in/work"
work1="$in/work1"
# make sure paths exist
mkdir -p $work
mkdir -p $work1
mkdir -p "$out"
compress_jars(){
find ./ -name '*.jar' -execdir pack200 -S-1 -g -G -E9 {}.pack {} \;
find ./ -name '*.jar' -execdir rm {} \;
}
# here comes a not-so-complicated functions to easily make desired arch
## Usage: makearch [jre_libs_dir_name] [name_in_tarball]
makearch () {
echo "Making $2...";
cd "$work";
tar xf $(find "$in" -name jre8-$2-*release.tar.xz) > /dev/null;
# Remove unused stuff before moving it
rm bin/rmid
rm bin/keytool
rm bin/rmiregistry
rm bin/tnameserv
rm bin/policytool
rm bin/orbd
rm bin/servertool
mv release "$work1"/;
mv bin "$work1"/;
mkdir -p "$work1"/lib;
mv lib/$1 "$work1"/lib/;
mv lib/jexec "$work1"/lib/;
XZ_OPT="-6 --threads=0" tar cJf bin-$2.tar.xz -C "$work1" . > /dev/null 2>&1;
mv bin-$2.tar.xz "$out"/;
rm -rf "$work"/*;
rm -rf "$work1"/*;
}
# this one's static
makeuni () {
echo "Making universal...";
cd "$work";
tar xf $(find "$in" -name jre8-arm64-*release.tar.xz) > /dev/null; rm -rf bin;
rm -rf lib/aarch64;
rm lib/jexec;
rm release;
#find ./lib/ext ! -name 'zipfs.jar' -type f -exec rm -f {} +
rm -rf lib/jfr
rm -rf man
compress_jars
XZ_OPT="-6 --threads=0" tar cJf universal.tar.xz * > /dev/null 2>&1;
mv universal.tar.xz "$out"/;
rm -rf "$work"/*;
}
# now time to use them!
makeuni
makearch aarch32 arm
makearch aarch64 arm64
makearch i386 x86
makearch amd64 x86_64
# if running under GitHub Actions, write commit sha, else formatted system date
if [[ -n "$GITHUB_SHA" ]]
then
echo $GITHUB_SHA>"$out"/version
else
date +%Y%m%d>"$out"/version
fi