aboutsummaryrefslogtreecommitdiff
path: root/print/cups/cups.build
blob: 373c43af269a17d1e22d99c2313bc7dc0ddcdb9a (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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>

source /usr/src/ports/Build/build.sh

NAME=cups
VERSION=1.6.2
BUILD=2
DEPENDS=('gnutls >= 3.2.1-1' 'avahi >= 0.6.31-1' 'libpng >= 1.5.14-1' 'libtiff >= 4.0.3-1')
OPTDEPENDS=('usb >= 1.0.15-1' 'qpdf >= 4.0.1-1'  'poppler >= 0.22.4-1' 'freetype >= 2.4.12-1' 'fontconfig >= 2.10.91-1')

# Description

cat > ${PKG}/install/slack-desc <<EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

$(padd)|-----handy-ruler------------------------------------------------------|
${NAME}: CUPS (Common UNIX Printing System)
${NAME}:
${NAME}: The Common UNIX Printing System provides a portable printing layer
${NAME}: for UNIX(R)-like operating systems. It uses the Internet Printing
${NAME}: Protocol ("IPP") as the basis for managing print jobs and queues. The
${NAME}: CUPS package includes System V and Berkeley command-line interfaces,
${NAME}: a PostScript RIP package for supporting non-PostScript printer
${NAME}: drivers, and tools for creating additional printer drivers and other
${NAME}: CUPS services.
${NAME}:
${NAME}: Homepage: http://www.cups.org
EOF

cat >> ${PKG}/install/doinst.sh <<EOF
#!/bin/sh

config() {
  NEW="\$1"
  OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r \$OLD ]; then
    mv \$NEW \$OLD
  elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
    # toss the redundant copy
    rm \$NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}

config etc/dbus-1/system.d/cups.conf.new
config etc/cups/printers.conf.new
config etc/cups/classes.conf.new
config etc/cups/subscriptions.conf.new
config etc/cups/client.conf.new
config etc/cups/snmp.conf.new
config etc/cups/cupsd.conf.new
config etc/cups/cups-files.conf.new
config etc/cups/cups-browsed.conf.new
config etc/foomatic/filter.conf.new

# Leave any new rc.cups with the same permissions as the old one:
# This is a kludge, but it's because there's no --reference option
# on busybox's 'chmod':
if [ -e etc/rc.d/rc.cups ]; then
  if [ -x etc/rc.d/rc.cups ]; then
    chmod 755 etc/rc.d/rc.cups.new
  else
    chmod 644 etc/rc.d/rc.cups.new
  fi
fi

# Then config() it:
config etc/rc.d/rc.cups.new
EOF

# Sources

SRCNAME[0]=${NAME}
SRCVERS[0]=${VERSION}
SRCPACK[0]=http://ftp.easysw.com/pub/cups/${SRCVERS[0]}/${SRCNAME[0]}-${SRCVERS[0]}-source.tar.bz2

