From e67639d8048f4f6c0b9710b2cd9b210978e57742 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Thu, 22 Dec 2022 12:57:12 +0000 Subject: [PATCH] Build action. --- .github/workflows/build.sh | 35 +++++++++++++++++++++++++++++++++++ .github/workflows/dist.yml | 15 ++++++++++++--- .gitignore | 2 ++ 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100755 .github/workflows/build.sh create mode 100644 .gitignore diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh new file mode 100755 index 0000000..e85f0f1 --- /dev/null +++ b/.github/workflows/build.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +set -Eeuo pipefail + +JVER=3.0.3 +if [ ! -d "libjpeg-turbo-$JVER" ]; then + url="https://github.com/libjpeg-turbo/libjpeg-turbo/releases/download/$JVER/libjpeg-turbo-$JVER.tar.gz" + curl -#L "$url" | tar xz +fi + +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 + +tar c dcraw | gzip -9 > dcraw.tgz \ No newline at end of file diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index b768a2c..f79b7ea 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -6,8 +6,17 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - - name: Placeholder - run: true \ No newline at end of file + - uses: actions/checkout@v4 + - uses: ilammy/setup-nasm@v1 + + - name: Build artifact + run: .github/workflows/build.sh + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: dcraw-macos.tgz + path: dcraw.tgz \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4a2a255 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build*/ +libjpeg-turbo*/ \ No newline at end of file