# Contributor: Mitch Tishmack # Contributor: Jakub Jirutka # Maintainer: Mitch Tishmack # # Note: This abuilds downloads Haskell dependencies in the prepare phase # without any verification! global pkgname := 'idris' global pkgver := '1.0' global pkgrel := '0' global pkgdesc := '"A Language with Dependent Types'" global url := '"http://www.idris-lang.org'" global arch := '"x86_64'" global license := '"BSD3'" global depends := '"gmp-dev gcc'" global makedepends := '"ghc cabal libffi-dev ncurses-dev zlib-dev'" global subpackages := ""$pkgname-doc"" global source := ""$pkgname-$pkgver.tar.gz::https://github.com/idris-lang/Idris-dev/archive/v$pkgver.tar.gz cabal.config"" global builddir := ""$srcdir/Idris-dev-$pkgver"" export CABAL_CONFIG="$srcdir/cabal/cabal.config" proc cabal_update { msg "Updating constraints" cd $builddir # Create cabal config and fetch index. env HOME=$(CABAL_CONFIG%/*) cabal update # Resolve deps and generate fresh cabal.config with version constraints. rm -f cabal.config cabal freeze # Add version tag at the first line. sed -i "1i--$pkgver" cabal.config mv cabal.config "$startdir"/ cd $startdir abuild checksum } proc prepare { default_prepare if test $[head -n 1 "$srcdir"/cabal.config] != "--$pkgver" { die "Requirements file is outdated, run 'abuild cabal_update'" } cd $builddir # Create cabal config and fetch index. env HOME=$(CABAL_CONFIG%/*) cabal update # Cabal implicitly loads cabal.config from the project's directory. ln -sf "$srcdir"/cabal.config . # Create Cabal sandbox that will be used for all subsequent cabal # invocations. This is something like Python virtual env. cabal sandbox init # Fetch all dependencies. # XXX: This should always fetch the same versions as defined in # our cabal.config, but Cabal does not verify packages integrity! cabal fetch libffi . } proc build { cd $builddir # Build dependencies. cabal install --offline -v libffi cabal install --only-dependencies --offline -v # Note: ordering of prefixes is important! cabal configure \ --prefix='/usr' \ --docdir='$prefix/share/doc' \ --datadir='$prefix/share' \ --htmldir='$docdir/html' \ --libdir='$prefix/lib' \ --libsubdir="$pkgname" \ --datasubdir="$pkgname" \ --dynlibdir="$pkgname" \ --disable-shared \ --flags='GMP FFI standalone' cabal build } # TODO: Run upstream tests and/or figure out how to set paths to be able # to compile hello_world for check. proc check { cd $builddir ./dist/build/idris/idris --version } proc package { cd $builddir cabal copy --destdir="$pkgdir" cd $pkgdir # We don't need the haskell shared libraries or interface files. rm -r usr/lib/idris mkdir -p usr/share/doc/idris/ \ usr/share/licenses/$pkgname/ mv usr/share/idris/docs usr/share/doc/idris mv usr/share/doc/LICENSE usr/share/licenses/$pkgname/ } global sha512sums := '"a350004a8510f01d1cc8f965a9a4e2dab219f003980b98354ebb5ae42f73b32c90c98dce193943e9709d994cb92ad35814a46b79412a1afc85d42e1018c6ba10 idris-1.0.tar.gz e078892987816012034295be81118fbc710e3dbf08af18257e5390fc159bb5d64e1aae8a802835ca92b1e0d065524833d657bc9edffc9ebefc8cb5c02935694a cabal.config'" (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgname) op:Equal rhs:{(idris)} spids:[18])] spids: [18] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgver) op:Equal rhs:{(1.0)} spids:[21])] spids: [21] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgrel) op:Equal rhs:{(0)} spids:[24])] spids: [24] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("A Language with Dependent Types"))} spids: [27] ) ] spids: [27] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:url) op: Equal rhs: {(DQ ("http://www.idris-lang.org"))} spids: [32] ) ] spids: [32] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (x86_64))} spids:[37])] spids: [37] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:license) op:Equal rhs:{(DQ (BSD3))} spids:[42])] spids: [42] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:depends) op:Equal rhs:{(DQ ("gmp-dev gcc"))} spids:[47])] spids: [47] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:makedepends) op: Equal rhs: {(DQ ("ghc cabal libffi-dev ncurses-dev zlib-dev"))} spids: [52] ) ] spids: [52] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:subpackages) op: Equal rhs: {(DQ ($ VSub_Name "$pkgname") (-doc))} spids: [57] ) ] spids: [57] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:source) op: Equal rhs: { (DQ ($ VSub_Name "$pkgname") (-) ($ VSub_Name "$pkgver") (".tar.gz::https://github.com/idris-lang/Idris-dev/archive/v") ($ VSub_Name "$pkgver") (".tar.gz\n") ("\tcabal.config") ) } spids: [63] ) ] spids: [63] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:builddir) op: Equal rhs: {(DQ ($ VSub_Name "$srcdir") (/Idris-dev-) ($ VSub_Name "$pkgver"))} spids: [74] ) ] spids: [74] ) (C {(export)} {(Lit_VarLike "CABAL_CONFIG=") (DQ ($ VSub_Name "$srcdir") (/cabal/cabal.config))}) (FuncDef name: cabal_update body: (BraceGroup children: [ (C {(msg)} {(DQ ("Updating constraints"))}) (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (SimpleCommand words: [{(cabal)} {(update)}] more_env: [ (env_pair name: HOME val: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /) ("*")}) spids: [120 125] ) ) } spids: [118] ) ] ) (C {(rm)} {(-f)} {(cabal.config)}) (C {(cabal)} {(freeze)}) (C {(sed)} {(-i)} {(DQ (1i--) ($ VSub_Name "$pkgver"))} {(cabal.config)}) (C {(mv)} {(cabal.config)} {(DQ ($ VSub_Name "$startdir")) (/)}) (C {(cd)} {(DQ ($ VSub_Name "$startdir"))}) (C {(abuild)} {(checksum)}) ] spids: [95] ) spids: [91 94] ) (FuncDef name: prepare body: (BraceGroup children: [ (C {(default_prepare)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(head)} {(-n)} {(1)} {(DQ ($ VSub_Name "$srcdir")) (/cabal.config)} ) ] ) left_token: spids: [209 220] ) ) } {(KW_Bang "!") (Lit_Other "=")} {(DQ (--) ($ VSub_Name "$pkgver"))} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(die)} {(DQ ("Requirements file is outdated, run 'abuild cabal_update'"))}) ] spids: [-1 234] ) ] spids: [-1 244] ) (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (SimpleCommand words: [{(cabal)} {(update)}] more_env: [ (env_pair name: HOME val: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /) ("*")}) spids: [262 267] ) ) } spids: [260] ) ] ) (C {(ln)} {(-sf)} {(DQ ($ VSub_Name "$srcdir")) (/cabal.config)} {(.)}) (C {(cabal)} {(sandbox)} {(init)}) (C {(cabal)} {(fetch)} {(libffi)} {(.)}) ] spids: [197] ) spids: [193 196] ) (FuncDef name: build body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(cabal)} {(install)} {(--offline)} {(-v)} {(libffi)}) (C {(cabal)} {(install)} {(--only-dependencies)} {(--offline)} {(-v)}) (C {(cabal)} {(configure)} {(--prefix) (Lit_Other "=") (SQ )} {(--docdir) (Lit_Other "=") (SQ <"$prefix/share/doc">)} {(--datadir) (Lit_Other "=") (SQ <"$prefix/share">)} {(--htmldir) (Lit_Other "=") (SQ <"$docdir/html">)} {(--libdir) (Lit_Other "=") (SQ <"$prefix/lib">)} {(--libsubdir) (Lit_Other "=") (DQ ($ VSub_Name "$pkgname"))} {(--datasubdir) (Lit_Other "=") (DQ ($ VSub_Name "$pkgname"))} {(--dynlibdir) (Lit_Other "=") (DQ ($ VSub_Name "$pkgname"))} {(--disable-shared)} {(--flags) (Lit_Other "=") (SQ <"GMP FFI standalone">)} ) (C {(cabal)} {(build)}) ] spids: [336] ) spids: [332 335] ) (FuncDef name: check body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(./dist/build/idris/idris)} {(--version)}) ] spids: [476] ) spids: [472 475] ) (FuncDef name: package body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(cabal)} {(copy)} {(--destdir) (Lit_Other "=") (DQ ($ VSub_Name "$pkgdir"))}) (C {(cd)} {(DQ ($ VSub_Name "$pkgdir"))}) (C {(rm)} {(-r)} {(usr/lib/idris)}) (C {(mkdir)} {(-p)} {(usr/share/doc/idris/)} {(usr/share/licenses/) ($ VSub_Name "$pkgname") (/)} ) (C {(mv)} {(usr/share/idris/docs)} {(usr/share/doc/idris)}) (C {(mv)} {(usr/share/doc/LICENSE)} {(usr/share/licenses/) ($ VSub_Name "$pkgname") (/)}) ] spids: [498] ) spids: [494 497] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sha512sums) op: Equal rhs: { (DQ ( "a350004a8510f01d1cc8f965a9a4e2dab219f003980b98354ebb5ae42f73b32c90c98dce193943e9709d994cb92ad35814a46b79412a1afc85d42e1018c6ba10 idris-1.0.tar.gz\n" ) ( "e078892987816012034295be81118fbc710e3dbf08af18257e5390fc159bb5d64e1aae8a802835ca92b1e0d065524833d657bc9edffc9ebefc8cb5c02935694a cabal.config" ) ) } spids: [572] ) ] spids: [572] ) ] )