From 691a5e0baaec70763ddd6edd6b78a6600abef18b Mon Sep 17 00:00:00 2001 From: Miepee Date: Thu, 30 May 2024 12:56:21 +0200 Subject: [PATCH 1/4] Add Windows optimized workflow --- .github/workflows/build-optimized.yml | 15 +++++++++++++ make-windows.sh | 32 +++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 make-windows.sh diff --git a/.github/workflows/build-optimized.yml b/.github/workflows/build-optimized.yml index 3d1f163..a89c3f3 100644 --- a/.github/workflows/build-optimized.yml +++ b/.github/workflows/build-optimized.yml @@ -20,3 +20,18 @@ jobs: with: name: linux-x64-gui.zip path: ./linux-x64.zip + + + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - name: Build + run: bash ./make-windows.sh + - name: Zip to Archive + run: 7z a -tzip ./windows-x64.zip ./flips.exe + - name: Upload Artifacts + uses: actions/upload-artifact@v4.3.1 + with: + name: windows-x64-gui.zip + path: ./windows-x64.zip diff --git a/make-windows.sh b/make-windows.sh new file mode 100644 index 0000000..6aecfe2 --- /dev/null +++ b/make-windows.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# For whatever reason, Windows sometimes has LANG unset. This breaks grep at the end, so setting this manually. +export LANG=C.UTF-8 + +echo "This script creates a heavily optimized Windows binary. For debugging you're better off using the Makefile directly." + + +rm floating.zip +rm -r obj/* || true + +#if trying to make a 32bit Flips, add -Wl,--large-address-aware + +echo 'Windows (1/3)' +rm -r obj/* flips.exe; make CFLAGS="$FLAGS -fprofile-generate -lgcov" +[ -e flips.exe ] || exit +echo 'Windows (2/3)' +./flips.exe --create --bps-delta profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null +./flips.exe --create --bps-delta-moremem profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null +echo 'Windows (3/3)' +rm flips.exe; make CFLAGS="$FLAGS -fprofile-use -s" + + +# CI currently has invalid dependencies. Unsure if ok or not. +ERROR_CODE_ON_INVALID_DEPENDENCIES=1 +if [ -z ${IGNORE_ON_INVALID_DEPENDENCIES} ]; then ERROR_CODE_ON_INVALID_DEPENDENCIES=0; fi +#verify that there are no unexpected dependencies +objdump -p flips.exe | grep 'DLL Name' | \ + grep -Pvi '(msvcrt|advapi32|comctl32|comdlg32|gdi32|kernel32|shell32|user32)' && \ + echo "Invalid dependency" && exit $ERROR_CODE_ON_INVALID_DEPENDENCIES + + From 6a57490e07bfbf5122b03152dff28c38e28312ff Mon Sep 17 00:00:00 2001 From: Miepee Date: Thu, 30 May 2024 14:01:29 +0200 Subject: [PATCH 2/4] Address review --- .github/workflows/build-optimized.yml | 8 ++------ make-windows.sh | 12 +++++++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-optimized.yml b/.github/workflows/build-optimized.yml index a89c3f3..661c866 100644 --- a/.github/workflows/build-optimized.yml +++ b/.github/workflows/build-optimized.yml @@ -13,13 +13,11 @@ jobs: run: dnf install -y gtk3-devel zip - name: Build run: ./make-linux.sh - - name: Zip to Archive - run: zip -9 ./linux-x64.zip ./flips - name: Upload Artifacts uses: actions/upload-artifact@v4.3.1 with: name: linux-x64-gui.zip - path: ./linux-x64.zip + path: ./flips windows: @@ -28,10 +26,8 @@ jobs: - uses: actions/checkout@v4 - name: Build run: bash ./make-windows.sh - - name: Zip to Archive - run: 7z a -tzip ./windows-x64.zip ./flips.exe - name: Upload Artifacts uses: actions/upload-artifact@v4.3.1 with: name: windows-x64-gui.zip - path: ./windows-x64.zip + path: ./flips.exe diff --git a/make-windows.sh b/make-windows.sh index 6aecfe2..0a9dc62 100644 --- a/make-windows.sh +++ b/make-windows.sh @@ -5,6 +5,11 @@ export LANG=C.UTF-8 echo "This script creates a heavily optimized Windows binary. For debugging you're better off using the Makefile directly." +# Set Windows (with gcc) specific optimization flags. These may need to be revisited when the project is build using MVSC. +FLAGS='-Wall -O3 -flto -fuse-linker-plugin -fomit-frame-pointer -fmerge-all-constants -fvisibility=hidden' +FLAGS=$FLAGS' -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables' +FLAGS=$FLAGS' -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj/' + rm floating.zip rm -r obj/* || true @@ -21,12 +26,9 @@ echo 'Windows (3/3)' rm flips.exe; make CFLAGS="$FLAGS -fprofile-use -s" -# CI currently has invalid dependencies. Unsure if ok or not. -ERROR_CODE_ON_INVALID_DEPENDENCIES=1 -if [ -z ${IGNORE_ON_INVALID_DEPENDENCIES} ]; then ERROR_CODE_ON_INVALID_DEPENDENCIES=0; fi #verify that there are no unexpected dependencies objdump -p flips.exe | grep 'DLL Name' | \ - grep -Pvi '(msvcrt|advapi32|comctl32|comdlg32|gdi32|kernel32|shell32|user32)' && \ - echo "Invalid dependency" && exit $ERROR_CODE_ON_INVALID_DEPENDENCIES + grep -Pvi '(msvcrt|advapi32|comctl32|comdlg32|gdi32|kernel32|shell32|user32|api-ms-win-crt)' && \ + echo "Invalid dependency" && exit 1 From 9668942fbab9163beda5f1760d9b1d81fe830464 Mon Sep 17 00:00:00 2001 From: Miepee Date: Thu, 30 May 2024 14:15:23 +0200 Subject: [PATCH 3/4] rephrase comment, dont make CI fail. --- make-windows.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make-windows.sh b/make-windows.sh index 0a9dc62..a5ea83f 100644 --- a/make-windows.sh +++ b/make-windows.sh @@ -5,7 +5,7 @@ export LANG=C.UTF-8 echo "This script creates a heavily optimized Windows binary. For debugging you're better off using the Makefile directly." -# Set Windows (with gcc) specific optimization flags. These may need to be revisited when the project is build using MVSC. +# Set GCC specific optimization flags. These may need to be revisited when the project is build using MVSC. FLAGS='-Wall -O3 -flto -fuse-linker-plugin -fomit-frame-pointer -fmerge-all-constants -fvisibility=hidden' FLAGS=$FLAGS' -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables' FLAGS=$FLAGS' -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj/' @@ -29,6 +29,6 @@ rm flips.exe; make CFLAGS="$FLAGS -fprofile-use -s" #verify that there are no unexpected dependencies objdump -p flips.exe | grep 'DLL Name' | \ grep -Pvi '(msvcrt|advapi32|comctl32|comdlg32|gdi32|kernel32|shell32|user32|api-ms-win-crt)' && \ - echo "Invalid dependency" && exit 1 + echo "Invalid dependency" && exit From a4af8b8a5dd4ec12e7cc863ad02325a8b2e6d956 Mon Sep 17 00:00:00 2001 From: Miepee Date: Thu, 30 May 2024 14:22:36 +0200 Subject: [PATCH 4/4] whoops --- make-windows.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make-windows.sh b/make-windows.sh index a5ea83f..abc6a8c 100644 --- a/make-windows.sh +++ b/make-windows.sh @@ -29,6 +29,7 @@ rm flips.exe; make CFLAGS="$FLAGS -fprofile-use -s" #verify that there are no unexpected dependencies objdump -p flips.exe | grep 'DLL Name' | \ grep -Pvi '(msvcrt|advapi32|comctl32|comdlg32|gdi32|kernel32|shell32|user32|api-ms-win-crt)' && \ - echo "Invalid dependency" && exit + echo "Invalid dependency" && exit 1 +exit 0