build0()
{
sed -i "s|@systemdsystemunitdir@|${SYS_DIR[systemdsystemunitdir]}|g" Makedefs.in
CFLAGS="${FLAGS}" CXXFLAGS="${FLAGS}" \
./configure \
 --build="${ARCH}-slackware-linux" \
 --enable-static=no \
 --enable-shared=yes \
 --prefix="${SYS_DIR[usr]}" \
 --mandir="${SYS_DIR[man]}" \
 --sysconfdir="${SYS_DIR[etc]}" \
 --libdir="${SYS_DIR[lib]}" \
 --localstatedir="${SYS_DIR[var]}" \
 --without-php \
 --with-optim="${FLAGS}" \
 --with-logdir="${SYS_DIR[var]}/log/cups" \
 --with-docdir="${SYS_DIR[html]}/cups" \
 --with-dbusdir="${SYS_DIR[etc]}/dbus-1" \
 --with-systemdsystemunitdir="${SYS_DIR[systemdsystemunitdir]}" \
 --enable-pam=no \
 --enable-ssl=yes \
 --enable-dbus \
 --enable-gnutls \
 --enable-threads \
 --enable-avahi \
 --enable-libusb \
 --enable-raw-printing
#FIXME: PAM
make ${JOBS}
make install BUILDROOT="${PKG}"
doc CREDITS.txt
changelog CHANGES.txt
license LICENSE.txt
# Make these directories again to remove unneeded perms
install.dir ${PKG}${SYS_DIR[etc]}/cups
install.dir ${PKG}${SYS_DIR[var]}/spool
#install.dir ${PKG}${SYS_DIR[etc]}/pam.d
#install.dat cups.pam ${PKG}${SYS_DIR[etc]}/pam.d/cups
install.dir ${PKG}${SYS_DIR[etc]}/logrotate.d
install.dat cups.logrotate ${PKG}${SYS_DIR[etc]}/logrotate.d/cups
# Install some more configuration files that will get filled by cupsd
echo "ServerName /run/cups/cups.sock" > ${PKG}${SYS_DIR[etc]}/cups/client.conf.new
touch ${PKG}${SYS_DIR[etc]}/cups/{printers,classes,subscriptions}.conf.new
chgrp lp ${PKG}${SYS_DIR[etc]}/cups/{printers,classes,subscriptions,client}.conf.new
(
  cd ${PKG}${SYS_DIR[lib]}/exec/cups/backend
  if [ ! -e smb ]; then
    ln -sf ${SYS_DIR[bin]}/smbspool smb
  fi
)
mv \
 ${PKG}${SYS_DIR[etc]}/rc.d/init.d/cups \
 ${PKG}${SYS_DIR[etc]}/rc.d/rc.cups.new
mv \
 ${PKG}${SYS_DIR[etc]}/dbus-1/system.d/cups.conf \
 ${PKG}${SYS_DIR[etc]}/dbus-1/system.d/cups.conf.new
mv \
 ${PKG}${SYS_DIR[etc]}/cups/cups-files.conf \
 ${PKG}${SYS_DIR[etc]}/cups/cups-files.conf.new
mv \
 ${PKG}${SYS_DIR[etc]}/cups/cupsd.conf \
 ${PKG}${SYS_DIR[etc]}/cups/cupsd.conf.new
mv \
 ${PKG}${SYS_DIR[etc]}/cups/snmp.conf \
 ${PKG}${SYS_DIR[etc]}/cups/snmp.conf.new
rm -rf \
 ${PKG}${SYS_DIR[etc]}/rc.d/{init.d,rc{0,2,3,5}.d} \
 ${PKG}${SYS_DIR[share]}/cups/{banners,data} \
 ${PKG}${SYS_DIR[share]}/cups/ipptool/*.{ps,pdf.jpg} \
 ${PKG}/run
}

SRCNAME[1]=cups-filters
SRCVERS[1]=1.0.34
SRCPACK[1]=http://www.openprinting.org/download/cups-filters/${SRCNAME[1]}-${SRCVERS[1]}.tar.xz

build1()
{
sed -i 's|$(libdir)/pkgconfig|$(datarootdir)/pkgconfig|g' Makefile.in
CPPFLAGS="-I${PKG}${SYS_DIR[include]}" \
LDFLAGS="-L${PKG}${SYS_DIR[lib]}" \
CFLAGS="${FLAGS}" CXXFLAGS="${FLAGS}" \
./configure \
 --build="${ARCH}-slackware-linux" \
 --disable-dependency-tracking \
 --disable-silent-rules \
 --enable-static=no \
 --enable-shared=yes \
 --prefix="${SYS_DIR[usr]}" \
 --mandir="${SYS_DIR[man]}" \
 --sysconfdir="${SYS_DIR[etc]}" \
 --libdir="${SYS_DIR[lib]}" \
 --localstatedir="${SYS_DIR[var]}" \
 --with-cups-config="${PKG}${SYS_DIR[bin]}/cups-config" \
 --with-fontdir="${SYS_DIR[share]}/fonts/config" \
 --with-rcdir=no \
 --enable-avahi
make ${JOBS} V=1
make install DESTDIR="${PKG}"
doc AUTHORS
license COPYING
changelog NEWS
install.dir ${PKG}${SYS_DIR[etc]}/fonts.d
install.dir ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dat cups-browsed.service ${PKG}${SYS_DIR[systemdsystemunitdir]}
mv \
 ${PKG}${SYS_DIR[etc]}/cups/cups-browsed.conf \
 ${PKG}${SYS_DIR[etc]}/cups/cups-browsed.conf.new
# Compress some driver files, adopted from Fedora
find ${PKG}${SYS_DIR[share]}/ppd -name "*.ppd" | xargs gzip -n9f
# Use this trick instead of installing cups-samba
(
  cd ${PKG}${SYS_DIR[etc]}/fonts.d
  ln -sf ${SYS_DIR[share]}/fonts/config/99pdftoopvp.conf
)
rm -rf \
 ${PKG}${SYS_DIR[doc]}/cups-filters
}

SRCNAME[2]=foomatic-filters
SRCVERS[2]=4.0.17
SRCPACK[2]=http://www.openprinting.org/download/foomatic/${SRCNAME[2]}-${SRCVERS[2]}.tar.gz
SRCCOPY[2]="GPL2"

build2()
{
export CUPS_SERVERBIN="${SYS_DIR[lib]}/exec/cups"
CFLAGS="${FLAGS}" CXXFLAGS="${FLAGS}" \
./configure \
 --build="${ARCH}-slackware-linux" \
 --disable-dependency-tracking \
 --prefix="${SYS_DIR[usr]}" \
 --mandir="${SYS_DIR[man]}" \
 --sysconfdir="${SYS_DIR[etc]}" \
 --libdir="${SYS_DIR[lib]}" \
 --localstatedir="${SYS_DIR[var]}"
make ${JOBS}
make install-main install-cups DESTDIR="${PKG}"
changelog ChangeLog
mv \
 ${PKG}${SYS_DIR[etc]}/foomatic/filter.conf \
 ${PKG}${SYS_DIR[etc]}/foomatic/filter.conf.new
}