Skip to content

Commit

Permalink
Build action.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncruces committed Mar 27, 2023
1 parent 5c9e1cc commit 3b94a62
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 48 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,16 @@ on:
jobs:

build:
strategy:
matrix:
platform: [ubuntu, macos]

runs-on: ${{ matrix.platform }}-latest
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: ilammy/setup-nasm@v1

- name: Build artifact
run: ./build.sh
shell: bash

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: dcraw-${{ matrix.platform }}.tgz
path: dcraw.tgz
path: dcraw-windows.zip
50 changes: 10 additions & 40 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,17 @@ set -Eeuo pipefail

JVER=2.1.5.1
if [ ! -d "libjpeg-turbo-$JVER" ]; then
url="https://downloads.sourceforge.net/project/libjpeg-turbo/$JVER/libjpeg-turbo-$JVER.tar.gz"
curl -sL "$url" | tar xz
url="https://downloads.sourceforge.net/project/libjpeg-turbo/$JVER/libjpeg-turbo-$JVER-gcc64.exe"
mkdir "libjpeg-turbo-$JVER"
pushd "libjpeg-turbo-$JVER"
curl -sL "$url" > archive.7z
7z x archive.7z
popd
fi

if [[ "$OSTYPE" == "darwin"* ]]; then
gcc -O3 -o dcraw.exe dcraw.c -lws2_32 -DNO_JASPER -DNO_LCMS \
-I"libjpeg-turbo-$JVER/include" "libjpeg-turbo-$JVER/lib/libjpeg.dll.a"

mkdir -p build_arm
pushd build_arm
cmake -G"Unix Makefiles" "../libjpeg-turbo-$JVER" \
-D"CMAKE_OSX_DEPLOYMENT_TARGET=11" \
-D"CMAKE_OSX_ARCHITECTURES=arm64"
make -j jpeg-static
cc -O3 -o dcraw ../dcraw.c -DNO_JASPER -DNO_LCMS \
-I. -I"../libjpeg-turbo-$JVER" libjpeg.a \
--target=arm64-apple-macos11
popd
cp "libjpeg-turbo-$JVER/bin/libjpeg-62.dll" .

mkdir -p build_x86
pushd build_x86
cmake -G"Unix Makefiles" "../libjpeg-turbo-$JVER" \
-D"CMAKE_OSX_DEPLOYMENT_TARGET=10.13" \
-D"CMAKE_OSX_ARCHITECTURES=x86_64"
make -j jpeg-static
cc -O3 -o dcraw ../dcraw.c -DNO_JASPER -DNO_LCMS \
-I. -I"../libjpeg-turbo-$JVER" libjpeg.a \
--target=x86_64-apple-macos10.13
popd

lipo -create -output dcraw build_arm/dcraw build_x86/dcraw

else

mkdir -p build

pushd build
cmake -G"Unix Makefiles" "../libjpeg-turbo-$JVER"
make -j jpeg-static
cc -O3 -o ../dcraw ../dcraw.c -lm -DNO_JASPER -DNO_LCMS \
-I. -I"../libjpeg-turbo-$JVER" libjpeg.a
popd

fi

tar c dcraw | gzip -9 > dcraw.tgz
7z a -mx9 dcraw-windows.zip dcraw.exe libjpeg-62.dll

0 comments on commit 3b94a62

Please sign in to comment.