Skip to content

Commit 1928db6

Browse files
committed
2 parents 03edb57 + 5bb927e commit 1928db6

File tree

5 files changed

+86
-49
lines changed

5 files changed

+86
-49
lines changed

meson.build

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ gnome = import('gnome')
77
i18n = import('i18n')
88

99
add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()), language:'c')
10+
windows_build = build_machine.system() == 'windows'
1011

11-
if build_machine.system() == 'windows'
12-
windows_build = true
13-
else
14-
windows_build = false
15-
endif
1612

13+
#================================
14+
# Set flags for icon variants, and target in the case of windows builds
1715

1816
vala_flags = []
1917
variant = get_option('variant')[0]
@@ -26,15 +24,10 @@ else
2624
vala_flags = ['--define', 'DEFAULT']
2725
endif
2826

29-
3027
if windows_build
3128
vala_flags += ['--define', 'WINDOWS']
3229
endif
3330

34-
35-
36-
37-
3831
add_project_arguments(vala_flags, language: 'vala')
3932

4033
#================================
@@ -57,6 +50,9 @@ gresource = gnome.compile_resources(
5750
source_dir: 'data'
5851
)
5952

53+
#================================
54+
# dependencies
55+
6056
dependencies = [
6157
dependency('granite-7'),
6258
dependency('gobject-2.0'),
@@ -65,6 +61,8 @@ dependencies = [
6561
dependency('gtk4'),
6662
]
6763

64+
# We need to compile an icon into the exe to avoid "missing icon" icon at every turn
65+
# Libportal is not available in MSYS2, built the file only on linuxes
6866
if windows_build
6967
dependencies += dependency('gio-windows-2.0')
7068
ico_src = import('windows').compile_resources('windows/icons/ico.rc')
@@ -74,9 +72,8 @@ else
7472
dependencies += dependency('libportal')
7573
endif
7674

77-
#================================
78-
7975

76+
#================================
8077
# Add subfolders for Meson to look
8178
subdir('data')
8279
subdir('po')

windows/deploy.sh

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
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.
617
app_name="Jorts"
718
build_dir="builddir"
@@ -11,13 +22,14 @@ version="3.5.0"
1122
deploy_dir="windows/deploy"
1223
exe_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
1527
rm -rfd ${build_dir}
1628
meson setup --buildtype release ${build_dir}
1729
ninja -C ${build_dir}
1830

19-
# Copy DLLS
20-
echo "Copying DLLs..."
31+
#--------------------------------
32+
# Prepare structure
2133
mkdir -p "${deploy_dir}"
2234
mkdir -p "${deploy_dir}/bin"
2335
mkdir -p "${deploy_dir}/etc"
@@ -29,14 +41,17 @@ mkdir -p "${deploy_dir}/usr"
2941
cp "${build_dir}/src/${exe_name}" "${deploy_dir}/bin"
3042
cp -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}')
3448
for dll in $dlls
3549
do
3650
cp "$dll" "${deploy_dir}/bin"
3751
done
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
4055
cp -rnv /mingw64/bin/rsvg-convert.exe ${deploy_dir}/bin/
4156
cp -rnv /mingw64/bin/librsvg-2-2.dll ${deploy_dir}/bin/
4257
cp -rnv /mingw64/bin/libxml2-16.dll ${deploy_dir}/bin/
@@ -55,28 +70,45 @@ cp -rnv /mingw64/share/fontconfig/ ${deploy_dir}/share/
5570
cp -rnv /mingw64/share/GConf/ ${deploy_dir}/share/
5671
cp -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.
5974
cp -rnv /mingw64/include/librsvg-2.0 ${deploy_dir}/include/
6075
cp -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
6681
cat 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.
7188
mkdir -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+
74104
cp -rnv /mingw64/share/icons/elementary/emotes* ${deploy_dir}/share/icons/elementary/
75105
cp -rnv /mingw64/share/icons/elementary/index.theme ${deploy_dir}/share/icons/elementary/
76106
gtk4-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+
80112
mkdir -v ${deploy_dir}/etc/gtk-4.0/
81113
cat << EOF > ${deploy_dir}/etc/gtk-4.0/settings.ini
82114
[Settings]
@@ -89,6 +121,7 @@ gtk-xft-hintstyle=hintful
89121
gtk-xft-rgba=rgb
90122
EOF
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
228261
SectionEnd
229262
230263
Section "Uninstall"
@@ -258,6 +291,11 @@ SectionEnd
258291
259292
EOF
260293

