PKGBUILD 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
  2. # Contributor (Hyperbola): André Silva <emulatorman@hyperbola.info>
  3. # Maintainer (Arch):
  4. # parabola changes and rationale:
  5. # - Added armv7h and i686 support
  6. # - Removed nonfree parts
  7. pkgname=netpbm
  8. pkgver=10.73.36
  9. pkgrel=1
  10. pkgrel+=.parabola1
  11. pkgdesc="A toolkit for manipulation of graphic images"
  12. pkgdesc+=", without nonfree parts"
  13. arch=('x86_64')
  14. arch+=('i686' 'armv7h')
  15. license=('custom' 'BSD' 'GPL' 'LGPL')
  16. url="http://netpbm.sourceforge.net/"
  17. depends=('perl' 'libpng' 'libtiff' 'libxml2')
  18. makedepends=('python2' 'jbigkit' 'subversion')
  19. options=('!makeflags')
  20. # Get docs with: wget --recursive --relative -nH http://netpbm.sourceforge.net/doc/
  21. source=(https://downloads.sourceforge.net/project/netpbm/super_stable/$pkgver/netpbm-$pkgver.tgz
  22. https://sources.archlinux.org/other/packages/netpbm/netpbm-doc-31Jan2014.tar.xz{,.sig}
  23. netpbm-CAN-2005-2471.patch netpbm-security-code.patch netpbm-security-scripts.patch
  24. reproducible-man-gzip.patch use-source-date-epoch.patch)
  25. sha256sums=('93b31b11b003082d5fd4037ae5c768b91ea7330b10247a25086c10b5dd71e445'
  26. '74bcf840ee643c6917330c382484010cb99c004a3fcf05391bebcac63815acb3'
  27. 'SKIP'
  28. '991aba7897e0710687369b4e2edfba1397ecd77d62578eac496afbc47b5ca970'
  29. '83d75a80ce999d8b69572e54f04c4d220c60b0d09f9e52d3236264535c3bf216'
  30. '2c397588d9cba2c40dee55c07713d5e77e0e04245db939fdc1962d7de4cf4a33'
  31. '8e3efdb4fcbfdc8e9a5c8e9663c7d6b9ecef3a2379ce38d2acc5669c339f6814'
  32. '68055341833f482c6910a56c2fdfe046978a1a92fd8442a2a9209c82ce3e4d13')
  33. validpgpkeys=('5357F3B111688D88C1D88119FCF2CB179205AC90')
  34. remove_program() {
  35. file="$1"
  36. progname="$(basename ${file} | sed 's/\.c$//')"
  37. rm -v "${file}"
  38. sed -i "s/${progname}//g" "$(dirname ${file})/Makefile"
  39. sed -i "s/${progname}\.1//g" buildtools/manpage.mk
  40. }
  41. prepare() {
  42. cd $pkgname-$pkgver
  43. patch -p1 < ../netpbm-CAN-2005-2471.patch
  44. patch -p1 < ../netpbm-security-code.patch
  45. patch -p1 < ../netpbm-security-scripts.patch
  46. patch -p1 < ../reproducible-man-gzip.patch
  47. patch -p1 < ../use-source-date-epoch.patch
  48. sed -i 's|#!/usr/bin/python|#!/usr/bin/python2|' buildtools/makeman
  49. sed -i 's|@python|@python2|' buildtools/manpage.mk
  50. cp config.mk.in config.mk
  51. [ "${CARCH}" = 'x86_64' ] && echo 'CFLAGS_SHLIB = -fPIC' >> config.mk
  52. [ "${CARCH}" = 'armv7h' ] && echo 'CFLAGS_SHLIB = -fPIC' >> config.mk
  53. echo "NETPBM_DOCURL = file://${srcdir}/doc" >> config.mk
  54. echo 'TIFFLIB = libtiff.so' >> config.mk
  55. echo 'JPEGLIB = libjpeg.so' >> config.mk
  56. echo 'PNGLIB = libpng.so' >> config.mk
  57. echo 'ZLIB = libz.so' >> config.mk
  58. echo 'JBIGLIB = /usr/lib/libjbig.a' >> config.mk
  59. sed -i 's|misc|share/netpbm|' common.mk
  60. sed -i 's|/link|/lib|' lib/Makefile
  61. sed -i 's|install.manwebmain install.manweb install.man|install.man|' GNUmakefile
  62. # Remove the converter/ppm/hpcdtoppm directory:
  63. # - hpcdtoppm: as hpcdtoppm is not even redistributable, this hpcdtoppm only
  64. # prints a message to steer users toward downloading "the real hpcdtoppm"
  65. # which is nonfree
  66. # - pcdovtoppm: no license information
  67. rm -rv converter/ppm/hpcdtoppm
  68. sed '/\.\/converter\/ppm\/hpcdtoppm \\/d' -i GNUmakefile
  69. sed 's/hpcdtoppm//g' -i converter/ppm/Makefile
  70. # Removing programs without license information
  71. remove_program converter/other/pamtopnm.c
  72. remove_program converter/pbm/pbmto4425.c
  73. remove_program converter/pbm/pbmtoln03.c
  74. remove_program converter/pbm/pbmtolps.c
  75. remove_program converter/pbm/pbmtopk.c
  76. remove_program converter/pbm/pktopbm.c
  77. remove_program converter/pgm/spottopgm.c
  78. remove_program converter/ppm/ppmtogif.c
  79. remove_program converter/ppm/ppmtopjxl.c
  80. remove_program other/pamchannel.c
  81. # Tests have no license information
  82. rm -v -rf test/
  83. # Remove test from "SUPPORT_SUBDIRS = urt icon buildtools test"
  84. awk '{
  85. if ($1 != "SUPPORT_SUBDIRS") {
  86. print $0
  87. } else {
  88. for (i=1;i<=NF;i++) {
  89. if($i != "test") {
  90. printf $i " "
  91. }
  92. }
  93. }
  94. }' GNUmakefile > GNUmakefile.1
  95. mv -f GNUmakefile.1 GNUmakefile
  96. sed -i '/pnmtopnm/d' netpbm.c
  97. #Removing references about nonfree licenses part
  98. sed -i '338,383d' doc/copyright_summary
  99. }
  100. build() {
  101. cd $pkgname-$pkgver
  102. make
  103. # Generating useful man pages with html doc
  104. make MAKEMAN="${srcdir}/$pkgname-$pkgver/buildtools/makeman" USERGUIDE=. \
  105. -C ../doc -f "${srcdir}/$pkgname-$pkgver/buildtools/manpage.mk" manpages
  106. }
  107. package() {
  108. cd $pkgname-$pkgver
  109. make pkgdir="${pkgdir}/usr" PKGMANDIR=share/man install-run install-dev
  110. # Removing dummy man pages
  111. rm "${pkgdir}"/usr/share/man/man{1,3,5}/*
  112. make MAKEMAN="${srcdir}/$pkgname-$pkgver/buildtools/makeman" MANDIR="${pkgdir}/usr/share/man" \
  113. -C ../doc -f "${srcdir}/$pkgname-$pkgver/buildtools/manpage.mk" installman
  114. # Replace obsolete utility
  115. echo -e '#!/bin/sh\npamditherbw $@ | pamtopnm\n' > "${pkgdir}/usr/bin/pgmtopbm"
  116. # Licensing. Note that each program in the package has a separate license.
  117. install -D -m644 "${srcdir}/$pkgname-$pkgver/doc/copyright_summary" \
  118. "${pkgdir}/usr/share/licenses/${pkgname}/copyright_summary.txt"
  119. }