-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add CGO tests * Try to install libjpegturbo * Conditionally install libjpeg turbo * Always build with libjpeg turbo * Drop sudo for drew * Add libturbojpeg-dev for linux * Disable CGO for webassembly builds * Improve workflows * Fix library install * Install pkgconfig * Try to find jpeg turbo * Copy header file * Compile libjpegturbo * Change cd in workflow * Fix? * Fix paths * Fix turbo include path * Add start of windows support * Fix windows pdfium download * Try to fix exe * Fix windows build * Try to add include libjpegturbo header * Try to add include libjpegturbo header * Test * Try to install libjpeg turbo * Try to install libjpeg turbo * Add bin path to cgoflags * Try to fix windows * Split op linux cgo and linux musl cgo * Fix linux build * Update readme * Rename workflows, add native workflows * Update readme * Add sleep for libjpeg turbo silent install * Update tests * Try to fix pkgconfig for windows * Add jpegturbo pkg config for musl * Fix libjpegturbo build * Temporarily build artifacts for normal builds * Add more builds * Remove builds
- Loading branch information
Showing
7 changed files
with
405 additions
and
42 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
prefix=/opt/libjpegturbo/libjpeg-turbo-3.0.0 | ||
libdir=/opt/libjpegturbo/libjpeg-turbo-3.0.0/build | ||
includedir=/opt/libjpegturbo/libjpeg-turbo-3.0.0 | ||
|
||
Name: libturbojpeg | ||
Description: A SIMD-accelerated JPEG codec that provides the TurboJPEG API | ||
Version: 3.0.0 | ||
Libs: -L${libdir} -lturbojpeg | ||
Cflags: -I${includedir} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
prefix=D:/opt/pdfium | ||
libdir=D:/opt/pdfium/bin | ||
includedir=D:/opt/pdfium/include | ||
|
||
Name: PDFium | ||
Description: PDFium | ||
Version: 6029 | ||
Requires: | ||
|
||
Libs: -L${libdir} -lpdfium | ||
Cflags: -I${includedir} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
prefix=/opt/pdfium | ||
libdir=/opt/pdfium/lib | ||
includedir=/opt/pdfium/include | ||
|
||
Name: PDFium | ||
Description: PDFium | ||
Version: 6029 | ||
Requires: | ||
|
||
Libs: -L${libdir} -lpdfium | ||
Cflags: -I${includedir} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,37 +4,199 @@ on: | |
release: | ||
types: [created] | ||
|
||
env: | ||
GO_VERSION: "1.21" | ||
PDFIUM_VERSION: "6029" | ||
|
||
jobs: | ||
build: | ||
release-webassembly: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-20.04, macos-latest, windows-latest ] | ||
go: [ "1.21" ] | ||
os: [ ubuntu-latest, macos-latest, windows-latest ] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
CGO_ENABLED: 0 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: Build Linux | ||
if: matrix.os == 'ubuntu-20.04' | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-linux-x64 main.go | ||
GOARCH=amd64 go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-webassembly-linux-amd64 main.go | ||
GOARCH=arm64 go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-webassembly-linux-arm64 main.go | ||
- name: Build MacOS | ||
if: matrix.os == 'macos-latest' | ||
run: | | ||
go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-mac-x64 main.go | ||
GOARCH=amd64 go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-webassembly-mac-amd64 main.go | ||
GOARCH=arm64 go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-webassembly-mac-arm64 main.go | ||
- name: Build Windows | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-windows-x64 main.go | ||
GOARCH=amd64 go build -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-webassembly-windows-amd64 main.go | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: builds | ||
path: artifacts | ||
- uses: AButler/[email protected] | ||
with: | ||
files: 'artifacts/*' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release-cgo-linux: | ||
env: | ||
CGO_ENABLED: 1 | ||
LD_LIBRARY_PATH: "/opt/pdfium/lib" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Set up PDFium library libjpeg-turbo | ||
run: | | ||
sudo curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-linux-x64.tgz -o pdfium-linux-x64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-linux-x64.tgz | ||
sudo rm pdfium-linux-x64.tgz | ||
sudo cp ./.github/workflows/pdfium.pc /usr/lib/pkgconfig/pdfium.pc | ||
sudo apt-get update -y | ||
sudo apt-get install -y libturbojpeg libturbojpeg-dev | ||
- name: Build | ||
run: | | ||
go build -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-native-linux-amd64 main.go | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: builds | ||
path: artifacts | ||
|
||
- uses: AButler/[email protected] | ||
with: | ||
files: 'artifacts/*' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release-cgo-linux-musl: | ||
env: | ||
CGO_ENABLED: 1 | ||
CC: "musl-gcc" | ||
LD_LIBRARY_PATH: "/opt/pdfium/lib:/opt/libjpegturbo/libjpeg-turbo-3.0.0/build" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Set up PDFium library, musl and libjpeg-turbo | ||
run: | | ||
sudo curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-linux-musl-x64.tgz -o pdfium-linux-musl-x64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-linux-musl-x64.tgz | ||
sudo rm pdfium-linux-musl-x64.tgz | ||
sudo cp ./.github/workflows/pdfium.pc /usr/lib/pkgconfig/pdfium.pc | ||
sudo cp ./.github/workflows/libturbojpeg.pc /usr/lib/pkgconfig/libturbojpeg.pc | ||
sudo apt-get update -y | ||
sudo apt-get install -y musl-dev musl-tools | ||
sudo curl -L https://master.dl.sourceforge.net/project/libjpeg-turbo/3.0.0/libjpeg-turbo-3.0.0.tar.gz -o libjpeg-turbo-3.0.0.tar.gz && sudo mkdir /opt/libjpegturbo && sudo tar -C /opt/libjpegturbo -xvf libjpeg-turbo-3.0.0.tar.gz | ||
cd /opt/libjpegturbo/libjpeg-turbo-3.0.0 && sudo mkdir build && cd build | ||
sudo cmake -G"Unix Makefiles" -DCMAKE_C_COMPILER=musl-gcc -DWITH_JPEG8=1 -DCMAKE_BUILD_TYPE=None ../ | ||
sudo make turbojpeg | ||
- name: Build | ||
run: | | ||
go build --ldflags '-linkmode external -extldflags "-fno-PIC -L/opt/libjpegturbo/libjpeg-turbo-3.0.0/build"' -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-native-linux-musl-amd64 main.go | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: builds | ||
path: artifacts | ||
|
||
- uses: AButler/[email protected] | ||
with: | ||
files: 'artifacts/*' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
||
release-cgo-macos: | ||
env: | ||
CGO_ENABLED: 1 | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Set up PDFium library and libjpeg-turbo | ||
run: | | ||
sudo curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-mac-x64.tgz -o pdfium-mac-x64.tgz && sudo mkdir /opt/pdfium && sudo tar -C /opt/pdfium -xvf pdfium-mac-x64.tgz | ||
sudo rm pdfium-mac-x64.tgz | ||
sudo cp ./.github/workflows/pdfium.pc /usr/local/lib/pkgconfig/pdfium.pc | ||
brew install jpeg-turbo | ||
- name: Build | ||
run: | | ||
export LD_LIBRARY_PATH="/opt/pdfium/lib" | ||
go build -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-native-mac-amd64 main.go | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: builds | ||
path: artifacts | ||
|
||
- uses: AButler/[email protected] | ||
with: | ||
files: 'artifacts/*' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release-cgo-windows: | ||
env: | ||
CGO_ENABLED: 1 | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Set up PDFium library and libjpeg-turbo | ||
run: | | ||
curl -L https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F${{ env.PDFIUM_VERSION }}/pdfium-win-x64.tgz -o pdfium-win-x64.tgz | ||
mkdir -p D:\opt\pdfium | ||
tar -C D:\opt\pdfium -xvf pdfium-win-x64.tgz | ||
rm pdfium-win-x64.tgz | ||
mkdir D:\opt\pkgconfig | ||
cp ./.github/workflows/pdfium-windows.pc D:\opt\pkgconfig\pdfium.pc | ||
curl -L https://master.dl.sourceforge.net/project/libjpeg-turbo/3.0.0/libjpeg-turbo-3.0.0-gcc64.exe -o libjpeg-turbo-3.0.0-gcc64.exe | ||
./libjpeg-turbo-3.0.0-gcc64.exe /S | ||
$Folder = 'C:\libjpeg-turbo-gcc64\lib\pkgconfig' | ||
while (!(Test-Path -Path $Folder)) { | ||
"libjpeg-turbo does not exist yet!" | ||
Start-Sleep -s 5 | ||
} | ||
- name: Build | ||
run: | | ||
$env:PKG_CONFIG_PATH = 'D:\opt\pkgconfig;C:\libjpeg-turbo-gcc64\lib\pkgconfig' | ||
$env:Path += ";D:\opt\pdfium\bin;C:\libjpeg-turbo-gcc64\bin" | ||
go build -tags pdfium_experimental,pdfium_cli_use_cgo,pdfium_use_turbojpeg -ldflags "-X 'github.com/klippa-app/pdfium-cli/version.VERSION=${{ github.event.release.name }}'" -o artifacts/pdfium-native-windows-amd64 main.go | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: builds | ||
path: artifacts | ||
|
||
- uses: AButler/[email protected] | ||
with: | ||
files: 'artifacts/*' | ||
|
Oops, something went wrong.