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 fc8e155 commit 2ebd133
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@ on:
jobs:

build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ubuntu, macos]

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

steps:
- name: Placeholder
run: true
- uses: actions/checkout@v3
- uses: ilammy/setup-nasm@v1

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

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: dcraw-${{ matrix.platform }}.tgz
path: dcraw.tgz
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build*/
libjpeg-turbo*/
50 changes: 50 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

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
fi

if [[ "$OSTYPE" == "darwin"* ]]; then

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

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

0 comments on commit 2ebd133

Please sign in to comment.