11#! /bin/bash
22
3- # Variables
4- # Run app from base directory, not ./windows
3+ # Script to go all the way from building to compiling to creating an installer
4+ # Install MSYS2 then run prep.sh before this to prep your box
5+ # Very tweaked version of the deploy.sh from SuperCamel: https://github.com/supercamel/ValaOnWindows
6+
7+ # Run this from base directory, not ./windows
8+
9+ # Run the exe of your app in deploy/bin :
10+ # From the MSYS2 console to check you have all packages necessary for it to run on windows
11+ # From windows Explorer by double-click to check if everything it needs is in the deploy folder
12+ # Copy stuff from /c/MSYS2/mingw64/ everything needed should be kinda there
13+
14+ # --------------------------------
15+ # Variables.
516# Write path UNIX-style ("/"). Script will invert the slash where relevant.
617app_name=" Jorts"
718build_dir=" builddir"
@@ -11,13 +22,14 @@ version="3.5.0"
1122deploy_dir=" windows/deploy"
1223exe_name=" io.github.ellie_commons.jorts.exe"
1324
14- # Rebuild the exe as a release build
25+ # --------------------------------
26+ # Rebuild and compile the exe as a release build
1527rm -rfd ${build_dir}
1628meson setup --buildtype release ${build_dir}
1729ninja -C ${build_dir}
1830
19- # Copy DLLS
20- echo " Copying DLLs... "
31+ # --------------------------------
32+ # Prepare structure
2133mkdir -p " ${deploy_dir} "
2234mkdir -p " ${deploy_dir} /bin"
2335mkdir -p " ${deploy_dir} /etc"
@@ -29,14 +41,17 @@ mkdir -p "${deploy_dir}/usr"
2941cp " ${build_dir} /src/${exe_name} " " ${deploy_dir} /bin"
3042cp -r " windows/icons" " ${deploy_dir} "
3143
32- dlls=$( ldd " ${deploy_dir} /bin/${exe_name} " | grep " /mingw64" | awk ' {print $3}' )
3344
45+ # Detect what DLL we need and slorp it into bin
46+ echo " Copying DLLs..."
47+ dlls=$( ldd " ${deploy_dir} /bin/${exe_name} " | grep " /mingw64" | awk ' {print $3}' )
3448for dll in $dlls
3549do
3650 cp " $dll " " ${deploy_dir} /bin"
3751done
3852
39-
53+ # These are not detected but needed to display icons properly
54+ # Dont ask me how many tears of blood it took to figure out these idiots
4055cp -rnv /mingw64/bin/rsvg-convert.exe ${deploy_dir} /bin/
4156cp -rnv /mingw64/bin/librsvg-2-2.dll ${deploy_dir} /bin/
4257cp -rnv /mingw64/bin/libxml2-16.dll ${deploy_dir} /bin/
@@ -55,28 +70,45 @@ cp -rnv /mingw64/share/fontconfig/ ${deploy_dir}/share/
5570cp -rnv /mingw64/share/GConf/ ${deploy_dir} /share/
5671cp -rnv /mingw64/lib/gettext/ ${deploy_dir} /lib/
5772
58- # We need this to properly display icons
73+ # We need this to properly display icons too.
5974cp -rnv /mingw64/include/librsvg-2.0 ${deploy_dir} /include/
6075cp -rnv /mingw64/lib/gdk-pixbuf-2.0/ ${deploy_dir} /lib/
6176# export GDK_PIXBUF_MODULEDIR=lib/gdk-pixbuf-2.0/2.10.0/loaders
6277# gdk-pixbuf-query-loaders > ${deploy_dir}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
6378
6479# Make sure this one is actually copied, manually, in the deploy
65- # If only some icons show up its because of this shit.
80+ # That file caused so many issues trying to build
6681cat windows/loaders.cache > ${deploy_dir} /lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
6782
68- # Ive tried, and failed, to pull only needed icons
69-
70- # Only what we need
83+ # --------------------------------
84+ # ICONS. Only what we need. Shits heavy af
85+ # Honestly you could get away with copying the whole icon theme. The script goes into the weeds only to shave off MBs
86+ # TODO: No matter what, the edit-find icon in the searchfield of emoji-popover shows as missing
87+ # TODO: Abstract this into a script. A better coded one.
7188mkdir -pv ${deploy_dir} /share/icons/elementary
72- cp -rnv /mingw64/share/icons/elementary/actions* ${deploy_dir} /share/icons/elementary/
73- cp -rnv /mingw64/share/icons/elementary/status* ${deploy_dir} /share/icons/elementary/
89+
90+ mkdir -p /mingw64/share/icons/elementary/actions/ ${deploy_dir} /share/icons/elementary/
91+ mkdir -p /mingw64/share/icons/elementary/actions@2x/ ${deploy_dir} /share/icons/elementary/
92+ mkdir -p /mingw64/share/icons/elementary/actions@3x/ ${deploy_dir} /share/icons/elementary/
93+ cp -rnv /mingw64/share/icons/elementary/actions/symbolic ${deploy_dir} /share/icons/elementary/actions/
94+ cp -rnv /mingw64/share/icons/elementary/actions@2x/symbolic ${deploy_dir} /share/icons/elementary/actions@2x/
95+ cp -rnv /mingw64/share/icons/elementary/actions@3x/symbolic ${deploy_dir} /share/icons/elementary/actions@3x/
96+
97+ mkdir -p /mingw64/share/icons/elementary/status/ ${deploy_dir} /share/icons/elementary/
98+ mkdir -p /mingw64/share/icons/elementary/status@2x/ ${deploy_dir} /share/icons/elementary/
99+ mkdir -p /mingw64/share/icons/elementary/status@3x/ ${deploy_dir} /share/icons/elementary/
100+ cp -rnv /mingw64/share/icons/elementary/status/symbolic ${deploy_dir} /share/icons/elementary/status/
101+ cp -rnv /mingw64/share/icons/elementary/status@2x/symbolic ${deploy_dir} /share/icons/elementary/status@2x/
102+ cp -rnv /mingw64/share/icons/elementary/status@3x/symbolic ${deploy_dir} /share/icons/elementary/status@3x/
103+
74104cp -rnv /mingw64/share/icons/elementary/emotes* ${deploy_dir} /share/icons/elementary/
75105cp -rnv /mingw64/share/icons/elementary/index.theme ${deploy_dir} /share/icons/elementary/
76106gtk4-update-icon-cache.exe -f ${deploy_dir} /share/icons/elementary/
77107
78-
108+ # --------------------------------
79109# Write the theme to gtk settings
110+ # The NSIS below handles installing the font, as it works differently on windows
111+
80112mkdir -v ${deploy_dir} /etc/gtk-4.0/
81113cat << EOF > ${deploy_dir} /etc/gtk-4.0/settings.ini
82114[Settings]
@@ -89,6 +121,7 @@ gtk-xft-hintstyle=hintful
89121gtk-xft-rgba=rgb
90122EOF
91123
124+ # Doesnt seem needed, but keep around just in case
92125# glib-compile-schemas ${deploy_dir}/share/glib-2.0/schemas
93126
94127# ================================================================
@@ -224,7 +257,7 @@ Section "Install"
224257 WriteRegStr HKCU "Software\\ Microsoft\\ Windows\\ CurrentVersion\\ Uninstall\\ ${app_name} " "UninstallString" "\$ INSTDIR\\ Uninstall.exe"
225258 WriteRegStr HKCU "Software\\ Microsoft\\ Windows\\ CurrentVersion\\ Uninstall\\ ${app_name} " "Publisher" "Ellie-Commons"
226259 WriteRegStr HKCU "Software\\ Microsoft\\ Windows\\ CurrentVersion\\ Uninstall\\ ${app_name} " "URLInfoAbout" "https://github.com/ellie-commons/jorts"
227- WriteRegDWORD HKCU "Software\\ Microsoft\\ Windows\\ CurrentVersion\\ Uninstall\\ ${app_name} " "EstimatedSize" "0x00026548 " ;157MB
260+ WriteRegDWORD HKCU "Software\\ Microsoft\\ Windows\\ CurrentVersion\\ Uninstall\\ ${app_name} " "EstimatedSize" "0x000220EC " ;139,5MB
228261SectionEnd
229262
230263Section "Uninstall"
@@ -258,6 +291,11 @@ SectionEnd
258291
259292EOF
260293
294+
295+ # --------------------------------
296+ # Build the final exe installer.
297+ # Test out the deploy bin just in case though.
298+
261299echo " Running NSIS..."
262300makensis windows/${app_name} -Installer.nsi
263301
0 commit comments