Skip to content

Commit 7edf484

Browse files
committed
build JNI libs
1 parent 341ca50 commit 7edf484

File tree

8 files changed

+235
-329
lines changed

8 files changed

+235
-329
lines changed

.github/workflows/jni_libs.yml

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
name: JNI Libs
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'README.md'
7+
- 'CHANGELOG.md'
8+
pull_request:
9+
paths-ignore:
10+
- 'README.md'
11+
- 'CHANGELOG.md'
12+
workflow_dispatch:
13+
inputs:
14+
version:
15+
description: dummy
16+
default: dummy
17+
18+
defaults:
19+
run:
20+
shell: bash
21+
22+
jobs:
23+
24+
build-macos-jni-artifact:
25+
name: JNI Artifact macOS Build
26+
runs-on: macos-11
27+
permissions:
28+
contents: write
29+
steps:
30+
- uses: actions/checkout@v3
31+
32+
- name: install deps
33+
run: brew install git automake yasm nasm
34+
35+
- name: build deps
36+
run: |
37+
ls -al
38+
id
39+
pwd
40+
./circle_scripts/deps_macos.sh
41+
42+
- name: build jni lib
43+
run: |
44+
ls -al
45+
id
46+
pwd
47+
./circle_scripts/java_jni_lib_macos.sh
48+
49+
- name: sha hash of jni lib
50+
run: |
51+
sha256sum /Users/runner/ToxAndroidRefImpl/jni-c-toxcore/libjni-c-toxcore.jnilib || echo "ignore"
52+
shasum -a 256 /Users/runner/ToxAndroidRefImpl/jni-c-toxcore/libjni-c-toxcore.jnilib || echo "ignore"
53+
54+
- name: Rename artifact for nightly upload
55+
if: github.ref == 'refs/heads/master'
56+
run: |
57+
pwd
58+
cp -v /Users/runner/ToxAndroidRefImpl/jni-c-toxcore/libjni-c-toxcore.jnilib libjni-c-toxcore.jnilib
59+
- name: Upload artifact
60+
uses: actions/upload-artifact@v3
61+
with:
62+
name: libjni-c-toxcore.jnilib
63+
path: libjni-c-toxcore.jnilib
64+
- name: Upload to nightly release
65+
uses: ncipollo/release-action@v1
66+
if: github.ref == 'refs/heads/master'
67+
with:
68+
allowUpdates: true
69+
tag: nightly
70+
omitBodyDuringUpdate: true
71+
omitNameDuringUpdate: true
72+
prerelease: true
73+
replacesArtifacts: true
74+
token: ${{ secrets.GITHUB_TOKEN }}
75+
artifacts: "libjni-c-toxcore.jnilib"
76+
77+
build-linux-jni-artifact:
78+
name: JNI Artifact Linux Build
79+
runs-on: ubuntu-20.04
80+
permissions:
81+
contents: write
82+
steps:
83+
- uses: actions/checkout@v3
84+
85+
- name: install deps
86+
run: |
87+
sudo apt-get update && \
88+
sudo DEBIAN_FRONTEND=noninteractive \
89+
apt-get install -y --no-install-recommends \
90+
ca-certificates \
91+
openjdk-17-jdk \
92+
openjdk-17-jdk-headless \
93+
coreutils autoconf libtool pkg-config \
94+
yasm
95+
96+
- name: build deps
97+
run: |
98+
ls -al
99+
id
100+
pwd
101+
./circle_scripts/deps_linux.sh
102+
103+
- name: build jni lib
104+
run: |
105+
ls -al
106+
id
107+
pwd
108+
./circle_scripts/java_jni_lib_linux.sh
109+
110+
- name: sha hash of jni lib
111+
run: |
112+
sha256sum /Users/runner/ToxAndroidRefImpl/jni-c-toxcore/libjni-c-toxcore.jnilib || echo "ignore"
113+
114+
- name: Upload artifact
115+
uses: actions/upload-artifact@v3
116+
with:
117+
name: libjni-c-toxcore.so
118+
path: libjni-c-toxcore.so
119+
- name: Upload to nightly release
120+
uses: ncipollo/release-action@v1
121+
if: github.ref == 'refs/heads/master'
122+
with:
123+
allowUpdates: true
124+
tag: nightly
125+
omitBodyDuringUpdate: true
126+
omitNameDuringUpdate: true
127+
prerelease: true
128+
replacesArtifacts: true
129+
token: ${{ secrets.GITHUB_TOKEN }}
130+
artifacts: "libjni-c-toxcore.so"
131+
132+
133+
build-windows-jni-artifact:
134+
name: JNI Artifact Windows Build
135+
runs-on: ubuntu-22.04
136+
permissions:
137+
contents: write
138+
steps:
139+
- uses: actions/checkout@v3
140+
141+
- name: install deps
142+
run: |
143+
sudo apt-get update && \
144+
sudo DEBIAN_FRONTEND=noninteractive \
145+
apt-get install -y --no-install-recommends \
146+
ca-certificates \
147+
yasm \
148+
openjdk-17-jdk \
149+
openjdk-17-jdk-headless \
150+
coreutils autoconf libtool pkg-config \
151+
gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 \
152+
mingw-w64-tools pkg-config-mingw-w64-x86-64 win-iconv-mingw-w64-dev \
153+
mingw-w64-x86-64-dev
154+
155+
156+
- name: build deps
157+
run: |
158+
ls -al
159+
id
160+
pwd
161+
./circle_scripts/deps_win.sh
162+
163+
- name: build jni lib
164+
run: |
165+
ls -al
166+
id
167+
pwd
168+
./circle_scripts/java_jni_lib_win.sh
169+
170+
- name: sha hash of jni lib
171+
run: |
172+
sha256sum /Users/runner/ToxAndroidRefImpl/jni-c-toxcore/libjni-c-toxcore.jnilib || echo "ignore"
173+
174+
- name: Upload artifact
175+
uses: actions/upload-artifact@v3
176+
with:
177+
name: jni-c-toxcore.dll
178+
path: jni-c-toxcore.dll
179+
- name: Upload to nightly release
180+
uses: ncipollo/release-action@v1
181+
if: github.ref == 'refs/heads/master'
182+
with:
183+
allowUpdates: true
184+
tag: nightly
185+
omitBodyDuringUpdate: true
186+
omitNameDuringUpdate: true
187+
prerelease: true
188+
replacesArtifacts: true
189+
token: ${{ secrets.GITHUB_TOKEN }}
190+
artifacts: "jni-c-toxcore.dll"
191+

.github/workflows/jni_macos.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

circle_scripts/deps_linux.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ export MAKEFLAGS
2828
WGET_OPTIONS="--timeout=10"
2929
export WGET_OPTIONS
3030

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

@@ -108,6 +107,8 @@ export LDFLAGS=" "
108107
--disable-demuxers \
109108
--disable-parsers \
110109
--disable-bsfs \
110+
--disable-libxcb \
111+
--disable-libxcb-shm \
111112
--enable-parser=h264 \
112113
--enable-decoder=h264 || exit 1
113114

@@ -253,7 +254,7 @@ cd "$_SRC_"
253254
# seems man pages are not always built. but who needs those
254255
touch nasm.1
255256
touch ndisasm.1
256-
make install
257+
sudo make install
257258

258259
type -a nasm
259260

0 commit comments

Comments
 (0)