From 75092caced90b01d128291aae8ef576ef7184525 Mon Sep 17 00:00:00 2001 From: Maxim Logaev Date: Tue, 12 Mar 2024 20:01:36 +0300 Subject: [PATCH] Added CI for MSYS2 (MINGW64) (#2) - Use quotes in windows build script; - Added missing gstreamer, webrtc-audio-processing and git; - Added CI for Windows. --------- Signed-off-by: Maxim Logaev --- .github/workflows/build-win64.yml | 26 +++++++++++ build-win64.sh | 76 +++++++++++++++---------------- 2 files changed, 64 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/build-win64.yml diff --git a/.github/workflows/build-win64.yml b/.github/workflows/build-win64.yml new file mode 100644 index 00000000..3ca47c88 --- /dev/null +++ b/.github/workflows/build-win64.yml @@ -0,0 +1,26 @@ +name: Build for Windows +on: [pull_request, push] + +jobs: + build: + runs-on: windows-latest + steps: + - uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: git + - run: git config --global core.autocrlf input + - uses: actions/checkout@v4 + - name: Build Dino + run: | + msys2 -c './build-win64.sh --prepare' + msys2 -c './build-win64.sh' + - name: Build Dino Installer + run: | + msys2 -c './build-win64.sh --build-installer' + - name: Upload Dino Installer + uses: actions/upload-artifact@v4 + with: + name: dino-installer + path: windows-installer/dino-installer.exe diff --git a/build-win64.sh b/build-win64.sh index 3daa15f0..4143a154 100644 --- a/build-win64.sh +++ b/build-win64.sh @@ -1,24 +1,9 @@ #!/bin/bash set -e -DIST_DIR=${PWD}/windows-installer/win64-dist +DIST_DIR="$PWD/windows-installer/win64-dist" JOBS=$NUMBER_OF_PROCESSORS -download_yolort() -{ - file_name=cppwinrt-2.0.210122.3+windows-10.0.19041+yolort-835cd4e.zip - original_folder=${PWD} - - cd plugins\\windows-notification - mkdir -p yolort - cd yolort - curl -L -O https://github.com/LAGonauta/YoloRT/releases/download/v1.0.0/${file_name} - echo "675a6d943c97b4acdbfaa473f68d3241d1798b31a67b5529c8d29fc0176a1707 ${file_name}" | sha256sum --check --status - unzip -o ${file_name} - rm ${file_name} - cd ${original_folder} -} - msg() { echo -e "\e[32m$1\e[0m" @@ -30,6 +15,19 @@ fatal() exit 1 } +download_yolort() +{ + file_name=cppwinrt-2.0.210122.3+windows-10.0.19041+yolort-835cd4e.zip + yolort_dir="$PWD/plugins/windows-notification/yolort" + + rm -rf "$yolort_dir" + mkdir "$yolort_dir" + curl -L -o "$file_name" "https://github.com/LAGonauta/YoloRT/releases/download/v1.0.0/$file_name" + echo "675a6d943c97b4acdbfaa473f68d3241d1798b31a67b5529c8d29fc0176a1707 $file_name" | sha256sum --check --status + unzip -o "$file_name" -d "$yolort_dir" + rm -f "$file_name" +} + prepare() { msg "Installing MINGW64 build dependencies" @@ -51,14 +49,16 @@ prepare() mingw64/mingw-w64-x86_64-gpgme \ mingw64/mingw-w64-x86_64-fontconfig \ mingw64/mingw-w64-x86_64-iso-codes \ + mingw64/mingw-w64-x86_64-gstreamer \ mingw64/mingw-w64-x86_64-gst-plugins-bad \ mingw64/mingw-w64-x86_64-gst-plugins-good \ mingw64/mingw-w64-x86_64-gst-plugins-base \ mingw64/mingw-w64-x86_64-gst-plugins-ugly \ mingw64/mingw-w64-x86_64-nsis \ mingw64/mingw-w64-x86_64-libsignal-protocol-c \ - mingw64/mingw-w64-x86_64-ninja \ mingw64/mingw-w64-x86_64-icu \ + mingw64/mingw-w64-x86_64-webrtc-audio-processing \ + git \ make \ unzip \ curl @@ -74,14 +74,14 @@ prepare() configure() { msg "Running configuration for Windows" - ./configure --program-prefix=$DIST_DIR --no-debug --release --disable-fast-vapi --with-libsoup3 + ./configure --program-prefix="$DIST_DIR" --no-debug --release --disable-fast-vapi --with-libsoup3 msg "Configured!" } build() { msg "Started building on $JOBS threads" - make -j$JOBS + make -j"$JOBS" msg "Successfully builded!" } @@ -91,15 +91,15 @@ dist_install() make install msg "Copying MINGW64 dependencies" - cp /mingw64/bin/gdbus.exe $DIST_DIR/bin - cp /mingw64/bin/gspawn-win64-helper.exe $DIST_DIR/bin + cp /mingw64/bin/gdbus.exe "$DIST_DIR/bin" + cp /mingw64/bin/gspawn-win64-helper.exe "$DIST_DIR/bin" - cp /mingw64/bin/libcrypto-*-x64.dll $DIST_DIR/bin/ - cp -r /mingw64/lib/gstreamer-1.0 $DIST_DIR/lib - mkdir -p $DIST_DIR/lib/gdk-pixbuf-2.0/ && cp -r /mingw64/lib/gdk-pixbuf-2.0 $DIST_DIR/lib/ - mkdir -p $DIST_DIR/lib/gio/ && cp -r /mingw64/lib/gio $DIST_DIR/lib/ + cp /mingw64/bin/libcrypto-*-x64.dll "$DIST_DIR/bin/" + cp -r /mingw64/lib/gstreamer-1.0 "$DIST_DIR/lib" + mkdir -p "$DIST_DIR/lib/gdk-pixbuf-2.0/" && cp -r /mingw64/lib/gdk-pixbuf-2.0 "$DIST_DIR/lib/" + mkdir -p "$DIST_DIR/lib/gio/" && cp -r /mingw64/lib/gio "$DIST_DIR/lib/" - list=`find $DIST_DIR -type f \( -name "*.exe" -o -name "*.dll" \) -exec \ + list=`find "$DIST_DIR" -type f \( -name "*.exe" -o -name "*.dll" \) -exec \ ntldd -R {} + | \ grep "mingw64" | \ cut -f1 -d "=" | sort | uniq` @@ -108,23 +108,23 @@ dist_install() done msg "Removing debug information from all EXE and DLL files" - find $DIST_DIR -iname "*.exe" -exec strip -s {} + - find $DIST_DIR -iname "*.dll" -exec strip -s {} + + find "$DIST_DIR" -iname "*.exe" -exec strip -s {} + + find "$DIST_DIR" -iname "*.dll" -exec strip -s {} + - find $DIST_DIR -iname "*.a" -exec rm {} + + find "$DIST_DIR" -iname "*.a" -exec rm {} + msg "Removing redudant header files" - rm -rf $DIST_DIR/include + rm -rf "$DIST_DIR/include" msg "Copy LICENSE" - cp -f ${PWD}/LICENSE $DIST_DIR/LICENSE + cp -f "$PWD/LICENSE" "$DIST_DIR/LICENSE" msg "Copy icons, themes, locales and fonts" - cp -f ${PWD}/main/dino.ico $DIST_DIR/dino.ico - cp -rf /mingw64/share/xml $DIST_DIR/share - mkdir -p $DIST_DIR/etc/fonts && cp -r /mingw64/etc/fonts $DIST_DIR/etc/ - mkdir -p $DIST_DIR/share/icons && cp -r /mingw64/share/icons $DIST_DIR/share/ - mkdir -p $DIST_DIR/share/glib-2.0/schemas && cp -rf /mingw64/share/glib-2.0/schemas $DIST_DIR/share/glib-2.0/ + cp -f "$PWD/main/dino.ico" "$DIST_DIR/dino.ico" + cp -rf "/mingw64/share/xml" "$DIST_DIR/share" + mkdir -p "$DIST_DIR/etc/fonts" && cp -r /mingw64/etc/fonts "$DIST_DIR/etc/" + mkdir -p "$DIST_DIR/share/icons" && cp -r /mingw64/share/icons "$DIST_DIR/share/" + mkdir -p "$DIST_DIR/share/glib-2.0/schemas" && cp -rf /mingw64/share/glib-2.0/schemas "$DIST_DIR/share/glib-2.0/" msg "Successfully installed!" } @@ -140,7 +140,7 @@ build_installer() clean() { - rm -rf build $DIST_DIR + rm -rf build "$DIST_DIR" msg "Build artifacts removed successfull!" } @@ -161,7 +161,7 @@ Running without parameters is equivalent to running: EOF } -if [[ $(uname) != "MINGW64_NT"* ]]; then +if [[ "$(uname)" != "MINGW64_NT"* ]]; then fatal "This is not a MINGW64 environment!" fi