# Contributor: Cameron Banta # Maintainer: Cameron Banta global pkgname := 'ghostscript' global pkgver := '9.22' global pkgrel := '0' global pkgdesc := '"An interpreter for the PostScript language and for PDF'" global url := '"http://ghostscript.com/'" global arch := '"all'" global license := '"GPL3'" global makedepends := '"autoconf automake libjpeg-turbo-dev libpng-dev jasper-dev expat-dev zlib-dev tiff-dev freetype-dev lcms2-dev gtk+3.0-dev cups-dev libtool jbig2dec-dev openjpeg-dev'" global subpackages := ""$pkgname-dbg $pkgname-doc $pkgname-dev $pkgname-gtk"" global source := ""https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs$(pkgver/./)/ghostscript-$pkgver.tar.gz ghostscript-system-zlib.patch fix-sprintf.patch "" global builddir := ""$srcdir/$pkgname-$pkgver"" # secfixes: # 9.21-r2: # - CVE-2017-8291 # 9.21-r3: # - CVE-2017-7207 # - CVE-2017-5951 proc prepare { cd $builddir default_prepare || return 1 # apply patches # force it to use system-libs rm -r jpeg libpng zlib tiff lcms2 cups/libs jbig2dec \ freetype || return 1 # fix parallel builds sed -i -e 's/ECHO_XE/ECHOGS_XE/g' \ -e 's/^\($(GLOBJ)md5.$(OBJ) :.*\)/\1 $(ECHOGS_XE)/' \ base/lib.mak || return 1 aclocal && autoconf --force || return 1 cd $builddir/ijs libtoolize --force && aclocal && autoconf && automake --add-missing } proc build{ # build ijs cd "$builddir"/ijs ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --enable-shared \ --disable-static \ || return 1 make || return 1 cd $builddir # --disable-compile-inits is needed to link with system-zlib ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --docdir=/usr/share/doc/"$pkgname" \ --enable-dynamic \ --disable-static \ --with-system-libtiff \ --with-ijs \ --with-jbig2dec \ --without-omni \ --enable-gtk \ --with-drivers=ALL \ --with-fontpath=/usr/share/fonts/Type1:/usr/share/fonts \ --disable-compile-inits \ || return 1 make so all || return 1 } proc package { cd $builddir make -j1 DESTDIR="$pkgdir" install soinstall || return 1 cd "$builddir"/ijs make -j1 DESTDIR="$pkgdir" install || return 1 cd .. # create empty dir for future fonts mkdir -p "$(pkgdir)"/usr/share/fonts/Type1 # license and copying install -m644 -D "$srcdir/$pkgname-$pkgver/LICENSE" \ "$pkgdir/usr/share/licenses/$pkgname/LICENSE" install -m644 -D "$srcdir/$pkgname-$pkgver/doc/COPYING" \ "$pkgdir/usr/share/licenses/$pkgname/COPYING" # make the doc and examples more alpine like # (the --docdir above doesn't seem to work so good) mkdir -p "$pkgdir/usr/share/doc/$pkgname" mv "$pkgdir/usr/share/$pkgname/$pkgver/doc" \ "$pkgdir/usr/share/doc/$pkgname" || return 1 mv "$pkgdir/usr/share/$pkgname/$pkgver/examples" \ "$pkgdir/usr/share/doc/$pkgname" || return 1 } proc gtk { global pkgdesc := '"A GTK-enabled PostScript interpreter and renderer'" install -d "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/gsx "$subpkgdir"/usr/bin/ } global sha512sums := '"599ba003e168d302e327ea7c2b83a4247059a1b7222452cbea4966dac448a79e8d7f07a1f287fa0c14cfa5269bb623382ed02fb3ea3a0e526dae08aaa1cd8b89 ghostscript-9.22.tar.gz 70721e3a335afa5e21d4e6cf919119010bd4544a03ab8f53f5325c173902221ad9b88c118b4bfeee80b3e1956bcdbaf4c53f64ae7fb81f5ba57dbc956750c482 ghostscript-system-zlib.patch beefcf395f7f828e1b81c088022c08a506e218f27535b9de01e0f0edf7979b435316c318fa676771630f6ad16ff1ab059cd68aa128ed97e5a9f2f3fa840200c4 fix-sprintf.patch'" (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgname) op:Equal rhs:{(ghostscript)} spids:[6])] spids: [6] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgver) op:Equal rhs:{(9.22)} spids:[9])] spids: [9] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgrel) op:Equal rhs:{(0)} spids:[12])] spids: [12] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("An interpreter for the PostScript language and for PDF"))} spids: [15] ) ] spids: [15] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:url) op: Equal rhs: {(DQ ("http://ghostscript.com/"))} spids: [20] ) ] spids: [20] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (all))} spids:[25])] spids: [25] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:license) op:Equal rhs:{(DQ (GPL3))} spids:[30])] spids: [30] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:makedepends) op: Equal rhs: { (DQ ("autoconf automake libjpeg-turbo-dev libpng-dev jasper-dev expat-dev\n") ("\tzlib-dev tiff-dev freetype-dev lcms2-dev gtk+3.0-dev\n") ("\tcups-dev libtool jbig2dec-dev openjpeg-dev") ) } spids: [35] ) ] spids: [35] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:subpackages) op: Equal rhs: { (DQ ($ VSub_Name "$pkgname") ("-dbg ") ($ VSub_Name "$pkgname") ("-doc ") ($ VSub_Name "$pkgname") ("-dev ") ($ VSub_Name "$pkgname") (-gtk) ) } spids: [42] ) ] spids: [42] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:source) op: Equal rhs: { (DQ ("https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs") (BracedVarSub token: suffix_op: (PatSub pat: {(.)} replace: {(SQ )} do_all: False do_prefix: False do_suffix: False ) spids: [57 62] ) (/ghostscript-) ($ VSub_Name "$pkgver") (".tar.gz\n") ("\tghostscript-system-zlib.patch\n") ("\tfix-sprintf.patch\n") ("\t") ) } spids: [54] ) ] spids: [54] ) (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: [71] ) ] spids: [71] ) (FuncDef name: prepare body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (AndOr children: [ (C {(default_prepare)}) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) (AndOr children: [ (C {(rm)} {(-r)} {(jpeg)} {(libpng)} {(zlib)} {(tiff)} {(lcms2)} {(cups/libs)} {(jbig2dec)} {(freetype)} ) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) (AndOr children: [ (C {(sed)} {(-i)} {(-e)} {(SQ )} {(-e)} {(SQ <"s/^\\($(GLOBJ)md5.$(OBJ) :.*\\)/\\1 $(ECHOGS_XE)/">)} {(base/lib.mak)} ) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) (AndOr children: [ (C {(aclocal)}) (AndOr children: [ (C {(autoconf)} {(--force)}) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) ] op_id: Op_DAmp ) (C {(cd)} {($ VSub_Name "$builddir") (/ijs)}) (AndOr children: [ (C {(libtoolize)} {(--force)}) (AndOr children: [ (C {(aclocal)}) (AndOr children: [(C {(autoconf)}) (C {(automake)} {(--add-missing)})] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [104] ) spids: [100 103] ) (FuncDef name: build body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir")) (/ijs)}) (AndOr children: [ (C {(./configure)} {(--build) (Lit_Other "=") ($ VSub_Name "$CBUILD")} {(--host) (Lit_Other "=") ($ VSub_Name "$CHOST")} {(--prefix) (Lit_Other "=") (/usr)} {(--enable-shared)} {(--disable-static)} ) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) (AndOr children: [(C {(make)}) (ControlFlow token: arg_word:{(1)})] op_id: Op_DPipe ) (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (AndOr children: [ (C {(./configure)} {(--build) (Lit_Other "=") ($ VSub_Name "$CBUILD")} {(--host) (Lit_Other "=") ($ VSub_Name "$CHOST")} {(--prefix) (Lit_Other "=") (/usr)} {(--sysconfdir) (Lit_Other "=") (/etc)} {(--mandir) (Lit_Other "=") (/usr/share/man)} {(--infodir) (Lit_Other "=") (/usr/share/info)} {(--docdir) (Lit_Other "=") (/usr/share/doc/) (DQ ($ VSub_Name "$pkgname"))} {(--enable-dynamic)} {(--disable-static)} {(--with-system-libtiff)} {(--with-ijs)} {(--with-jbig2dec)} {(--without-omni)} {(--enable-gtk)} {(--with-drivers) (Lit_Other "=") (ALL)} {(--with-fontpath) (Lit_Other "=") (/usr/share/fonts/Type1) (Lit_Other ":") (/usr/share/fonts) } {(--disable-compile-inits)} ) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) (AndOr children: [ (C {(make)} {(so)} {(all)}) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) ] spids: [241] ) spids: [238 241] ) (FuncDef name: package body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (AndOr children: [ (C {(make)} {(-j1)} {(Lit_VarLike "DESTDIR=") (DQ ($ VSub_Name "$pkgdir"))} {(install)} {(soinstall)} ) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) (C {(cd)} {(DQ ($ VSub_Name "$builddir")) (/ijs)}) (AndOr children: [ (C {(make)} {(-j1)} {(Lit_VarLike "DESTDIR=") (DQ ($ VSub_Name "$pkgdir"))} {(install)}) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) (C {(cd)} {(..)}) (C {(mkdir)} {(-p)} {(DQ (${ VSub_Name pkgdir)) (/usr/share/fonts/Type1)}) (C {(install)} {(-m644)} {(-D)} { (DQ ($ VSub_Name "$srcdir") (/) ($ VSub_Name "$pkgname") (-) ($ VSub_Name "$pkgver") (/LICENSE) ) } {(DQ ($ VSub_Name "$pkgdir") (/usr/share/licenses/) ($ VSub_Name "$pkgname") (/LICENSE))} ) (C {(install)} {(-m644)} {(-D)} { (DQ ($ VSub_Name "$srcdir") (/) ($ VSub_Name "$pkgname") (-) ($ VSub_Name "$pkgver") (/doc/COPYING) ) } {(DQ ($ VSub_Name "$pkgdir") (/usr/share/licenses/) ($ VSub_Name "$pkgname") (/COPYING))} ) (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name "$pkgdir") (/usr/share/doc/) ($ VSub_Name "$pkgname"))}) (AndOr children: [ (C {(mv)} { (DQ ($ VSub_Name "$pkgdir") (/usr/share/) ($ VSub_Name "$pkgname") (/) ($ VSub_Name "$pkgver") (/doc) ) } {(DQ ($ VSub_Name "$pkgdir") (/usr/share/doc/) ($ VSub_Name "$pkgname"))} ) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) (AndOr children: [ (C {(mv)} { (DQ ($ VSub_Name "$pkgdir") (/usr/share/) ($ VSub_Name "$pkgname") (/) ($ VSub_Name "$pkgver") (/examples) ) } {(DQ ($ VSub_Name "$pkgdir") (/usr/share/doc/) ($ VSub_Name "$pkgname"))} ) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) ] spids: [436] ) spids: [432 435] ) (FuncDef name: gtk body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("A GTK-enabled PostScript interpreter and renderer"))} spids: [651] ) ] spids: [651] ) (C {(install)} {(-d)} {(DQ ($ VSub_Name "$subpkgdir")) (/usr/bin)}) (C {(mv)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/bin/gsx)} {(DQ ($ VSub_Name "$subpkgdir")) (/usr/bin/)} ) ] spids: [648] ) spids: [644 647] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sha512sums) op: Equal rhs: { (DQ ( "599ba003e168d302e327ea7c2b83a4247059a1b7222452cbea4966dac448a79e8d7f07a1f287fa0c14cfa5269bb623382ed02fb3ea3a0e526dae08aaa1cd8b89 ghostscript-9.22.tar.gz\n" ) ( "70721e3a335afa5e21d4e6cf919119010bd4544a03ab8f53f5325c173902221ad9b88c118b4bfeee80b3e1956bcdbaf4c53f64ae7fb81f5ba57dbc956750c482 ghostscript-system-zlib.patch\n" ) ( "beefcf395f7f828e1b81c088022c08a506e218f27535b9de01e0f0edf7979b435316c318fa676771630f6ad16ff1ab059cd68aa128ed97e5a9f2f3fa840200c4 fix-sprintf.patch" ) ) } spids: [683] ) ] spids: [683] ) ] )