294+
295+
#--------------------------------
296+
# Build the final exe installer.
297+
# Test out the deploy bin just in case though.
298+
261299
echo "Running NSIS..."
262300
makensis windows/${app_name}-Installer.nsi
263301

windows/icons/settings-mini.ico

2.37 KB
Binary file not shown.

windows/loaders.cache

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,62 +4,62 @@
44
#
55
# LoaderDir = lib\gdk-pixbuf-2.0\2.10.0\loaders
66
#
7-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-ani.dll"
7+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.dll"
88
"ani" 4 "gdk-pixbuf" "Windows animated cursor" "LGPL"
99
"application/x-navi-animation" ""
1010
"ani" ""
1111
"RIFF ACON" " xxxx " 100
1212

13-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-avif.dll"
13+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-avif.dll"
1414
"avif" 5 "gdk-pixbuf" "AV1 Image File Format" "BSD"
1515
"image/avif" ""
1616
"avif" ""
1717
" ftypavif" "zzz " 100
1818

19-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-bmp.dll"
19+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-bmp.dll"
2020
"bmp" 5 "gdk-pixbuf" "BMP" "LGPL"
2121
"image/bmp" "image/x-bmp" "image/x-MS-bmp" ""
2222
"bmp" ""
2323
"BM" "" 100
2424

25-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-gif.dll"
25+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gif.dll"
2626
"gif" 4 "gdk-pixbuf" "GIF" "LGPL"
2727
"image/gif" ""
2828
"gif" ""
2929
"GIF8" "" 100
3030

31-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-heif.dll"
31+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-heif.dll"
3232
"heif/avif" 4 "pixbufloader-heif" "HEIF/AVIF Image" "LGPL3"
3333
"image/heif" "image/heic" "image/avif" ""
3434
"heif" "heic" "avif" ""
3535
" ftyp" "xxxx " 100
3636

37-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-icns.dll"
37+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-icns.dll"
3838
"icns" 4 "gdk-pixbuf" "MacOS X icon" "GPL"
3939
"image/x-icns" ""
4040
"icns" ""
4141
"icns" "" 100
4242

43-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-ico.dll"
43+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ico.dll"
4444
"ico" 5 "gdk-pixbuf" "Windows icon" "LGPL"
4545
"image/x-icon" "image/x-ico" "image/x-win-bitmap" "image/vnd.microsoft.icon" "application/ico" "image/ico" "image/icon" "text/ico" ""
4646
"ico" "cur" ""
4747
" \001 " "zz znz" 100
4848
" \002 " "zz znz" 100
4949

50-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-jpeg.dll"
50+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jpeg.dll"
5151
"jpeg" 5 "gdk-pixbuf" "JPEG" "LGPL"
5252
"image/jpeg" ""
5353
"jpeg" "jpe" "jpg" ""
5454
"\377\330" "" 100
5555

56-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-png.dll"
56+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.dll"
5757
"png" 5 "gdk-pixbuf" "PNG" "LGPL"
5858
"image/png" ""
5959
"png" ""
6060
"\211PNG\r\n\032\n" "" 100
6161

