diff --git a/.github/workflows/jni_libs.yml b/.github/workflows/jni_libs.yml new file mode 100644 index 00000000..11277095 --- /dev/null +++ b/.github/workflows/jni_libs.yml @@ -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" + diff --git a/.github/workflows/jni_macos.yml b/.github/workflows/jni_macos.yml deleted file mode 100644 index 6836192a..00000000 --- a/.github/workflows/jni_macos.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: JNI Lib - -on: - workflow_dispatch: - inputs: - version: - description: dummy - default: dummy - -defaults: - run: - shell: bash - -jobs: - - build-macos-nightly-artifact: - name: Nightly 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 norun - - - name: sha hash of jni lib - run: | - sha256sum /Users/runner/ToxAndroidRefImpl/jni-c-toxcore/libjni-c-toxcore.jnilib || echo "ignore" - 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" - - - diff --git a/circle_scripts/deps_linux.sh b/circle_scripts/deps_linux.sh index a83d5616..6cac307b 100755 --- a/circle_scripts/deps_linux.sh +++ b/circle_scripts/deps_linux.sh @@ -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 ------------ @@ -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 @@ -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 diff --git a/circle_scripts/deps_win.sh b/circle_scripts/deps_win.sh index 0d555f9b..881e041c 100755 --- a/circle_scripts/deps_win.sh +++ b/circle_scripts/deps_win.sh @@ -31,8 +31,8 @@ export WGET_OPTIONS ARCH="x86_64" export ARCH -export CXXFLAGS_ADDON="-O2 -g -fPIC" -export CFLAGS_ADDON="-O2 -g -fPIC" +export CXXFLAGS_ADDON="-O2 -g -fPIC -D_FORTIFY_SOURCE=2 -fstack-protector-strong" +export CFLAGS_ADDON="-O2 -g -fPIC -D_FORTIFY_SOURCE=2 -fstack-protector-strong" export CFLAGS_ADDON_MORE="--param=ssp-buffer-size=1 -fstack-protector-all" # ----------- config ------------ @@ -42,7 +42,7 @@ NASM_VERSION="nasm-2.16.01" FFMPEG_VERSION="n6.0" OPUS_VERSION="v1.4" SODIUM_VERSION="1.0.19" -VPX_VERSION="v1.13.3" +VPX_VERSION="v1.13.1" _X264_VERSION_="baee400fa9ced6f5481a728138fed6e867b0ff7f" # ------- deps verisions --------- @@ -64,14 +64,16 @@ tar -xf "ffmpeg_""$FFMPEG_FILENAME" rm -f "ffmpeg"*.tar.* cd *mpeg*/ + export CXXFLAGS=${CXXFLAGS_ADDON} + export CFLAGS=${CFLAGS_ADDON} ./configure --arch="$ARCH" \ --enable-gpl \ --prefix="$_INST_" \ --target-os="mingw32" \ --cross-prefix="$ARCH-w64-mingw32-" \ --pkg-config="pkg-config" \ - --extra-cflags="-static -O2 -g0" \ - --extra-ldflags="-lm -static" \ + --extra-cflags="-static -O2 -g0 $CFLAGS_ADDON" \ + --extra-ldflags="-lm -static $CFLAGS_ADDON" \ --pkg-config-flags="--static" \ --disable-swscale \ --disable-network \ @@ -117,6 +119,8 @@ cd *mpeg*/ make -j || exit 1 make install + unset CXXFLAGS + unset CFLAGS cd "$_HOME_" @@ -137,7 +141,9 @@ rm -f "opus"*.tar.gz cd opus*/ ./autogen.sh - CFLAGS="-O2 -g0" ./configure --host="$ARCH-w64-mingw32" \ + export CXXFLAGS=${CXXFLAGS_ADDON} + export CFLAGS=${CFLAGS_ADDON} + ./configure --host="$ARCH-w64-mingw32" \ --prefix="$_INST_" \ --disable-shared \ --enable-static \ @@ -146,6 +152,8 @@ cd opus*/ --disable-doc || exit 1 make || exit 1 make install + unset CXXFLAGS + unset CFLAGS cd "$_HOME_" @@ -165,6 +173,8 @@ wget $WGET_OPTIONS "https://download.libsodium.org/libsodium/releases/$SODIUM_FI tar -xf "$SODIUM_FILENAME" cd libsodium*/ + export CXXFLAGS=${CXXFLAGS_ADDON} + export CFLAGS=${CFLAGS_ADDON} ./configure --host="$ARCH-w64-mingw32" \ --prefix="$_INST_" \ --disable-shared \ @@ -173,6 +183,8 @@ cd libsodium*/ make || exit 1 make install + unset CXXFLAGS + unset CFLAGS cd "$_HOME_" @@ -185,13 +197,15 @@ if [ 1 == 1 ]; then cd "$_SRC_" -VPX_FILENAME="libvpx-$VPX_VERSION.tar.gz" -rm -f libvpx-*.tar.gz -wget $WGET_OPTIONS "https://github.com/webmproject/libvpx/archive/$VPX_VERSION.tar.gz" -O "$VPX_FILENAME" +VPX_FILENAME="$VPX_VERSION.tar.gz" + +rm -f *.tar.gz +wget $WGET_OPTIONS "https://github.com/webmproject/libvpx/archive/refs/tags/""$VPX_VERSION"".tar.gz" -O "$VPX_FILENAME" tar -xf "$VPX_FILENAME" cd libvpx*/ - + export CXXFLAGS=${CXXFLAGS_ADDON} + export CFLAGS=${CFLAGS_ADDON} VPX_TARGET="x86_64-win64-gcc" CROSS="$ARCH-w64-mingw32-" ./configure --target="$VPX_TARGET" \ --prefix="$_INST_" \ @@ -210,6 +224,8 @@ cd libvpx*/ make || exit 1 make install + unset CXXFLAGS + unset CFLAGS cd "$_HOME_" @@ -237,7 +253,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 @@ -261,6 +277,9 @@ cd x264/ git checkout "$_X264_VERSION_" export CC=x86_64-w64-mingw32-gcc-win32 export WINDRES=x86_64-w64-mingw32-windres + + export CXXFLAGS=${CXXFLAGS_ADDON} + export CFLAGS=${CFLAGS_ADDON} CROSS="$ARCH-w64-mingw32-" ./configure --host="$ARCH-w64-mingw32" \ --prefix="$_INST_" \ --disable-opencl \ @@ -273,6 +292,8 @@ cd x264/ make || exit 1 make install + unset CXXFLAGS + unset CFLAGS cd "$_HOME_" @@ -311,7 +332,8 @@ cat toxcore/tox.h | grep 'TOX_GIT_COMMIT_HASH' autoreconf -fi ./configure \ - CFLAGS=" -O2 -g -DTOX_CAPABILITIES_ACTIVE " \ + CXXFLAGS="$CXXFLAGS_ADDON" \ + CFLAGS="-fPIC $CFLAGS_ADDON $CFLAGS_MORE -DTOX_CAPABILITIES_ACTIVE" \ --prefix="$_INST_" \ --disable-soname-versions \ --host="$ARCH-w64-mingw32" \ @@ -321,7 +343,8 @@ autoreconf -fi export V=1 VERBOSE=1;make || exit 1 make install - + unset CXXFLAGS + unset CFLAGS cd "$_HOME_" # ---------- c-toxcore --------- diff --git a/circle_scripts/java_jni_lib_linux.sh b/circle_scripts/java_jni_lib_linux.sh index 3584fede..fb090f70 100755 --- a/circle_scripts/java_jni_lib_linux.sh +++ b/circle_scripts/java_jni_lib_linux.sh @@ -39,18 +39,11 @@ echo "--------------" ## --------------------------- -mkdir -p /root/work/ -cd /root/work/ git clone https://github.com/zoff99/ToxAndroidRefImpl -cd /root/work/ToxAndroidRefImpl/jni-c-toxcore/ +cp -v ToxAndroidRefImpl/jni-c-toxcore/*.c ./ pwd ls -al - -if [ "$1""x" == "localx" ]; then - cp -av /c-toxcore/jni-c-toxcore.c jni-c-toxcore.c -fi - ## --------------------------- echo "JAVADIR1------------------" @@ -61,7 +54,7 @@ echo "JAVADIR2------------------" find /usr -name 'jni_md.h' echo "JAVADIR2------------------" -dirname $(find /usr -name 'jni.h' 2>/dev/null|grep -v 'libavcodec'|head -1) > /tmp/xx1 +dirname $(find /usr -name 'jni.h' 2>/dev/null|grep -v 'libavcodec'|grep -v 'android'|head -1) > /tmp/xx1 dirname $(find /usr -name 'jni_md.h' 2>/dev/null|head -1) > /tmp/xx2 export JAVADIR1=$(cat /tmp/xx1) export JAVADIR2=$(cat /tmp/xx2) @@ -69,8 +62,7 @@ echo "JAVADIR1:""$JAVADIR1" echo "JAVADIR2:""$JAVADIR2" -FLAGS_ASAN='-fsanitize=address -fno-omit-frame-pointer' # -static-libasan' -CFLAGS_ADDON='-O2 -g -fPIC' +CFLAGS_ADDON='-O2 -g -fPIC -D_FORTIFY_SOURCE=2' CFLAGS_MORE="--param=ssp-buffer-size=1 -fstack-protector-all -std=gnu99 -I$_INST_/include/ -L$_INST_/lib" # if [ "$1""x" == "localx" ]; then @@ -105,9 +97,10 @@ $_INST_/lib/libsodium.a \ -shared \ -Wl,-soname,libjni-c-toxcore.so -o libjni-c-toxcore.so || exit 1 +sha256sum /home/runner/work/trifa_material/trifa_material/libjni-c-toxcore.so + ls -al libjni-c-toxcore.so || exit 1 pwd file libjni-c-toxcore.so -cp -a libjni-c-toxcore.so /artefacts/ || exit 1 diff --git a/circle_scripts/java_jni_lib_macos.sh b/circle_scripts/java_jni_lib_macos.sh index 939e5f5e..50e77109 100755 --- a/circle_scripts/java_jni_lib_macos.sh +++ b/circle_scripts/java_jni_lib_macos.sh @@ -132,58 +132,6 @@ if [ -e /usr/bin/nasm ]; then ls -hal libjni-c-toxcore.jnilib echo "-------- DONE --------" else - -if [ "$1""x" == "norunx" ]; then - exit 0 + : fi -cp -av libjni-c-toxcore.jnilib /Users/runner/work/java_toxclient_example/java_toxclient_example/java_ref_client/app/src/main/java/ || exit 1 -cp -av libjni-c-toxcore.jnilib /Users/runner/work/java_toxclient_example/java_toxclient_example/trifa_desktop/app/src/main/java/ || exit 1 - -# -------------- now compile the JNI lib ---------------------- - -export JAVA_HOME=$(/usr/libexec/java_home -v11) -java -version -$JAVA_HOME/bin/java -version -$JAVA_HOME/bin/javac -version - -# --------- compile java example --------- -#cd /Users/runner/work/java_toxclient_example/java_toxclient_example/java_ref_client/app/src/main/java/ -#$JAVA_HOME/bin/javac com/zoffcc/applications/trifa/ToxVars.java -#$JAVA_HOME/bin/javac com/zoffcc/applications/trifa/TRIFAGlobals.java -#$JAVA_HOME/bin/javac com/zoffcc/applications/trifa/MainActivity.java -#$JAVA_HOME/bin/javac com/zoffcc/applications/trifa/TrifaToxService.java -# --------- package java example --------- -#cd /Users/runner/work/java_toxclient_example/java_toxclient_example/java_ref_client/app/src/main/java/ - - -# --------- compile java example --------- -cd /Users/runner/work/java_toxclient_example/java_toxclient_example/trifa_desktop/app/src/main/java/ -$JAVA_HOME/bin/javac \ --classpath ".:json-20210307.jar:emoji-java-5.1.1.jar:sqlite-jdbc-3.34.0.jar:webcam-capture-0.3.12.jar:bridj-0.7.0.jar:slf4j-api-1.7.2.jar:flatlaf-1.0.jar" \ -./com/zoffcc/applications/trifa/EmojiFrame.java ./com/kevinnovate/jemojitable/EmojiTable.java ./com/zoffcc/applications/trifa/OperatingSystem.java ./com/zoffcc/applications/trifa/TRIFAGlobals.java ./com/zoffcc/applications/trifa/Table.java ./com/zoffcc/applications/trifa/OnConflict.java ./com/zoffcc/applications/trifa/CombinedFriendsAndConferences.java ./com/zoffcc/applications/trifa/OrmaDatabase.java ./com/zoffcc/applications/trifa/HelperGeneric.java ./com/zoffcc/applications/trifa/ConferencePeerCacheDB.java ./com/zoffcc/applications/trifa/PopupToxIDQrcode.java ./com/zoffcc/applications/trifa/Index.java ./com/zoffcc/applications/trifa/AudioFrame.java ./com/zoffcc/applications/trifa/Filetransfer.java ./com/zoffcc/applications/trifa/FullscreenToggleAction.java ./com/zoffcc/applications/trifa/Nullable.java ./com/zoffcc/applications/trifa/Column.java ./com/zoffcc/applications/trifa/FriendList.java ./com/zoffcc/applications/trifa/ConferenceMessage.java ./com/zoffcc/applications/trifa/SingleComponentAspectRatioKeeperLayout.java ./com/zoffcc/applications/trifa/HelperFriend.java ./com/zoffcc/applications/trifa/JPictureBox.java ./com/zoffcc/applications/trifa/FileDB.java ./com/zoffcc/applications/trifa/MainActivity.java ./com/zoffcc/applications/trifa/TrifaToxService.java ./com/zoffcc/applications/trifa/SettingsActivity.java ./com/zoffcc/applications/trifa/MessageListFragmentJ.java ./com/zoffcc/applications/trifa/AudioSelectOutBox.java ./com/zoffcc/applications/trifa/ByteBufferCompat.java ./com/zoffcc/applications/trifa/MessageListFragmentJInfo.java ./com/zoffcc/applications/trifa/AudioBar.java ./com/zoffcc/applications/trifa/HelperMessage.java ./com/zoffcc/applications/trifa/VideoOutFrame.java ./com/zoffcc/applications/trifa/ConferenceDB.java ./com/zoffcc/applications/trifa/Renderer_MessageList.java ./com/zoffcc/applications/trifa/FriendListFragmentJ.java ./com/zoffcc/applications/trifa/TrifaSetPatternActivity.java ./com/zoffcc/applications/trifa/AudioSelectionRenderer.java ./com/zoffcc/applications/trifa/Callstate.java ./com/zoffcc/applications/trifa/Toast.java ./com/zoffcc/applications/trifa/Log.java ./com/zoffcc/applications/trifa/HelperFiletransfer.java ./com/zoffcc/applications/trifa/PrimaryKey.java ./com/zoffcc/applications/trifa/RelayListDB.java ./com/zoffcc/applications/trifa/Renderer_FriendsAndConfsList.java ./com/zoffcc/applications/trifa/Message.java ./com/zoffcc/applications/trifa/ToxVars.java ./com/zoffcc/applications/trifa/VideoInFrame.java ./com/zoffcc/applications/trifa/ConferenceMessageListFragmentJ.java ./com/zoffcc/applications/trifa/HelperConference.java ./com/zoffcc/applications/trifa/AudioSelectInBox.java ./com/zoffcc/applications/trifa/ChatColors.java ./com/zoffcc/applications/trifa/Renderer_ConfMessageList.java ./com/zoffcc/applications/trifa/TRIFADatabaseGlobalsNew.java ./com/zoffcc/applications/trifa/HelperOSFile.java ./com/zoffcc/applications/trifa/Screenshot.java ./com/zoffcc/applications/trifa/BootstrapNodeEntryDB.java ./com/zoffcc/applications/trifa/HelperRelay.java ./com/github/sarxos/webcam/ds/ffmpegcli/FFmpegScreenDevice.java ./com/github/sarxos/webcam/ds/ffmpegcli/impl/VideoDeviceFilenameFilter.java ./com/github/sarxos/webcam/ds/ffmpegcli/FFmpegScreenDriver.java ./org/imgscalr/Scalr.java ./io/nayuki/qrcodegen/package-info.java ./io/nayuki/qrcodegen/DataTooLongException.java ./io/nayuki/qrcodegen/QrSegmentAdvanced.java ./io/nayuki/qrcodegen/BitBuffer.java ./io/nayuki/qrcodegen/QrCodeGeneratorWorker.java ./io/nayuki/qrcodegen/QrCode.java ./io/nayuki/qrcodegen/QrSegment.java ./io/nayuki/qrcodegen/QrCodeGeneratorDemo.java -# --------- package java example --------- - -mkdir -p /Users/runner/work/artefacts/ -tar -cvf /Users/runner/work/artefacts/install_macos.tar com assets i18n *.sh *.jnilib *.jar -# --------- run test java application --------- -$JAVA_HOME/bin/java -Djava.library.path="." \ --classpath ".:json-20210307.jar:emoji-java-5.1.1.jar:sqlite-jdbc-3.34.0.jar:webcam-capture-0.3.12.jar:bridj-0.7.0.jar:slf4j-api-1.7.2.jar:flatlaf-1.0.jar" \ -com.zoffcc.applications.trifa.MainActivity > trifa.log 2>&1 & -# --------- run test java application --------- -sleep 40 -cat ./trifa.log|head -20 -echo -echo -cat ./trifa.log | grep 'MyToxID:' | cut -d':' -f 8 -echo -echo - -screencapture -T 1 -x -t png /Users/runner/screen101.png & -sudo killall NotificationCenter & -screencapture -x -t png /Users/runner/screen102.png -screencapture -x -t png /Users/runner/screen103.png -sleep 5 -screencapture -x -t png /Users/runner/screen104.png - -fi diff --git a/circle_scripts/java_jni_lib_non_root_local_build.sh b/circle_scripts/java_jni_lib_non_root_local_build.sh deleted file mode 100755 index ca1f3eed..00000000 --- a/circle_scripts/java_jni_lib_non_root_local_build.sh +++ /dev/null @@ -1,173 +0,0 @@ -#! /bin/bash - -# # -> for docker run -# docker run -ti --rm ubuntu:20.04 /bin/bash -# -# # -> install dependencies -# apt-get update -# apt-get install default-jdk ca-certificates libconfig-dev wget unzip zip automake autotools-dev build-essential check checkinstall libtool pkg-config rsync git ffmpeg libavcodec-dev libavdevice-dev libsodium-dev libvpx-dev libopus-dev libx264-dev clang -# -# # -> add local user and change to that user -# useradd -m -s /bin/bash user2 -# su - user2 -# # -> then run this script as "user2" - - -_HOME_="$(pwd)" -export _HOME_ - -id -a -pwd -ls -al - -_CTC_SRC_DIR_="$_HOME_/work/c-toxcore" -export _CTC_SRC_DIR_ - -export _SRC_=$_HOME_/src/ -export _INST_=$_HOME_/inst/ - - -export CF2=" -O2 -g3" -export CF3=" " -export VV1=" " # VERBOSE=1 V=1 " - - -mkdir -p $_SRC_ -mkdir -p $_INST_ -mkdir -p $_CTC_SRC_DIR_ - -export LD_LIBRARY_PATH=$_INST_/lib/ -export PKG_CONFIG_PATH=$_INST_/lib/pkgconfig - -mkdir -p $_HOME_/workspace/data/ - -mkdir -p $_HOME_/work/ -cd $_HOME_/work/ -git clone https://github.com/zoff99/c-toxcore "$_CTC_SRC_DIR_"/ - -cd "$_CTC_SRC_DIR_"/ -pwd -ls -al - -git checkout zoff99/zoxcore_local_fork - -./autogen.sh - -make clean -export CFLAGS_=" $CF2 -D_GNU_SOURCE -DTOX_CAPABILITIES_ACTIVE -I$_INST_/include/ -O2 -g3 -fno-omit-frame-pointer -fstack-protector-all -fPIC " -export CFLAGS="$CFLAGS_" -# export CFLAGS=" $CFLAGS -Werror=div-by-zero -Werror=format=2 -Werror=implicit-function-declaration " -export LDFLAGS="-L$_INST_/lib -fPIC " - -./configure \ ---prefix=$_INST_ \ ---disable-soname-versions --disable-testing --disable-shared -make -j$(nproc) || exit 1 -make install - -export CFLAGS=" $CFLAGS_ -fPIC " -export CXXFLAGS=" $CFLAGS_ -fPIC " -export LDFLAGS=" $LDFLAGS_ -fPIC " -# timeout -k 242 240 make V=1 -j20 check || exit 0 # tests fail too often on CI -> don't error out on test failures - - - -# -------------- now compile the JNI lib ---------------------- - -cd $_HOME_/work/ -pwd -ls -al - - -echo "--------------" -ls -al $_INST_/lib/libtoxcore.a -echo "--------------" - - -add_config_flag() { CONFIG_FLAGS="$CONFIG_FLAGS $@"; } -add_c_flag() { C_FLAGS="$C_FLAGS $@"; } -add_cxx_flag() { CXX_FLAGS="$CXX_FLAGS $@"; } -add_ld_flag() { LD_FLAGS="$LD_FLAGS $@"; } -add_flag() { add_c_flag "$@"; add_cxx_flag "$@"; } - -CONFIG_FLAGS="" -C_FLAGS="" -CXX_FLAGS="" -LD_FLAGS="" - -unset CFLAGS -unset CXXFLAGS -unset CPPFLAGS -unset LDFLAGS - -# Optimisation flags. -add_flag -O2 -march=native -add_flag -g3 - - -## --------------------------- -cd $_HOME_/work/ -git clone https://github.com/zoff99/ToxAndroidRefImpl -cd $_HOME_/work/ToxAndroidRefImpl/jni-c-toxcore/ -pwd -ls -al -## --------------------------- - -echo "JAVADIR1------------------" -find /usr -name 'jni.h' -echo "JAVADIR1------------------" - -echo "JAVADIR2------------------" -find /usr -name 'jni_md.h' -echo "JAVADIR2------------------" - -dirname $(find /usr -name 'jni.h' 2>/dev/null|grep -v 'libavcodec'|head -1) > /tmp/xx1 -dirname $(find /usr -name 'jni_md.h' 2>/dev/null|head -1) > /tmp/xx2 -export JAVADIR1=$(cat /tmp/xx1) -export JAVADIR2=$(cat /tmp/xx2) -echo "JAVADIR1:""$JAVADIR1" -echo "JAVADIR2:""$JAVADIR2" - -# export ASAN_CLANG_FLAGS=" -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -lasan " -export ASAN_CLANG_FLAGS=" " -export CFLAGS=" -fPIC -std=gnu99 -I$_INST_/include/ -L$_INST_/lib -fstack-protector-all " - - -clang_="clang" - - -$clang_ $CFLAGS \ --DJAVA_LINUX \ -$ASAN_CLANG_FLAGS \ -$C_FLAGS $CXX_FLAGS $LD_FLAGS \ --D_FILE_OFFSET_BITS=64 -D__USE_GNU=1 \ --I$JAVADIR1/ \ --I$JAVADIR2/ \ --L/usr/local/lib \ --I/usr/local/include/ \ -jni-c-toxcore.c \ --Wl,-whole-archive \ -$_INST_/lib/libtoxcore.a \ -$_INST_/lib/libtoxav.a \ -$_INST_/lib/libtoxencryptsave.a \ --Wl,-no-whole-archive \ --lopus \ --lvpx \ --lx264 \ --lavcodec \ --lavutil \ --lsodium \ --shared \ --lpthread \ --lm \ --ldl \ --Wl,-soname,libjni-c-toxcore.so -o libjni-c-toxcore.so || exit 1 - - -ls -al libjni-c-toxcore.so || exit 1 -pwd -file libjni-c-toxcore.so - - -# git clone https://github.com/zoff99/java_toxclient_example - diff --git a/circle_scripts/java_jni_lib_win.sh b/circle_scripts/java_jni_lib_win.sh index 041bec57..00f6c728 100755 --- a/circle_scripts/java_jni_lib_win.sh +++ b/circle_scripts/java_jni_lib_win.sh @@ -41,18 +41,11 @@ echo "--------------" ## --------------------------- -mkdir -p /root/work/ -cd /root/work/ git clone https://github.com/zoff99/ToxAndroidRefImpl -cd /root/work/ToxAndroidRefImpl/jni-c-toxcore/ +cp -v ToxAndroidRefImpl/jni-c-toxcore/*.c ./ pwd ls -al - -if [ "$1""x" == "localx" ]; then - cp -av /c-toxcore/jni-c-toxcore.c jni-c-toxcore.c -fi - ## --------------------------- echo "JAVADIR1------------------" @@ -63,14 +56,14 @@ echo "JAVADIR2------------------" find /usr -name 'jni_md.h' echo "JAVADIR2------------------" -dirname $(find /usr -name 'jni.h' 2>/dev/null|grep -v 'libavcodec'|head -1) > /tmp/xx1 +dirname $(find /usr -name 'jni.h' 2>/dev/null|grep -v 'libavcodec'|grep -v 'android'|head -1) > /tmp/xx1 dirname $(find /usr -name 'jni_md.h' 2>/dev/null|head -1) > /tmp/xx2 export JAVADIR1=$(cat /tmp/xx1) export JAVADIR2=$(cat /tmp/xx2) echo "JAVADIR1:""$JAVADIR1" echo "JAVADIR2:""$JAVADIR2" -export CFLAGS=" -fPIC -std=gnu99 -I$_INST_/include/ -L$_INST_/lib -fstack-protector-all " +export CFLAGS=" -fPIC -D_FORTIFY_SOURCE=2 -std=gnu99 -I$_INST_/include/ -L$_INST_/lib -fstack-protector-all " x86_64-w64-mingw32-gcc-win32 $CFLAGS \ -Wall -D_JNI_IMPLEMENTATION_ -Wl,-kill-at \ @@ -102,22 +95,11 @@ $_INST_/lib/libsodium.a \ -lm \ -o jni-c-toxcore.dll || exit 1 +sha256sum /home/runner/work/trifa_material/trifa_material/jni-c-toxcore.dll ls -al jni-c-toxcore.dll || exit 1 pwd file jni-c-toxcore.dll -cp -av jni-c-toxcore.dll /workspace/data/java_ref_client/app/src/main/java/ || exit 1 - -# -------------- now compile the JNI lib ---------------------- - -# --------- compile java example --------- -cd /workspace/data/java_ref_client/app/src/main/java/ -javac com/zoffcc/applications/trifa/ToxVars.java -javac com/zoffcc/applications/trifa/TRIFAGlobals.java -javac com/zoffcc/applications/trifa/MainActivity.java -javac com/zoffcc/applications/trifa/TrifaToxService.java -# --------- package java example --------- -cd /workspace/data/java_ref_client/app/src/main/java/ -tar -cvf /artefacts/install_win.tar com *.dll *.sh || tar -cvf ~/work/artefacts/install_win.tar com *.dll *.sh +