Attempt to fix windows build #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: MinGW Windows Nightly Build | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
mingw: | |
runs-on: ubuntu-latest | |
container: | |
image: registry.fedoraproject.org/fedora:33 | |
options: --privileged | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download dependencies 📥 | |
run: | | |
dnf install -y "dnf-command(config-manager)" curl git patch | |
dnf install -y gcc-c++ meson | |
dnf install -y mingw64-filesystem mingw64-gcc-c++ | |
dnf install -y mingw64-winpthreads-static | |
dnf install -y mingw64-gtkmm30 mingw64-gtksourceviewmm3 mingw64-jsoncpp mingw64-zlib mingw64-fontconfig mingw64-librsvg2 | |
dnf install -y adwaita-icon-theme gtk-update-icon-cache | |
- name: Install Rust 🦀 | |
run: | | |
export RUSTUP_HOME=/usr/rustup \ | |
CARGO_HOME=/usr/cargo \ | |
PATH=/usr/cargo/bin:$PATH | |
curl --proto '=https' --tlsv1.2 -sSf -o /tmp/rustup-init.sh https://sh.rustup.rs | |
sh /tmp/rustup-init.sh -y --no-modify-path -t x86_64-pc-windows-gnu | |
- name: Build uutils coreutils 🍷 | |
run: | | |
export RUSTUP_HOME=/usr/rustup \ | |
CARGO_HOME=/usr/cargo \ | |
PATH=/usr/cargo/bin:$PATH | |
git clone https://github.com/uutils/coreutils.git && cd coreutils | |
git checkout $(git describe --abbrev=0 --tags) | |
cargo build --target=x86_64-pc-windows-gnu --release -p uu_mkdir -p uu_touch -p uu_mv -p uu_rm | |
- name: Install cLaTeXMath 🖋 | |
run: | | |
dnf config-manager --add-repo https://download.opensuse.org/repositories/home:sp1rit:mingw/Fedora_33/home:sp1rit:mingw.repo | |
dnf install -y mingw64-clatexmath mingw64-clatexmath-static | |
- name: Configure 🔧 | |
run: meson --prefix=/ --cross-file=/usr/share/mingw/toolchain-mingw64.meson --default-library shared bin-x86_64-w64-mingw32 | |
- name: Compile 🎲 | |
run: ninja -C bin-x86_64-w64-mingw32 | |
- name: Build Windows-compatible directory 📁 | |
run: | | |
mkdir dist | |
DESTDIR="$PWD/dist/" ninja -C bin-x86_64-w64-mingw32 install | |
#cp $(x86_64-w64-mingw32-objdump -p dist/bin/notekit.exe | grep "DLL Name" | awk '{print $3}' | grep -vE '(KERNEL|msvcrt)' | sed "s|^|/usr/x86_64-w64-mingw32/sys-root/mingw/bin/|" | tr "\n" " ") dist/bin/ | |
# fuck it, we'll ship the whole bin/ folder for now | |
cp -r /usr/x86_64-w64-mingw32/sys-root/mingw/bin/* dist/bin/ | |
mv dist/share/ dist/bin/ | |
mv dist/bin/share/notekit/{data,sourceview} dist/bin/ | |
# copy share dir from mingw root to release | |
cp -r /usr/x86_64-w64-mingw32/sys-root/mingw/share/* dist/bin/share/ | |
# copy clatexmath to direct path, as it's autodetection does not work | |
cp -r dist/bin/share/clatexmath/ dist/bin/data/latex | |
# add gtk-pixbuf libs | |
mkdir dist/bin/lib/ | |
cp -r /usr/x86_64-w64-mingw32/sys-root/mingw/lib/gdk-pixbuf-2.0 dist/bin/lib/ | |
# I'd advise against patching auto-generated files, however to run gtk-pixbuf-query-loaders.exe we'd need wine | |
sed 's|^"\.\./lib/|"./lib/|' -i dist/bin/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache | |
# add Adwaita icons | |
cp -r /usr/share/icons/Adwaita/ dist/bin/data/icons/ | |
# generate icon cache for notekit icons | |
gtk-update-icon-cache dist/bin/data/icons/hicolor/ | |
# recompile gsettings schema cache | |
glib-compile-schemas dist/bin/share/glib-2.0/schemas/gnome | |
# add rust uutils coreutils | |
cp coreutils/target/x86_64-pc-windows-gnu/release/{mkdir,touch,mv,rm}.exe dist/bin/ | |
# add notesbase folder and put README.md into it | |
mkdir dist/bin/notesbase | |
cp README.md dist/bin/notesbase | |
cp LICENSE dist/ | |
# | |
mv dist/bin/ dist/notekit/ | |
pushd dist/ | |
zip -9r notekit_mingw.zip notekit/ LICENSE | |
popd | |
- name: Upload nightly Windows build 📤 | |
uses: actions/upload-artifact@v2 | |
with: | |
name: NoteKit - Windows x86_64 nightly build | |
path: dist/notekit_mingw.zip |