# Contributor: Jakub Jirutka # Maintainer: Jakub Jirutka # # WARNING: Coroutines does not work and there may be more breakages! global pkgname := 'nim' global pkgver := '0.17.0' global pkgrel := '0' global pkgdesc := '"A systems and applications programming language'" global url := '"https://nim-lang.org/'" global arch := '"all'" global license := '"MIT'" global checkdepends := '"sqlite-libs nodejs'" global subpackages := ""$pkgname-doc nimsuggest niminst"" global source := ""https://nim-lang.org/download/$pkgname-$pkgver.tar.xz $pkgname-csources-$pkgver.tar.gz::https://github.com/nim-lang/csources/archive/v$pkgver.tar.gz niminst-fix-paths.patch nim-config-fix-paths.patch"" global builddir := ""$srcdir/$pkgname-$pkgver"" # Don't run tests on armhf, it'd take eternity... matchstr $CARCH { armhf { global options := '"!check'"} } proc prepare { mv "$srcdir"/csources-$pkgver "$builddir"/csources default_prepare } proc build { cd "$builddir"/csources msg2 "Building nim csources..." ./build.sh cd .. msg2 "Building koch..." ./bin/nim compile -d:release koch msg2 "Building nim..." ./koch boot -d:release msg2 "Building nimsuggest..." ./bin/nim compile -d:release nimsuggest/nimsuggest.nim } proc check { cd $builddir # XXX: Some tests fail! ./koch tests --pedantic --targets="c js" all || true } proc package { cd $builddir env DESTDIR=$pkgdir ./koch install /usr/bin cd $pkgdir mkdir -p usr/include var file = ''; for file in [usr/lib/nim/*.h] { mv $file usr/include/ ln -s ../../include/$(file##*/) usr/lib/nim/$(file##*/) } } proc nimsuggest { global pkgdesc := '"idetools for the nim language'" install -D -m 755 "$builddir"/nimsuggest/nimsuggest \ "$subpkgdir"/usr/bin/nimsuggest } proc niminst { global pkgdesc := '"A tool to generate an installer for a Nim program'" install -D -m 755 "$builddir"/tools/niminst/niminst \ "$subpkgdir"/usr/bin/niminst } global sha512sums := '"90d709b39746fac5582b9df69d3eb9e3b7a39563a98f7a3002f00716b936e4e0d2be47d8b877878318692e6e2b85c08077dfcc20d9059573a1967402c244894b nim-0.17.0.tar.xz fbf64d347e25da48d5237eef35209774f0e542975465c5d2cd98878f10ea0ab62ad1404758131543b8cf634afabc90d85e9e59dec96eae9bb60fffb88d204d92 nim-csources-0.17.0.tar.gz 4ab36c5d8772567ba09b536e3dd91ddcf253892056751318ccbfce7ac24f0a646bfcd94f5dadc823c9a8394bea9614fede20c1805638052ebdbe7b5bafba4f05 niminst-fix-paths.patch 813eb4cb93b0e9f12cb7666bef65c583390008ec09bc850f43f621688dc809bc51c105898095a8ef6316fbef49ac657a7abc75d74ad7b8cb3919c8f1a721af02 nim-config-fix-paths.patch'" (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgname) op:Equal rhs:{(nim)} spids:[12])] spids: [12] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgver) op:Equal rhs:{(0.17.0)} spids:[15])] spids: [15] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgrel) op:Equal rhs:{(0)} spids:[18])] spids: [18] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("A systems and applications programming language"))} spids: [21] ) ] spids: [21] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:url) op: Equal rhs: {(DQ ("https://nim-lang.org/"))} spids: [26] ) ] spids: [26] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (all))} spids:[31])] spids: [31] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:license) op:Equal rhs:{(DQ (MIT))} spids:[36])] spids: [36] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:checkdepends) op: Equal rhs: {(DQ ("sqlite-libs nodejs"))} spids: [41] ) ] spids: [41] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:subpackages) op: Equal rhs: {(DQ ($ VSub_Name "$pkgname") ("-doc nimsuggest niminst"))} spids: [46] ) ] spids: [46] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:source) op: Equal rhs: { (DQ ("https://nim-lang.org/download/") ($ VSub_Name "$pkgname") (-) ($ VSub_Name "$pkgver") (".tar.xz\n") ("\t") ($ VSub_Name "$pkgname") (-csources-) ($ VSub_Name "$pkgver") (".tar.gz::https://github.com/nim-lang/csources/archive/v") ($ VSub_Name "$pkgver") (".tar.gz\n") ("\tniminst-fix-paths.patch\n") ("\tnim-config-fix-paths.patch") ) } spids: [52] ) ] spids: [52] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:builddir) op: Equal rhs: {(DQ ($ VSub_Name "$srcdir") (/) ($ VSub_Name "$pkgname") (-) ($ VSub_Name "$pkgver"))} spids: [70] ) ] spids: [70] ) (Case to_match: {(DQ ($ VSub_Name "$CARCH"))} arms: [ (case_arm pat_list: [{(armhf)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:options) op: Equal rhs: {(DQ ("!check"))} spids: [95] ) ] spids: [95] ) ] spids: [92 93 99 -1] ) ] spids: [83 89 101] ) (FuncDef name: prepare body: (BraceGroup children: [ (C {(mv)} {(DQ ($ VSub_Name "$srcdir")) (/csources-) ($ VSub_Name "$pkgver")} {(DQ ($ VSub_Name "$builddir")) (/csources)} ) (C {(default_prepare)}) ] spids: [108] ) spids: [104 107] ) (FuncDef name: build body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir")) (/csources)}) (C {(msg2)} {(DQ ("Building nim csources..."))}) (C {(./build.sh)}) (C {(cd)} {(..)}) (C {(msg2)} {(DQ ("Building koch..."))}) (C {(./bin/nim)} {(compile)} {(-d) (Lit_Other ":") (release)} {(koch)}) (C {(msg2)} {(DQ ("Building nim..."))}) (C {(./koch)} {(boot)} {(-d) (Lit_Other ":") (release)}) (C {(msg2)} {(DQ ("Building nimsuggest..."))}) (C {(./bin/nim)} {(compile)} {(-d) (Lit_Other ":") (release)} {(nimsuggest/nimsuggest.nim)}) ] spids: [134] ) spids: [130 133] ) (FuncDef name: check body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (AndOr children: [ (C {(./koch)} {(tests)} {(--pedantic)} {(--targets) (Lit_Other "=") (DQ ("c js"))} {(all)}) (C {(true)}) ] op_id: Op_DPipe ) ] spids: [223] ) spids: [219 222] ) (FuncDef name: package body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (SimpleCommand words: [{(./koch)} {(install)} {(/usr/bin)}] more_env: [(env_pair name:DESTDIR val:{(DQ ($ VSub_Name "$pkgdir"))} spids:[272])] ) (C {(cd)} {(DQ ($ VSub_Name "$pkgdir"))}) (C {(mkdir)} {(-p)} {(usr/include)}) (Sentence child: (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:file) op:Equal spids:[301])] spids: [299] ) terminator: ) (ForEach iter_name: file iter_words: [{(usr/lib/nim/) (Lit_Other "*") (.h)}] do_arg_iter: False body: (DoGroup children: [ (C {(mv)} {($ VSub_Name "$file")} {(usr/include/)}) (C {(ln)} {(-s)} {(../../include/) (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_DPound arg_word:{("*") (Lit_Slash /)}) spids: [330 335] ) } {(usr/lib/nim/) (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_DPound arg_word:{("*") (Lit_Slash /)}) spids: [338 343] ) } ) ] spids: [315 346] ) spids: [309 313] ) ] spids: [262] ) spids: [258 261] ) (FuncDef name: nimsuggest body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("idetools for the nim language"))} spids: [358] ) ] spids: [358] ) (C {(install)} {(-D)} {(-m)} {(755)} {(DQ ($ VSub_Name "$builddir")) (/nimsuggest/nimsuggest)} {(DQ ($ VSub_Name "$subpkgdir")) (/usr/bin/nimsuggest)} ) ] spids: [355] ) spids: [351 354] ) (FuncDef name: niminst body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("A tool to generate an installer for a Nim program"))} spids: [395] ) ] spids: [395] ) (C {(install)} {(-D)} {(-m)} {(755)} {(DQ ($ VSub_Name "$builddir")) (/tools/niminst/niminst)} {(DQ ($ VSub_Name "$subpkgdir")) (/usr/bin/niminst)} ) ] spids: [392] ) spids: [388 391] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sha512sums) op: Equal rhs: { (DQ ( "90d709b39746fac5582b9df69d3eb9e3b7a39563a98f7a3002f00716b936e4e0d2be47d8b877878318692e6e2b85c08077dfcc20d9059573a1967402c244894b nim-0.17.0.tar.xz\n" ) ( "fbf64d347e25da48d5237eef35209774f0e542975465c5d2cd98878f10ea0ab62ad1404758131543b8cf634afabc90d85e9e59dec96eae9bb60fffb88d204d92 nim-csources-0.17.0.tar.gz\n" ) ( "4ab36c5d8772567ba09b536e3dd91ddcf253892056751318ccbfce7ac24f0a646bfcd94f5dadc823c9a8394bea9614fede20c1805638052ebdbe7b5bafba4f05 niminst-fix-paths.patch\n" ) ( "813eb4cb93b0e9f12cb7666bef65c583390008ec09bc850f43f621688dc809bc51c105898095a8ef6316fbef49ac657a7abc75d74ad7b8cb3919c8f1a721af02 nim-config-fix-paths.patch" ) ) } spids: [425] ) ] spids: [425] ) ] )