# Maintainer: Natanael Copa global _flavor := $(FLAVOR:-grsec) global _kpkg := "linux-$_flavor" global _realname := 'flashcache' global _name := "$_realname-$_flavor" global _kver := '4.4.14' global _kpkgrel := '1' global _realver := '3.1.2' global _mypkgrel := '0' # source the kernel version if test -f ../linux-$_flavor/APKBUILD { source ../linux-$_flavor/APKBUILD test $_kver != $pkgver && die "$_name: Please update _kver to $pkgver" test $_kpkgrel != $pkgrel && die "$_name: Please update _kpkgrel to $pkgrel" } global _kernelver := "$_kver-r$_kpkgrel" global _abi_release := "$(_kver)-$(_kpkgrel)-$(_flavor)" global pkgname := $_name global pkgver := $_kver global pkgrel := $($_kpkgrel + $_mypkgrel) global pkgdesc := '"a general purpose writeback block cache for Linux'" global url := '"https://github.com/facebook/flashcache/'" global arch := ''"" global license := '"GPL'" global depends := ""linux-$(_flavor)=$(_kernelver)"" global makedepends := ""linux-$(_flavor)-dev=$(_kernelver)"" global install := '' global install_if := ""linux-$_flavor=$_kernelver $_realname"" global subpackages := '' global source := ""$_realname-$_realver.tar.gz::https://github.com/facebook/flashcache/archive/$_realver.tar.gz depmod.patch kernel-3.18.patch kernel-4.2.patch "" # override kernel's prepare() proc prepare { cd "$srcdir/$_realname-$_realver" for i in [$source] { matchstr $i { *.patch { msg $i; patch -p1 -i "$srcdir"/$i || return 1} } } } proc build { cd "$srcdir/$_realname-$_realver"/src make CC="$(CC:-gcc)" KCFLAGS="-fno-pie" \ KERNEL_SOURCE_VERSION=$_abi_release modules \ || return 1 } proc package { cd "$srcdir/$_realname-$_realver"/src make DESTDIR="$pkgdir" CC="$(CC:-gcc)" \ KCFLAGS="-fno-pie" \ KERNEL_SOURCE_VERSION=$_abi_release \ DEPMOD=: modules_install || return 1 } global md5sums := '"b569604f7efce881e87752c9efc01965 flashcache-3.1.2.tar.gz ef9bd511f2b964bf22863814679bfba3 depmod.patch 24462dd41268d045bd91ba88274115fb kernel-3.18.patch 29d3529370a569327a9a258f88dd30cc kernel-4.2.patch'" global sha256sums := '"f1d97395c744850a909e5f57b69a0ce87c773f2761e0147dd78de5fec3ea61e2 flashcache-3.1.2.tar.gz 05c0fefaaaea624c12b9ff3e66e0029b8dcc0c0d3246e10683bf217e10b3c450 depmod.patch 34a008e4c2382c757e030280fc6ce66c739251ca7883ef7d45feba44e2a05134 kernel-3.18.patch cf21af11f507fe81094933e3c79379067661a32d834f2ac2378a4dd67f50d080 kernel-4.2.patch'" global sha512sums := '"03d88b2622b7a41b66cd5cf4637be52c3bd6f25ac1099d7ea247e8e9bdad8a040bf0d10bcee2f49de8621f0da755dfd8a03810d709faaa330b78b6c564872e72 flashcache-3.1.2.tar.gz 55543347d76171352199294a29bcf19ba6b511f57e63c2a4254c4ebad8829912c65cdbef95bc7485d079dd66c56c1624b9570e7faf038cc5cb80e81079fcadc6 depmod.patch f09255bdc66711e35736a018f870b7a398bf05e3f1e8e4574a84967672152c510a4d6f8687ced49f52cfa63c57b407a393805e4df900de8ee6817e9c8c455306 kernel-3.18.patch 82b1c885e2884a1ece0e003b726067ed0818f40f92689145b15aff1e15e14e5c34ed9b38f35010519d584dd5c6d5dda3393ed09d716bd1bf9aa4e85524fdd2a2 kernel-4.2.patch'" (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_flavor) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(grsec)}) spids: [4 8] ) } spids: [3] ) ] spids: [3] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_kpkg) op: Equal rhs: {(linux-) ($ VSub_Name "$_flavor")} spids: [10] ) ] spids: [10] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:_realname) op:Equal rhs:{(flashcache)} spids:[14])] spids: [14] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_name) op: Equal rhs: {($ VSub_Name "$_realname") (-) ($ VSub_Name "$_flavor")} spids: [17] ) ] spids: [17] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:_kver) op:Equal rhs:{(4.4.14)} spids:[23])] spids: [23] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:_kpkgrel) op:Equal rhs:{(1)} spids:[26])] spids: [26] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:_realver) op:Equal rhs:{(3.1.2)} spids:[30])] spids: [30] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:_mypkgrel) op:Equal rhs:{(0)} spids:[33])] spids: [33] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-f)} {(../linux-) ($ VSub_Name "$_flavor") (/APKBUILD)} {(Lit_Other "]")} ) terminator: ) ] action: [ (C {(.)} {(../linux-) ($ VSub_Name "$_flavor") (/APKBUILD)}) (AndOr children: [ (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$_kver"))} {(KW_Bang "!") (Lit_Other "=")} {(DQ ($ VSub_Name "$pkgver"))} {(Lit_Other "]")} ) (C {(die)} {(DQ ($ VSub_Name "$_name") (": Please update _kver to ") ($ VSub_Name "$pkgver"))} ) ] op_id: Op_DAmp ) (AndOr children: [ (C {(Lit_Other "[")} {(DQ ($ VSub_Name "$_kpkgrel"))} {(KW_Bang "!") (Lit_Other "=")} {(DQ ($ VSub_Name "$pkgrel"))} {(Lit_Other "]")} ) (C {(die)} { (DQ ($ VSub_Name "$_name") (": Please update _kpkgrel to ") ($ VSub_Name "$pkgrel")) } ) ] op_id: Op_DAmp ) ] spids: [-1 53] ) ] spids: [-1 114] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_kernelver) op: Equal rhs: {($ VSub_Name "$_kver") (-r) ($ VSub_Name "$_kpkgrel")} spids: [117] ) ] spids: [117] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_abi_release) op: Equal rhs: {(${ VSub_Name _kver) (-) (${ VSub_Name _kpkgrel) (-) (${ VSub_Name _flavor)} spids: [122] ) ] spids: [122] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgname) op: Equal rhs: {($ VSub_Name "$_name")} spids: [136] ) ] spids: [136] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgver) op: Equal rhs: {($ VSub_Name "$_kver")} spids: [139] ) ] spids: [139] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgrel) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name "$_kpkgrel")}) right: (ArithWord w:{($ VSub_Name "$_mypkgrel")}) ) spids: [143 150] ) } spids: [142] ) ] spids: [142] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("a general purpose writeback block cache for Linux"))} spids: [152] ) ] spids: [152] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:url) op: Equal rhs: {(DQ ("https://github.com/facebook/flashcache/"))} spids: [157] ) ] spids: [157] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ )} spids:[162])] spids: [162] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:license) op:Equal rhs:{(DQ (GPL))} spids:[166])] spids: [166] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:depends) op: Equal rhs: {(DQ (linux-) (${ VSub_Name _flavor) ("=") (${ VSub_Name _kernelver))} spids: [171] ) ] spids: [171] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:makedepends) op: Equal rhs: {(DQ (linux-) (${ VSub_Name _flavor) ("-dev=") (${ VSub_Name _kernelver))} spids: [183] ) ] spids: [183] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:install) op:Equal rhs:{(SQ )} spids:[195])] spids: [195] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:install_if) op: Equal rhs: { (DQ (linux-) ($ VSub_Name "$_flavor") ("=") ($ VSub_Name "$_kernelver") (" ") ($ VSub_Name "$_realname") ) } spids: [197] ) ] spids: [197] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:subpackages) op:Equal rhs:{(SQ )} spids:[207])] spids: [207] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:source) op: Equal rhs: { (DQ ($ VSub_Name "$_realname") (-) ($ VSub_Name "$_realver") (".tar.gz::https://github.com/facebook/flashcache/archive/") ($ VSub_Name "$_realver") (".tar.gz\n") ("\tdepmod.patch\n") ("\tkernel-3.18.patch\n") ("\tkernel-4.2.patch\n") ("\t") ) } spids: [209] ) ] spids: [209] ) (FuncDef name: prepare body: (BraceGroup children: [ (C {(cd)} { (DQ ($ VSub_Name "$srcdir") (/) ($ VSub_Name "$_realname") (-) ($ VSub_Name "$_realver")) } ) (ForEach iter_name: i iter_words: [{($ VSub_Name "$source")}] do_arg_iter: False body: (DoGroup children: [ (Case to_match: {($ VSub_Name "$i")} arms: [ (case_arm pat_list: [{(Lit_Other "*") (.patch)}] action: [ (Sentence child: (C {(msg)} {($ VSub_Name "$i")}) terminator: ) (AndOr children: [ (C {(patch)} {(-p1)} {(-i)} {(DQ ($ VSub_Name "$srcdir")) (/) ($ VSub_Name "$i")} ) (ControlFlow token: arg_word: {(1)} ) ] op_id: Op_DPipe ) ] spids: [265 267 291 -1] ) ] spids: [258 262 294] ) ] spids: [255 297] ) spids: [251 253] ) ] spids: [232] ) spids: [228 231] ) (FuncDef name: build body: (BraceGroup children: [ (C {(cd)} { (DQ ($ VSub_Name "$srcdir") (/) ($ VSub_Name "$_realname") (-) ($ VSub_Name "$_realver")) (/src) } ) (AndOr children: [ (C {(make)} {(Lit_VarLike "CC=") (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(gcc)}) spids: [325 329] ) ) } {(Lit_VarLike "KCFLAGS=") (DQ (-fno-pie))} {(Lit_VarLike "KERNEL_SOURCE_VERSION=") ($ VSub_Name "$_abi_release")} {(modules)} ) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) ] spids: [306] ) spids: [302 305] ) (FuncDef name: package body: (BraceGroup children: [ (C {(cd)} { (DQ ($ VSub_Name "$srcdir") (/) ($ VSub_Name "$_realname") (-) ($ VSub_Name "$_realver")) (/src) } ) (AndOr children: [ (C {(make)} {(Lit_VarLike "DESTDIR=") (DQ ($ VSub_Name "$pkgdir"))} {(Lit_VarLike "CC=") (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(gcc)}) spids: [384 388] ) ) } {(Lit_VarLike "KCFLAGS=") (DQ (-fno-pie))} {(Lit_VarLike "KERNEL_SOURCE_VERSION=") ($ VSub_Name "$_abi_release")} {(Lit_VarLike "DEPMOD=") (Lit_Other ":")} {(modules_install)} ) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) ] spids: [359] ) spids: [355 358] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:md5sums) op: Equal rhs: { (DQ ("b569604f7efce881e87752c9efc01965 flashcache-3.1.2.tar.gz\n") ("ef9bd511f2b964bf22863814679bfba3 depmod.patch\n") ("24462dd41268d045bd91ba88274115fb kernel-3.18.patch\n") ("29d3529370a569327a9a258f88dd30cc kernel-4.2.patch") ) } spids: [419] ) ] spids: [419] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sha256sums) op: Equal rhs: { (DQ ( "f1d97395c744850a909e5f57b69a0ce87c773f2761e0147dd78de5fec3ea61e2 flashcache-3.1.2.tar.gz\n" ) ("05c0fefaaaea624c12b9ff3e66e0029b8dcc0c0d3246e10683bf217e10b3c450 depmod.patch\n") ( "34a008e4c2382c757e030280fc6ce66c739251ca7883ef7d45feba44e2a05134 kernel-3.18.patch\n" ) ("cf21af11f507fe81094933e3c79379067661a32d834f2ac2378a4dd67f50d080 kernel-4.2.patch") ) } spids: [427] ) ] spids: [427] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sha512sums) op: Equal rhs: { (DQ ( "03d88b2622b7a41b66cd5cf4637be52c3bd6f25ac1099d7ea247e8e9bdad8a040bf0d10bcee2f49de8621f0da755dfd8a03810d709faaa330b78b6c564872e72 flashcache-3.1.2.tar.gz\n" ) ( "55543347d76171352199294a29bcf19ba6b511f57e63c2a4254c4ebad8829912c65cdbef95bc7485d079dd66c56c1624b9570e7faf038cc5cb80e81079fcadc6 depmod.patch\n" ) ( "f09255bdc66711e35736a018f870b7a398bf05e3f1e8e4574a84967672152c510a4d6f8687ced49f52cfa63c57b407a393805e4df900de8ee6817e9c8c455306 kernel-3.18.patch\n" ) ( "82b1c885e2884a1ece0e003b726067ed0818f40f92689145b15aff1e15e14e5c34ed9b38f35010519d584dd5c6d5dda3393ed09d716bd1bf9aa4e85524fdd2a2 kernel-4.2.patch" ) ) } spids: [435] ) ] spids: [435] ) ] )