@@ -8,19 +8,18 @@ backend = "cpp"
88# Dependencies
99
1010requires " nim >= 1.6.2"
11- requires " kdl >= 1 .0.0 "
11+ requires " kdl >= 2 .0.1 "
1212requires " nimgl >= 1.3.2"
1313requires " stb_image >= 2.5"
14- requires " imstyle >= 1 .0.0"
15- requires " openurl >= 2.0.3 "
14+ requires " imstyle >= 3 .0.0"
15+ requires " openurl >= 2.0.4 "
1616requires " tinydialogs >= 1.0.0"
17+ requires " constructor >= 1.2.0"
1718
1819import std/ [strformat, options]
19- import src/ types
20- import kdl
20+ import src/ configtype
2121
22- const configPath {.strdefine .} = " config.kdl"
23- const config = parseKdlFile (configPath).decode (Config )
22+ const config = Config ()
2423
2524version = config.version
2625namedBin[" main" ] = config.name
@@ -29,13 +28,12 @@ let arch = getEnv("ARCH", "amd64")
2928let outPath = getEnv (" OUTPATH" , toExe & " { config.name} -{ version} -{ arch} " )
3029let flags = getEnv (" FLAGS" )
3130
32- let args = & " --app:gui --out:{ outPath} --cpu:{ arch} -d:configPath= { configPath } { flags} "
31+ let args = & " --app:gui --out:{ outPath} --cpu:{ arch} { flags} "
3332
3433task buildr, " Build the application for release" :
35- exec " nimble install -d -y"
36- exec & " nim cpp -d:release { args} main.nim "
34+ exec & " nimble c -d:release { args} main.nim "
3735
38- const desktop = """
36+ const desktopTemplate = """
3937[Desktop Entry]
4038Name=$name
4139Exec=AppRun
@@ -53,28 +51,27 @@ task buildapp, "Build the AppImage":
5351 let appimagePath = & " { config.name} -{ version} -{ arch} .AppImage"
5452
5553 # Compile applicaiton executable
56- if not existsDir (" AppDir" ): mkDir (" AppDir" )
57- exec " nimble install -d -y"
58- exec & " nim cpp -d:release -d:appimage { args} --out:AppDir/AppRun main.nim "
54+ if not dirExists (" AppDir" ): mkDir (" AppDir" )
55+ exec & " nimble c -d:release -d:appimage { args} --out:AppDir/AppRun main.nim "
5956
6057 # Make desktop file
6158 writeFile (
62- & " AppDir/{ config.name} .desktop " ,
63- desktop % [
64- " name" , config.name,
65- " categories" , config.categories.join (" ;" ),
66- " version" , config.version,
67- " comment" , config.comment,
59+ & " AppDir/{ config.name} .desktop " ,
60+ desktopTemplate % [
61+ " name" , config.name,
62+ " categories" , config.categories.join (" ;" ),
63+ " version" , config.version,
64+ " comment" , config.comment,
6865 " arch" , arch
6966 ]
7067 )
7168 # Copy icons
7269 cpFile (config.iconPath, " AppDir/.DirIcon" )
7370 cpFile (config.svgIconPath, & " AppDir/{ config.name} .svg " )
7471
75- if config.appstreamPath.isSome :
72+ if config.appstreamPath.len > 0 :
7673 mkDir (" AppDir/usr/share/metainfo" )
77- cpFile (config.appstreamPath.get , & " AppDir/usr/share/metainfo/{ config.name} .appdata.xml " )
74+ cpFile (config.appstreamPath, & " AppDir/usr/share/metainfo/{ config.name} .appdata.xml " )
7875
7976 # Get appimagetool
8077 var appimagetoolPath = " appimagetool"
@@ -83,15 +80,15 @@ task buildapp, "Build the AppImage":
8380 exec (& " { appimagetoolPath} --help" )
8481 except OSError :
8582 appimagetoolPath = " ./appimagetool-x86_64.AppImage"
86- if not existsFile (appimagetoolPath):
83+ if not fileExists (appimagetoolPath):
8784 echo & " Downloading { appimagetoolPath} "
88- exec & " wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O " , appimagetoolPath
85+ exec & " wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O { appimagetoolPath} "
8986 exec & " chmod +x { appimagetoolPath} "
9087
9188 # Actually use appimagetool to build the AppImage
9289 if config.ghRepo.isSome:
9390 echo " Building updateable AppImage"
94- exec & " { appimagetoolPath} -u \" gh-releases-zsync|{ config.ghRepo.get[ 0 ] } |{ config.ghRepo.get[ 0 ] } |latest|{ config.name} -*-{ arch} .AppImage.zsync\" AppDir { appimagePath} "
91+ exec & " { appimagetoolPath} -u \" gh-releases-zsync|{ config.ghRepo.get.user } |{ config.ghRepo.get.repo } |latest|{ config.name} -*-{ arch} .AppImage.zsync\" AppDir { appimagePath} "
9592 else :
9693 echo & " ghRepo not defined. Skipping updateable AppImage "
9794 exec & " { appimagetoolPath} AppDir { appimagePath} "
0 commit comments