summaryrefslogtreecommitdiff
path: root/libre/netpbm/PKGBUILD
blob: ec012d7ddc3737a0388c28cb4488a4f2ac68ad41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# $Id$
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=netpbm
pkgver=10.69.02
pkgrel=1.parabola1
pkgdesc="A toolkit for manipulation of graphic images, without nonfree parts and patent issues"
arch=('i686' 'x86_64')
license=('custom' 'BSD' 'GPL' 'LGPL')
url="http://netpbm.sourceforge.net/"
depends=('perl' 'libpng' 'libtiff' 'libxml2')
makedepends=('python2' 'jbigkit' 'subversion')
options=('!makeflags')
# Get docs with: wget --recursive --relative -nH http://netpbm.sourceforge.net/doc/
mksource=(svn://svn.code.sf.net/p/netpbm/code/advanced)
source=(https://repo.parabola.nu/other/${pkgname}-libre/${pkgname}-${pkgver}.tar.gz
        https://sources.archlinux.org/other/packages/netpbm/netpbm-doc-31Jan2014.tar.xz {,.sig}
        netpbm-CAN-2005-2471.patch netpbm-security-code.patch netpbm-security-scripts.patch)
mksha1sums=('SKIP')
sha1sums=('5bf2dccd6876bdf8d079a28fda139991ec5b96c6'
          '25a58975bd8cd383238b4ae31f4405c60914faac'
          'SKIP'
          'b79cf9d42488fea065ba16262ed97694c47af08d'
          'b0b0168605741a29b96b852d0ba8bae94c96b1bd'
          'c67a63c010353de3ecac3ad72ba76bbb85e4ed4c')
validpgpkeys=('5357F3B111688D88C1D88119FCF2CB179205AC90')

pkgver() {
  cd advanced
  echo $(grep MAJOR version.mk |cut -d ' ' -f 3).$(grep MINOR version.mk |cut -d ' ' -f 3).0$(grep POINT version.mk |cut -d ' ' -f 3)
}

mksource() {
  cd advanced

  #Removing hpcdtoppm/pcdindex (nocomercial)
  rm -rv converter/ppm/hpcdtoppm
  sed -i 's/hpcdtoppm//g' converter/ppm/Makefile
  sed -i 's/hpcdtoppm\.1//g' buildtools/manpage.mk
  sed -i 's/pcdindex\.1//g' buildtools/manpage.mk

  #Removing ppmtogif/giftopnm (patent restriction)
  rm -v converter/other/giftopnm.c converter/ppm/ppmtogif.c
  sed -i 's/ppmtogif//g' converter/ppm/Makefile test/all-in-place.test
  sed -i 's/ppmtogif\.1//g' buildtools/manpage.mk
  sed -i 's/giftopnm//g' converter/other/Makefile test/all-in-place.test
  sed -i 's/giftopnm\.1//g' buildtools/manpage.mk
  sed -i '/giftopnm/d' converter/other/pnmtopalm/README
  rm -v test/gif-quant-roundtrip.test test/gif-roundtrip.test test/all-in-place.ok

  #Removing programs without license information
  rm -v other/pamchannel.c test/pamchannel.ok
  sed -i 's/pamchannel//g' other/Makefile test/all-in-place.test
  sed -i 's/pamchannel\.1//g' buildtools/manpage.mk
  sed -i 's/pamchannel\.test//g' test/Test-Order

  rm -v converter/other/pamtopnm.c
  sed -i 's/pamtopnm//g' converter/other/Makefile test/all-in-place.test
  sed -i 's/pamtopnm\.1//g' buildtools/manpage.mk
  sed -i '/pnmtopnm/d' netpbm.c

  rm -v converter/pbm/pbmto4425.c
  sed -i 's/pbmto4425//g' converter/pbm/Makefile test/all-in-place.test
  sed -i 's/pbmto4425\.1//g' buildtools/manpage.mk

  rm -v converter/pbm/pbmtoln03.c
  sed -i 's/pbmtoln03//g' converter/pbm/Makefile test/all-in-place.test
  sed -i 's/pbmtoln03\.1//g' buildtools/manpage.mk

  rm -v converter/pbm/pbmtolps.c
  sed -i 's/pbmtolps//g' converter/pbm/Makefile test/all-in-place.test
  sed -i 's/pbmtolps\.1//g' buildtools/manpage.mk

  rm -v converter/pbm/pbmtopk.c
  sed -i 's/pbmtopk//g' converter/pbm/Makefile test/all-in-place.test
  sed -i 's/pbmtopk\.1//g' buildtools/manpage.mk

  rm -v converter/pbm/pktopbm.c
  sed -i 's/pktopbm//g' converter/pbm/Makefile test/all-in-place.test
  sed -i 's/pktopbm\.1//g' buildtools/manpage.mk

  rm -v converter/ppm/ppmtopjxl.c
  sed -i 's/ppmtopjxl//g' converter/ppm/Makefile test/all-in-place.test
  sed -i 's/ppmtopjxl\.1//g' buildtools/manpage.mk

  rm -v converter/pgm/spottopgm.c
  sed -i 's/spottopgm//g' converter/pgm/Makefile test/all-in-place.test
  sed -i 's/spottopgm\.1//g' buildtools/manpage.mk

  rm -v test/avs-roundtrip.test test/facesaver-roundtrip.test test/ilbm-roundtrip.test test/pamchannel.test \
        test/pamditherbw.test test/pamenlarge.test test/pamfile.test test/pfm-roundtrip.test \
        test/pgmtoppm.test test/pict-roundtrip.test test/pnminvert.test test/pnmremap1.test \
        test/pnmremap2.test test/pnmtopnm-plain.test test/pnm-pam-roundtrip.test test/pnm-plain-roundtrip.test \
        test/ps-alt-roundtrip.test test/ps-roundtrip.test test/sbig-roundtrip.test test/st4-roundtrip.test \
        test/targa-roundtrip.test test/utahrle-roundtrip.test test/winicon-roundtrip.test test/xwd-roundtrip.test

  #Removing non-free licenses part
  sed -i '338,383d' doc/copyright_summary
}

prepare() {
  cd advanced

  patch -p1 < ../netpbm-CAN-2005-2471.patch
  patch -p1 < ../netpbm-security-code.patch
  patch -p1 < ../netpbm-security-scripts.patch
  sed -i 's|#!/usr/bin/python|#!/usr/bin/python2|' buildtools/makeman
  sed -i 's|@python|@python2|' buildtools/manpage.mk

  cp config.mk.in  config.mk
  [ "${CARCH}" = 'x86_64' ] && echo 'CFLAGS_SHLIB = -fPIC' >> config.mk
  echo "NETPBM_DOCURL = file://${srcdir}/doc" >> config.mk
  echo 'TIFFLIB = libtiff.so' >> config.mk
  echo 'JPEGLIB = libjpeg.so' >> config.mk
  echo 'PNGLIB = libpng.so' >> config.mk
  echo 'ZLIB = libz.so' >> config.mk
  echo 'JBIGLIB = /usr/lib/libjbig.a' >> config.mk

  sed -i 's|misc|share/netpbm|' common.mk
  sed -i 's|/link|/lib|' lib/Makefile
  sed -i 's|install.manwebmain install.manweb install.man|install.man|' GNUmakefile
}

build() {
  cd advanced
  make
  # Generating useful man pages with html doc
  make MAKEMAN="${srcdir}/advanced/buildtools/makeman" USERGUIDE=. \
    -C ../doc -f "${srcdir}/advanced/buildtools/manpage.mk" manpages
}

package() {
  cd advanced
  make pkgdir="${pkgdir}/usr" PKGMANDIR=share/man install-run install-dev

# Removing dummy man pages
  rm "${pkgdir}"/usr/share/man/man{1,3,5}/*

  make MAKEMAN="${srcdir}/advanced/buildtools/makeman" MANDIR="${pkgdir}/usr/share/man" \
    -C ../doc -f "${srcdir}/advanced/buildtools/manpage.mk" installman

# Replace obsolete utility
  echo -e '#!/bin/sh\npamditherbw $@ | pamtopnm\n' > "${pkgdir}/usr/bin/pgmtopbm"

# Licensing.  Note that each program in the package has a separate license.
  install -D -m644 "${srcdir}/advanced/doc/copyright_summary" \
    "${pkgdir}/usr/share/licenses/${pkgname}/copyright_summary.txt"
}