62-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-pnm.dll"
62+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-pnm.dll"
6363
"pnm" 4 "gdk-pixbuf" "PNM/PBM/PGM/PPM" "LGPL"
6464
"image/x-portable-anymap" "image/x-portable-bitmap" "image/x-portable-graymap" "image/x-portable-pixmap" ""
6565
"pnm" "pbm" "pgm" "ppm" ""
@@ -70,14 +70,14 @@
7070
"P5" "" 100
7171
"P6" "" 100
7272

73-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-qtif.dll"
73+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-qtif.dll"
7474
"qtif" 4 "gdk-pixbuf" "QuickTime" "LGPL"
7575
"image/x-quicktime" "image/qtif" ""
7676
"qtif" "qif" ""
7777
"abcdidsc" "xxxx " 100
7878
"abcdidat" "xxxx " 100
7979

80-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-tga.dll"
80+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tga.dll"
8181
"tga" 4 "gdk-pixbuf" "Targa" "LGPL"
8282
"image/x-tga" ""
8383
"tga" "targa" ""
@@ -88,28 +88,28 @@
8888
" \n" "xz " 100
8989
" \v" "xz " 100
9090

91-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-tiff.dll"
91+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tiff.dll"
9292
"tiff" 5 "gdk-pixbuf" "TIFF" "LGPL"
9393
"image/tiff" ""
9494
"tiff" "tif" ""
9595
"MM *" " z " 100
9696
"II* " " z" 100
9797
"II* \020 CR\002 " " z zzz z" 0
9898

99-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-xbm.dll"
99+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xbm.dll"
100100
"xbm" 4 "gdk-pixbuf" "XBM" "LGPL"
101101
"image/x-xbitmap" ""
102102
"xbm" ""
103103
"#define " "" 100
104104
"/*" "" 50
105105

106-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\libpixbufloader-xpm.dll"
106+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xpm.dll"
107107
"xpm" 4 "gdk-pixbuf" "XPM" "LGPL"
108108
"image/x-xpixmap" ""
109109
"xpm" ""
110110
"/* XPM */" "" 100
111111

112-
"lib\\gdk-pixbuf-2.0\\2.10.0\\loaders\\pixbufloader_svg.dll"
112+
"lib/gdk-pixbuf-2.0/2.10.0/loaders/pixbufloader_svg.dll"
113113
"svg" 6 "gdk-pixbuf" "Scalable Vector Graphics" "LGPL"
114114
"image/svg+xml" "image/svg" "image/svg-xml" "image/vnd.adobe.svg+xml" "text/xml-svg" "image/svg+xml-compressed" ""
115115
"svg" "svgz" "svg.gz" ""

windows/prep.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
#!/bin/bash
2-
32
# Script to prepare the environment
43

4+
# Line below for copypaste in msis2 console because im not retyping that
55
# cd /c/Documents\ and\ Settings/TC/Desktop/jorts
6-
mkdir -v deploy
6+
7+
mkdir -pv windows/deploy
78

89
alias pacman='pacman --noconfirm'
910
pacman -Syu
1011
pacman -S meson gcc ninja
11-
pacman -S mingw-w64-ucrt-x86_64-{gtk4,vala,granite7,ninja,meson,nsis,gcc}
12-
pacman -S mingw-w64-libgee mingw-w64-gsettings-desktop-schemas
1312
pacman -S mingw-w64-x86_64-desktop-file-utils
13+
pacman -S mingw-w64-ucrt-x86_64-{gtk4,vala,ninja,meson,nsis,gcc}
14+
pacman -S mingw-w64-ucrt-x86_64-granite7
15+
pacman -S mingw-w64-libgee mingw-w64-gsettings-desktop-schemas
1416
pacman -S mingw-w64-x86_64-gtk-elementary-theme mingw-w64-x86_64-elementary-icon-theme
1517
pacman -S mingw-w64-ucrt-x86_64-vala mingw-w64-x86_64-vala
16-
pacman -S mingw-w64-x86_64-librsvg x86_64-w64-mingw32-windres
18+
pacman -S mingw-w64-x86_64-librsvg

0 commit comments

Comments
 (0)