Skip to content

Commit

Permalink
build JNI libs
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Nov 2, 2023
1 parent 341ca50 commit 30b9605
Show file tree
Hide file tree
Showing 8 changed files with 242 additions and 348 deletions.
190 changes: 190 additions & 0 deletions .github/workflows/jni_libs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
name: JNI Libs

on:
push:
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
pull_request:
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
workflow_dispatch:
inputs:
version:
description: dummy
default: dummy

defaults:
run:
shell: bash

jobs:

build-macos-jni-artifact:
name: JNI Artifact macOS Build
runs-on: macos-11
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- name: install deps
run: brew install git automake yasm nasm

- name: build deps
run: |
ls -al
id
pwd
./circle_scripts/deps_macos.sh
- name: build jni lib
run: |
ls -al
id
pwd
./circle_scripts/java_jni_lib_macos.sh
- name: sha hash of jni lib
run: |
shasum -a 256 /Users/runner/ToxAndroidRefImpl/jni-c-toxcore/libjni-c-toxcore.jnilib || echo "ignore"
- name: Rename artifact for nightly upload
if: github.ref == 'refs/heads/master'
run: |
pwd
cp -v /Users/runner/ToxAndroidRefImpl/jni-c-toxcore/libjni-c-toxcore.jnilib libjni-c-toxcore.jnilib
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: libjni-c-toxcore.jnilib
path: libjni-c-toxcore.jnilib
- name: Upload to nightly release
uses: ncipollo/release-action@v1
if: github.ref == 'refs/heads/master'
with:
allowUpdates: true
tag: nightly
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "libjni-c-toxcore.jnilib"

build-linux-jni-artifact:
name: JNI Artifact Linux Build
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- name: install deps
run: |
sudo apt-get update && \
sudo DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
ca-certificates \
openjdk-17-jdk \
openjdk-17-jdk-headless \
coreutils autoconf libtool pkg-config \
yasm
- name: build deps
run: |
ls -al
id
pwd
./circle_scripts/deps_linux.sh
- name: build jni lib
run: |
ls -al
id
pwd
./circle_scripts/java_jni_lib_linux.sh
- name: sha hash of jni lib
run: |
sha256sum /home/runner/work/trifa_material/trifa_material/libjni-c-toxcore.jnilib || echo "ignore"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: libjni-c-toxcore.so
path: libjni-c-toxcore.so
- name: Upload to nightly release
uses: ncipollo/release-action@v1
if: github.ref == 'refs/heads/master'
with:
allowUpdates: true
tag: nightly
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "libjni-c-toxcore.so"


build-windows-jni-artifact:
name: JNI Artifact Windows Build
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- name: install deps
run: |
sudo apt-get update && \
sudo DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
ca-certificates \
yasm \
openjdk-17-jdk \
openjdk-17-jdk-headless \
coreutils autoconf libtool pkg-config \
gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 \
mingw-w64-tools pkg-config-mingw-w64-x86-64 win-iconv-mingw-w64-dev \
mingw-w64-x86-64-dev
- name: build deps
run: |
ls -al
id
pwd
./circle_scripts/deps_win.sh
- name: build jni lib
run: |
ls -al
id
pwd
./circle_scripts/java_jni_lib_win.sh
- name: sha hash of jni lib
run: |
sha256sum /home/runner/work/trifa_material/trifa_material/libjni-c-toxcore.jnilib || echo "ignore"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: jni-c-toxcore.dll
path: jni-c-toxcore.dll
- name: Upload to nightly release
uses: ncipollo/release-action@v1
if: github.ref == 'refs/heads/master'
with:
allowUpdates: true
tag: nightly
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "jni-c-toxcore.dll"

70 changes: 0 additions & 70 deletions .github/workflows/jni_macos.yml

This file was deleted.

9 changes: 5 additions & 4 deletions circle_scripts/deps_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ export MAKEFLAGS
WGET_OPTIONS="--timeout=10"
export WGET_OPTIONS

FLAGS_ASAN='-fsanitize=address -fno-omit-frame-pointer' # -static-libasan'
CXXFLAGS_ADDON='-O2 -g -fPIC'
CFLAGS_ADDON='-O2 -g -fPIC'
CXXFLAGS_ADDON='-O2 -g -fPIC -D_FORTIFY_SOURCE=2 -fstack-protector-strong'
CFLAGS_ADDON='-O2 -g -fPIC -D_FORTIFY_SOURCE=2 -fstack-protector-strong'
CFLAGS_MORE='--param=ssp-buffer-size=1 -fstack-protector-all'
# ----------- config ------------

Expand Down Expand Up @@ -108,6 +107,8 @@ export LDFLAGS=" "
--disable-demuxers \
--disable-parsers \
--disable-bsfs \
--disable-libxcb \
--disable-libxcb-shm \
--enable-parser=h264 \
--enable-decoder=h264 || exit 1

Expand Down Expand Up @@ -253,7 +254,7 @@ cd "$_SRC_"
# seems man pages are not always built. but who needs those
touch nasm.1
touch ndisasm.1
make install
sudo make install

type -a nasm

Expand Down
Loading

0 comments on commit 30b9605

Please sign in to comment.