commit 26700e5b8bfcdcebe22492ba3204a3bb7ca8f38d Author: FriwiDev Date: Sun Oct 24 18:53:10 2021 +0200 Initial commit diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 0000000..b2eb584 --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,30 @@ +name: build-linux + +on: + push: + branches: + - 'master' + +jobs: + amd64: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up QEMU + uses: docker/setup-qemu-action@master + with: + platforms: all + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build + run: | + chmod +x compile_linux.sh + ./compile_linux.sh amd64 diff --git a/DockerfileLinux b/DockerfileLinux new file mode 100644 index 0000000..17d156a --- /dev/null +++ b/DockerfileLinux @@ -0,0 +1,24 @@ +FROM friwidev/jcefdocker:linux-latest AS stage + +#Do you want to manually build cef to customize the build? +#0: Use CEF from prebuilt Spotify repository (supported by CEF-Downloader only for 386 and amd64) +#1: Compile CEF from source +#This value will be ignored when no download is available on this architecture! +ENV BUILD_CEF 0 + +#If you want to build with proprietary codecs, add the following to this variable: +# proprietary_codecs=1 ffmpeg_branding=Chrome +#Warning: Be aware of the legal implications by using proprietary codecs! +#(Not required for mp3/mp4 anymore!) +ENV GYP_DEFINES + +WORKDIR /builder +COPY scripts/run_linux.sh . +RUN chmod +x run_linux.sh +RUN ./run_linux.sh + +#Export built files +FROM scratch AS export-stage +COPY --from=stage /jcef/jcef_build . + + diff --git a/compile_linux.sh b/compile_linux.sh new file mode 100755 index 0000000..398c730 --- /dev/null +++ b/compile_linux.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ $# -eq 0 ] + then + echo "Usage: ./compile_linux.sh [GYP_DEFINES]" + echo "" + echo "architecture: the target architecture to build for. Architectures are the docker architectures (e.g. 386 or amd64)." + echo "GYP_DEFINES: When defined, performs a manual CEF build. Can be used to enable proprietary codec support. Wrap value with quotation marks." + echo " To enable proprietary codecs use: proprietary_codecs=1 ffmpeg_branding=Chrome" + exit 1 +fi + +#Execute buildx with linux dockerfile and output to current directory +docker buildx build . --file DockerfileLinux --output out . + diff --git a/scripts/run_linux.sh b/scripts/run_linux.sh new file mode 100644 index 0000000..4b49e87 --- /dev/null +++ b/scripts/run_linux.sh @@ -0,0 +1,45 @@ +#!/bin/bash +set -e + +# Determine architecture +MACHINE_TYPE=`uname -m` +echo "Building for architecture $MACHINE_TYPE" + +if [ ! -f "/jcef/README.md" ]; then + echo "Did not find existing files to build - cloning..." + git clone https://bitbucket.org/chromiumembedded/java-cef.git /jcef +else + echo "Found existing files to build" +fi + +# Enter the JCEF source code directory. +cd /jcef + +# Create and enter the `jcef_build` directory. +# The `jcef_build` directory name is required by other JCEF tooling +# and should not be changed. +mkdir jcef_build && cd jcef_build + +# Linux: Generate 32/64-bit Unix Makefiles. +cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release .. +# Build native part using ninja. +ninja -j4 + +#Compile JCEF java classes +cd ../tools +chmod +x compile.sh +if [ ${MACHINE_TYPE} == 'x86_64' ]; then + ./compile.sh linux64 +else + ./compile.sh linux32 +fi + +#Generate distribution +chmod +x make_distrib.sh +if [ ${MACHINE_TYPE} == 'x86_64' ]; then + ./make_distrib.sh linux64 +else + ./make_distrib.sh linux32 +fi + + diff --git a/scripts/run_windows.bat b/scripts/run_windows.bat new file mode 100644 index 0000000..0a30fb9 --- /dev/null +++ b/scripts/run_windows.bat @@ -0,0 +1,29 @@ +@echo off + +if "%1"=="32" (echo "Building 32-bit version") ^ +else (echo "Building 64-bit version") + +#Check residency of workdir +cd C: +if exists jcef/README.md (echo "Found existing files to build") ^ +else (echo "Did not find files to build - cloning..." && git clone https://bitbucket.org/chromiumembedded/java-cef jcef) +cd jcef + +#Prepare build dir +#rmdir /S /Q jcef_build +mkdir jcef_build && cd jcef_build + +#Load vcvars +if "%1"=="32" ("C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat") ^ +else ("C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat") + +#Perform build +cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug .. +ninja + +#Compile java classes +cd ../tools +if "%1"=="32" (compile.bat win32) else (compile.bat win64) + +#Create distribution +if "%1"=="32" (make_distrib.bat win32) else (make_distrib.bat win64)