Merge pull request #3 from Google61/buildjre8

Repack JRE as PojavLauncher compatible tarballs
This commit is contained in:
Duy Tran Khanh 2021-04-20 16:17:45 +07:00 committed by GitHub
commit b6133c53f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 71 additions and 1 deletions

View File

@ -1,6 +1,6 @@
name: Build OpenJDK for Android name: Build OpenJDK for Android
on: [push] on: [push, pull_request, workflow_dispatch]
jobs: jobs:
build: build:
@ -40,3 +40,36 @@ jobs:
with: with:
name: "jre8-debuginfo-${{matrix.arch}}" name: "jre8-debuginfo-${{matrix.arch}}"
path: dizout path: dizout
pojav:
needs: build
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get jre8-aarch32
uses: actions/download-artifact@v2
with:
name: jre8-aarch32
path: pojav
- name: Get jre8-aarch64
uses: actions/download-artifact@v2
with:
name: jre8-aarch64
path: pojav
- name: Get jre8-x86
uses: actions/download-artifact@v2
with:
name: jre8-x86
path: pojav
- name: Get jre8-x86_64
uses: actions/download-artifact@v2
with:
name: jre8-x86_64
path: pojav
- name: Repack JRE
run: bash "repackjre.sh" $GITHUB_WORKSPACE/pojav $GITHUB_WORKSPACE/pojav/jre8-pojav
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: jre8-pojav
path: pojav/jre8-pojav/*

37
repackjre.sh Normal file
View File

@ -0,0 +1,37 @@
## 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"
# 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 2>&1; mv bin "$work1"/; mkdir -p "$work1"/lib; mv lib/$1 "$work1"/lib/; mv lib/jexec "$work1"/lib/; 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 2>&1; rm -rf bin; rm -rf lib/aarch64; rm lib/jexec; 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