]> git.cameronkatri.com Git - ldid.git/blobdiff - .github/workflows/build.yml
Use OpenSSL 1.1.1 in GH actions for now
[ldid.git] / .github / workflows / build.yml
index abbc00b5e9ab23b54d618148a8f3e9909b5757a7..6315017bae0d5a71ee08db3c71c0f7505fc97a0a 100644 (file)
@@ -1,7 +1,17 @@
 name: build
 on:
   push:
+    paths:
+      - '*.c'
+      - '*.cpp'
+      - '.github/workflows/*'
+      - 'Makefile'
   pull_request:
+    paths:
+      - '*.c'
+      - '*.cpp'
+      - '.github/workflows/*'
+      - 'Makefile'
   workflow_dispatch:
   release:
     types:
@@ -9,7 +19,7 @@ on:
 
 env:
   LIBPLIST_VERSION: 2.2.0
-  OPENSSL_VERSION: 3.0.0
+  OPENSSL_VERSION: 1.1.1n
   SCCACHE_VERSION: 0.2.15
 
 jobs:
@@ -18,10 +28,7 @@ jobs:
     strategy:
       matrix:
         triple:
-        - arm-linux-musleabi
         - aarch64-linux-musl
-        - i486-linux-musl
-        - riscv64-linux-musl
         - x86_64-linux-musl
     env:
       TOOLCHAIN: ${{ matrix.triple }}-cross
@@ -66,7 +73,11 @@ jobs:
         echo "${HOME}/${TOOLCHAIN}/bin" >> $GITHUB_PATH
         echo "CC=sccache ${TRIPLE}-gcc" >> $GITHUB_ENV
         echo "CXX=sccache ${TRIPLE}-g++" >> $GITHUB_ENV
-        echo "CFLAGS=-Os -static" >> $GITHUB_ENV
+        echo "AR=${TRIPLE}-gcc-ar" >> $GITHUB_ENV
+        echo "NM=${TRIPLE}-gcc-nm" >> $GITHUB_ENV
+        echo "RANLIB=${TRIPLE}-gcc-ranlib" >> $GITHUB_ENV
+        echo "CFLAGS=-Os -fPIC -fno-pie -no-pie -static -flto -ffunction-sections -fdata-sections" >> $GITHUB_ENV
+        echo "LDFLAGS=-Wl,--gc-sections -Wl,-strip-all -flto" >> $GITHUB_ENV
 
     - name: build libplist
       run: |
@@ -76,39 +87,29 @@ jobs:
         ./configure --host=${TRIPLE} --prefix=/usr --without-cython --enable-static --disable-shared
         make -j$(nproc)
 
-        echo "CFLAGS=${CFLAGS} -I${DEP_PATH}/libplist-${LIBPLIST_VERSION}/include" >> $GITHUB_ENV
+        echo "CPPFLAGS=${CPPFLAGS} -I${DEP_PATH}/libplist-${LIBPLIST_VERSION}/include" >> $GITHUB_ENV
         echo "LIBPLIST_LIB=${DEP_PATH}/libplist-${LIBPLIST_VERSION}/src/.libs/libplist-2.0.a" >> $GITHUB_ENV
 
     - name: build openssl
       run: |
         export PLATFORM="linux-${ARCH}"
-        case ${ARCH} in
-          arm)
-            export PLATFORM="linux-generic32"
-            ;;
-          i486)
-            export PLATFORM="linux-x86"
-            ;;
-          riscv64)
-            export PLATFORM="linux64-riscv64"
-            ;;
-        esac
 
         wget -q -nc -P ${DOWNLOAD_PATH} https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
         tar xf ${DOWNLOAD_PATH}/openssl-${OPENSSL_VERSION}.tar.gz -C ${DEP_PATH}
         cd ${DEP_PATH}/openssl-${OPENSSL_VERSION}
-        ./config --prefix=/usr --static -static ${PLATFORM}
+        ./Configure --prefix=/usr --static -static ${PLATFORM}
         make -j$(nproc) build_generated libcrypto.a
 
-        echo "CFLAGS=${CFLAGS} -I${DEP_PATH}/openssl-${OPENSSL_VERSION}/include" >> $GITHUB_ENV
+        echo "CPPFLAGS=${CPPFLAGS} -I${DEP_PATH}/openssl-${OPENSSL_VERSION}/include" >> $GITHUB_ENV
         echo "LIBCRYPTO_LIB=${DEP_PATH}/openssl-${OPENSSL_VERSION}/libcrypto.a" >> $GITHUB_ENV
 
     - name: build
       run: |
         export LDID_VERSION=$(echo "$(git describe --tags --abbrev=0)")
-        ${CC} ${CFLAGS} -c -o lookup2.o lookup2.c
-        ${CXX} ${CFLAGS} -c -o ldid.o ldid.cpp -std=c++11 -DLDID_VERSION=\"${LDID_VERSION}\"
-        ${CXX} ${CFLAGS} -std=c++11 ldid.o lookup2.o ${LIBPLIST_LIB} ${LIBCRYPTO_LIB} -o ldid
+        make -j$(nproc) \
+          VERSION="${LDID_VERSION}" \
+          LDFLAGS="-static -static-libstdc++ ${LDFLAGS}" \
+          LIBS="${LIBPLIST_LIB} ${LIBCRYPTO_LIB}"
         ${TRIPLE}-strip ldid
 
     - uses: actions/upload-artifact@v1
@@ -195,7 +196,7 @@ jobs:
         wget -q -nc -P ${DOWNLOAD_PATH} https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
         tar xf ${DOWNLOAD_PATH}/openssl-${OPENSSL_VERSION}.tar.gz -C ${DEP_PATH}
         cd ${DEP_PATH}/openssl-${OPENSSL_VERSION}
-        ./config --prefix=/usr no-shared darwin64-${ARCH}
+        ./Configure --prefix=/usr no-shared darwin64-${ARCH}-cc
         make -j$(sysctl -n hw.ncpu) build_generated libcrypto.a
 
         echo "CFLAGS=${CFLAGS} -I${DEP_PATH}/openssl-${OPENSSL_VERSION}/include" >> $GITHUB_ENV
@@ -204,9 +205,10 @@ jobs:
     - name: build
       run: |
         export LDID_VERSION=$(echo "$(git describe --tags --abbrev=0)")
-        ${CC} ${CFLAGS} -flto=thin -Os -c -o lookup2.o lookup2.c
-        ${CXX} ${CFLAGS} -flto=thin -Os -c -o ldid.o ldid.cpp -std=c++11 -DLDID_VERSION=\"${LDID_VERSION}\"
-        ${CXX} ${LIBPLIST_LIB} ${LIBCRYPTO_LIB} -flto=thin -Os -std=c++11 ldid.o lookup2.o -o ldid
+        make -j$(sysctl -n hw.ncpu) \
+          CFLAGS="${CFLAGS} -flto=thin" \
+          VERSION="${LDID_VERSION}" \
+          LIBS="${LIBPLIST_LIB} ${LIBCRYPTO_LIB}"
         strip ldid
 
     - uses: actions/upload-artifact@v1