PKGBUILD 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. # Maintainer (arch): Caleb Maclennan <caleb@alerque.com>
  2. # Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
  3. # Contributor: André Silva <emulatorman@hyperbola.info>
  4. # Contributor: bill-auger <bill-auger@programmer.net>
  5. # parabola changes and rationale:
  6. # - Added armv7h and i686 support
  7. # - Removed non-free parts
  8. pkgname=netpbm
  9. pkgver=10.86.41
  10. pkgrel=1
  11. pkgrel+=.parabola1
  12. pkgdesc='A toolkit for manipulation of graphic images'
  13. arch=(x86_64)
  14. arch+=(armv7h i686)
  15. #license=(Artistic-1.0 GPL-2.0-only LGPL-2.0.only MIT) # TODO: SPDX
  16. license=('custom' 'custom:BSD3' 'GPL' 'LGPL')
  17. url="http://netpbm.sourceforge.net/"
  18. depends=(bash
  19. gcc-libs
  20. glibc
  21. jbigkit
  22. libjpeg-turbo
  23. libpng
  24. libtiff
  25. libxml2
  26. perl
  27. zlib)
  28. options=(!makeflags)
  29. # Get docs with: wget --recursive --relative -nH http://netpbm.sourceforge.net/doc/
  30. source=(https://downloads.sourceforge.net/project/netpbm/super_stable/$pkgver/netpbm-$pkgver.tgz
  31. https://sources.archlinux.org/other/packages/netpbm/netpbm-doc-31Jan2014.tar.xz{,.sig}
  32. netpbm-CAN-2005-2471.patch
  33. netpbm-security-code.patch
  34. netpbm-security-scripts.patch
  35. reproducible-man-gzip.patch)
  36. sha256sums=('045f7796224a801512efb5e7d6150a321674cbfb566128b21abf8d4ba65b4513'
  37. '74bcf840ee643c6917330c382484010cb99c004a3fcf05391bebcac63815acb3'
  38. 'SKIP'
  39. '7348274b72b8285add042d0f45d124c9833206ee3440bd1846cfc792b9b4d5e5'
  40. '698645215d46bcee515d75847fc550ce99c5fcb6fae63dacdba1d773f327c80e'
  41. '5ee27b4187577cbb9e85f6b36c5e5a421e03927f9195f888be7be2b647a5ac9d'
  42. 'b0be94fbfbf247552c5cc3f1cdd93e2d549f59c3d218350ccc1bea44e9bebc9b')
  43. validpgpkeys=('5357F3B111688D88C1D88119FCF2CB179205AC90')
  44. # parabola mksource over-rides
  45. _N_MKSOURCES=3 # number of upstream sources to be isolated for mksource
  46. mksource=( ${source[*]:0:${_N_MKSOURCES}} )
  47. mksha256sums=( ${sha256sums[*]:0:${_N_MKSOURCES}} )
  48. mkvalidpgpkeys=( ${validpgpkeys[*]} )
  49. mksource+=(nonfree-licenses-docs.patch)
  50. mksha256sums+=(5ee57bba37dca542df9abea1061d8d343a1ba299038f0e01888210acc08d4779)
  51. source=(https://repo.parabola.nu/other/${pkgname}-libre/${pkgname}-${pkgver}-parabola.tar.gz{,.sig}
  52. ${source[*]:${_N_MKSOURCES}})
  53. sha256sums=(a75a8530140f0d6b59b2902cef23d388192bd278eb391fbc2cee265fef816917
  54. SKIP
  55. ${sha256sums[*]:${_N_MKSOURCES}})
  56. validpgpkeys=(3954A7AB837D0EA9CFA9798925DB7D9B5A8D4B40) # bill-auger
  57. _UNLICENSED_FILES=( converter/ppm/ppmtogif.c
  58. other/pamchannel.c
  59. converter/other/pamtopnm.c
  60. converter/pbm/pbmto4425.c
  61. converter/pbm/pbmtoln03.c
  62. converter/pbm/pbmtolps.c
  63. converter/pbm/pbmtopk.c
  64. converter/pbm/pktopbm.c
  65. converter/ppm/ppmtopjxl.c
  66. converter/pgm/spottopgm.c)
  67. mksource() {
  68. remove_program() {
  69. file="$1"
  70. progname="$(basename ${file} | sed 's/\.c$//')"
  71. rm -v "${file}"
  72. sed -i "s/${progname}//g" "$(dirname ${file})/Makefile"
  73. sed -i "s/${progname}\.1//g" buildtools/manpage.mk
  74. }
  75. cd $pkgname-$pkgver
  76. # Remove the converter/ppm/hpcdtoppm directory:
  77. # - hpcdtoppm: as hpcdtoppm is not even redistributable, this hpcdtoppm only
  78. # prints a message to download "the real hpcdtoppm" (non-free)
  79. # - pcdovtoppm: no licensing information
  80. rm -rfv converter/ppm/hpcdtoppm
  81. sed '/\.\/converter\/ppm\/hpcdtoppm\/ \\/d' -i GNUmakefile
  82. sed 's/hpcdtoppm//g' -i converter/ppm/Makefile
  83. # Remove programs without licensing information
  84. for f in ${_UNLICENSED_FILES[*]} ; do remove_program $f ; done ;
  85. # Tests have no license information
  86. rm -v -rf test/
  87. # Remove test from "SUPPORT_SUBDIRS = urt icon buildtools test"
  88. awk '{
  89. if ($1 != "SUPPORT_SUBDIRS") {
  90. print $0
  91. } else {
  92. for (i=1;i<=NF;i++) {
  93. if($i != "test") {
  94. printf $i " "
  95. }
  96. }
  97. }
  98. }' GNUmakefile > GNUmakefile.1
  99. mv -f GNUmakefile.1 GNUmakefile
  100. sed -i '/pnmtopnm/d' netpbm.c
  101. # Remove references about non-free licensed parts
  102. echo "applying nonfree-licenses-docs.patch"
  103. patch -p0 < ../nonfree-licenses-docs.patch
  104. unset remove_program
  105. }
  106. prepare() {
  107. # delete patches which would apply to deleted files
  108. _UNLICENSED_FILES+=(converter/ppm/hpcdtoppm)
  109. local files="($(sed 's|/|\\/|g ; s|\.|\\.|g' <<<${_UNLICENSED_FILES[*]} | tr ' ' '|'))"
  110. local awk_script="( \$1 !~ /^a\/$files/ ) { print \"diff --git \"\$0 }"
  111. awk -i inplace -v INPLACE_SUFFIX=.orig "$awk_script" RS='diff --git ' FS='\n' *.patch
  112. # arch patching ##
  113. cd $pkgname-$pkgver
  114. patch -p1 < ../netpbm-CAN-2005-2471.patch
  115. patch -p1 < ../netpbm-security-code.patch
  116. patch -p1 < ../netpbm-security-scripts.patch
  117. patch -p1 < ../reproducible-man-gzip.patch
  118. cp config.mk.in config.mk
  119. [ "${CARCH}" = 'x86_64' ] && echo 'CFLAGS_SHLIB = -fPIC' >> config.mk
  120. [ "${CARCH}" = 'armv7h' ] && echo 'CFLAGS_SHLIB = -fPIC' >> config.mk
  121. echo "NETPBM_DOCURL = file://${srcdir}/doc" >> config.mk
  122. echo 'TIFFLIB = libtiff.so' >> config.mk
  123. echo 'JPEGLIB = libjpeg.so' >> config.mk
  124. echo 'PNGLIB = libpng.so' >> config.mk
  125. echo 'ZLIB = libz.so' >> config.mk
  126. echo 'JBIGLIB = /usr/lib/libjbig.a' >> config.mk
  127. sed -i 's|misc|share/netpbm|' common.mk
  128. sed -e 's|/sharedlink|/lib|' -e 's|/staticlink|/lib|' -i lib/Makefile
  129. sed -i 's|install.manwebmain install.manweb install.man|install.man|' GNUmakefile
  130. }
  131. build() {
  132. cd $pkgname-$pkgver
  133. make
  134. # Generating useful man pages with html doc
  135. # TODO: Enable when we have it updated
  136. # make MAKEMAN="${srcdir}/$pkgname-$pkgver/buildtools/makeman" USERGUIDE="-v ." \
  137. # -C ../doc -f "${srcdir}/$pkgname-$pkgver/buildtools/manpage.mk" manpages
  138. }
  139. package() {
  140. cd $pkgname-$pkgver
  141. make pkgdir="${pkgdir}/usr" PKGMANDIR=share/man install-run install-dev
  142. # Replace obsolete utility
  143. echo -e '#!/bin/sh\npamditherbw $@ | pamtopnm\n' > "${pkgdir}/usr/bin/pgmtopbm"
  144. # Licensing. Note that each program in the package has a separate license.
  145. install -D -m644 "${srcdir}/$pkgname-$pkgver/doc/copyright_summary" \
  146. "${pkgdir}/usr/share/licenses/${pkgname}/copyright_summary.txt"
  147. ## parabola changes ##
  148. # Remove symlinks to deleted programs
  149. rm -v "${pkgdir}"/usr/bin/pnmtopnm
  150. }