# Maintainer: Mitch Tishmack <mitch.tishmack@gmail.com>
global pkgname := 'ucl'
global pkgver := '1.03'
global pkgrel := '1'
global pkgdesc := '"Portable lossless data compression library written in ANSI C'"
global url := '"http://www.oberhumer.com/opensource/ucl/'"
global arch := '"all'"
global license := '"GPL2'"
global makedepends := '"file'"
global subpackages := ""$pkgname-dev""
global source := ""http://www.oberhumer.com/opensource/$pkgname/download/$pkgname-$pkgver.tar.gz
	0001-Static-assert.patch""

proc prepare {
	default_prepare || return 1
	update_config_sub || return 1
	update_config_guess || return 1
}

proc build {
	cd $builddir

	./configure \
		--prefix=/usr \
		--enable-shared \
		--enable-static \
		|| return 1
	make || return 1
}

proc check {
	cd $builddir
	./examples/simple
}

proc package {
	cd $builddir
	make DESTDIR="$pkgdir" install || return 1
}

global sha512sums := '"7dd1824d01b4bb41ee03bbceddc634a9f7f910d235e5cca163d783680d6743f0f3cc309bbbcc1e094d897d549d3805a555f9093b4d77805443d896dd1862aa34  ucl-1.03.tar.gz
24a34de871fcfa919985afc29c60496b1f0e730550e8387f212a5229f32ccade4178d1221574d86c36d025c08b3b5ed6d236f2b4d740436afe0451ae9050f890  0001-Static-assert.patch'"
(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:pkgname) op:Equal rhs:{(ucl)} spids:[3])]
      spids: [3]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:pkgver) op:Equal rhs:{(1.03)} spids:[6])]
      spids: [6]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:pkgrel) op:Equal rhs:{(1)} spids:[9])]
      spids: [9]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:pkgdesc)
          op: Equal
          rhs: {(DQ ("Portable lossless data compression library written in ANSI C"))}
          spids: [12]
        )
      ]
      spids: [12]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:url)
          op: Equal
          rhs: {(DQ ("http://www.oberhumer.com/opensource/ucl/"))}
          spids: [17]
        )
      ]
      spids: [17]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (all))} spids:[22])]
      spids: [22]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:license) op:Equal rhs:{(DQ (GPL2))} spids:[27])]
      spids: [27]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:makedepends) op:Equal rhs:{(DQ (file))} spids:[32])]
      spids: [32]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:subpackages)
          op: Equal
          rhs: {(DQ ($ VSub_Name "$pkgname") (-dev))}
          spids: [37]
        )
      ]
      spids: [37]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:source)
          op: Equal
          rhs: 
            {
              (DQ ("http://www.oberhumer.com/opensource/") ($ VSub_Name "$pkgname") (/download/) 
                ($ VSub_Name "$pkgname") (-) ($ VSub_Name "$pkgver") (".tar.gz\n") ("\t0001-Static-assert.patch")
              )
            }
          spids: [43]
        )
      ]
      spids: [43]
    )
    (FuncDef
      name: prepare
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (C {(default_prepare)})
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (C {(update_config_sub)})
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (C {(update_config_guess)})
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
          ]
          spids: [60]
        )
      spids: [56 59]
    )
    (FuncDef
      name: build
      body: 
        (BraceGroup
          children: [
            (C {(cd)} {(DQ ($ VSub_Name "$builddir"))})
            (AndOr
              children: [
                (C {(./configure)} {(--prefix) (Lit_Other "=") (/usr)} {(--enable-shared)} 
                  {(--enable-static)}
                )
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [(C {(make)}) (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})]
              op_id: Op_DPipe
            )
          ]
          spids: [96]
        )
      spids: [92 95]
    )
    (FuncDef
      name: check
      body: 
        (BraceGroup
          children: [(C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(./examples/simple)})]
          spids: [147]
        )
      spids: [143 146]
    )
    (FuncDef
      name: package
      body: 
        (BraceGroup
          children: [
            (C {(cd)} {(DQ ($ VSub_Name "$builddir"))})
            (AndOr
              children: [
                (C {(make)} {(Lit_VarLike "DESTDIR=") (DQ ($ VSub_Name "$pkgdir"))} {(install)})
                (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
              ]
              op_id: Op_DPipe
            )
          ]
          spids: [166]
        )
      spids: [162 165]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:sha512sums)
          op: Equal
          rhs: 
            {
              (DQ 
                (
"7dd1824d01b4bb41ee03bbceddc634a9f7f910d235e5cca163d783680d6743f0f3cc309bbbcc1e094d897d549d3805a555f9093b4d77805443d896dd1862aa34  ucl-1.03.tar.gz\n"
                ) 
                (
"24a34de871fcfa919985afc29c60496b1f0e730550e8387f212a5229f32ccade4178d1221574d86c36d025c08b3b5ed6d236f2b4d740436afe0451ae9050f890  0001-Static-assert.patch"
                )
              )
            }
          spids: [194]
        )
      ]
      spids: [194]
    )
  ]
)