forked from jacobalberty/cups-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·153 lines (142 loc) · 4.12 KB
/
build.sh
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
#!/bin/bash
set -e
SOURCEDIR=/home/source
CPUC=$(awk '/^processor/{n+=1}END{print n}' /proc/cpuinfo)
CUPSURL=https://github.com/apple/cups/releases/download/v${CUPS_VERSION}/cups-${CUPS_VERSION}-source.tar.gz
FILTERSURL=http://openprinting.org/download/cups-filters/cups-filters-${FILTERS_VERSION}.tar.gz
QPDFURL=https://github.com/qpdf/qpdf/releases/download/release-qpdf-${QPDF_VERSION}/qpdf-${QPDF_VERSION}.tar.gz
BUILD_DEPS="
autoconf \
build-essential \
curl \
dpkg-dev \
g++ \
gcc \
libavahi-client-dev \
libavahi-glib-dev \
libfontconfig1-dev \
libfreetype6-dev \
libglib2.0-dev \
libgnutls28-dev \
libijs-dev \
libjpeg62-turbo-dev \
libkrb5-dev \
liblcms2-dev \
libnss-mdns \
libpam-dev \
libpng-dev \
libpoppler-cpp-dev \
libpoppler-dev \
libpoppler-private-dev \
libsystemd-dev \
libtiff5-dev \
libusb-1.0-0-dev \
make \
pkg-config \
quilt \
zlib1g-dev"
groupadd lpadmin
apt-get update
apt-get install -qy --no-install-recommends equivs
${PREFIX}/bin/fakePkg.sh "cups" "${CUPS_VERSION}"
${PREFIX}/bin/fakePkg.sh "cups-client" "${CUPS_VERSION}"
${PREFIX}/bin/fakePkg.sh "libcups2" "${CUPS_VERSION}"
${PREFIX}/bin/fakePkg.sh "libcupsimage2" "${CUPS_VERSION}"
${PREFIX}/bin/fakePkg.sh "cups-filters" "${FILTERS_VERSION}"
${PREFIX}/bin/fakePkg.sh "libcupsfilters1" "${FILTERS_VERSION}"
apt-get install -qy --no-install-recommends ${BUILD_DEPS} \
ca-certificates \
ghostscript \
libatomic1 \
libavahi-client3 \
libavahi-glib1 \
libfontconfig1 \
libfreetype6 \
libgnutls-openssl27 \
libgnutlsxx28 \
libgssapi-krb5-2 \
libijs-0.35 \
libjpeg62-turbo \
liblcms2-2 \
libpng16-16 \
libpoppler82 \
libpoppler-cpp0v5 \
libtiff5 \
mupdf-tools \
poppler-utils
mkdir -p "${SOURCEDIR}"
cd "${SOURCEDIR}"
if [ -d "/usr/local/docker/pre_build/$(dpkg --print-architecture)" ]; then
find "/usr/local/docker/pre_build/$(dpkg --print-architecture)" -type f -exec '{}' \;
fi
mkdir -p cups
cd cups
curl -o cups-source.tar.gz -L \
"${CUPSURL}"
tar --strip=1 -xf cups-source.tar.gz
if [ -f /home/patches/cups/series ]; then
mv /home/patches/cups ./patches
quilt push -a
fi
./configure \
--with-docdir=/usr/share/cups/doc-root \
--localedir=/usr/share/cups/locale \
--enable-libpaper \
--enable-ssl \
--enable-gnutls \
--enable-threads \
--enable-static \
--disable-debug \
--enable-dbus \
--with-dbusdir=/etc/dbus-1 \
--enable-gssapi \
--enable-avahi \
--disable-launchd \
--with-cups-group=lp \
--with-system-groups=lpadmin \
--with-printcap=/var/run/cups/printcap \
--with-logdir=/config/log \
--with-log-file-perm=0640 \
--with-local_protocols='dnssd' \
--with-systemd=/lib/systemd/system \
--localstatedir=${VOLUME}/state
make -j${CPUC}
make install
cd "${SOURCEDIR}"
mkdir -p qpdf
cd qpdf
curl -o qpdf-source.tar.gz -L "${QPDFURL}"
tar --strip=1 -xf qpdf-source.tar.gz
./configure
make -j${CPUC}
make install
cd "${SOURCEDIR}"
mkdir -p filters
cd filters
curl -o filters-source.tar.gz -L "${FILTERSURL}"
tar --strip=1 -xf filters-source.tar.gz
./configure \
--with-shell=/bin/sh \
--libdir=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH) \
--mandir=/usr/share/man \
--enable-static \
--enable-mutool \
--with-mutool-path=/usr/bin/mutool \
--with-test-font-path=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
make -j${CPUC}
make install
cd /
rm -rf "${SOURCEDIR}"
apt-get purge -qy --auto-remove ${BUILD_DEPS} equivs
rm -rf /var/lib/apt/lists/*
# save /etc/cups to recreate it if needed.
mkdir -p "${PREFIX}/skel/cups"
mv /etc/cups "${PREFIX}/skel/cups/etc"
# Use symbolic links to redirect a few standard cups directories to the volume
ln -s "${VOLUME}/etc" /etc/cups
ln -s "${VOLUME}/log" /var/log/cups
# Remove backends that don't make sense in a container.
mkdir -p /usr/lib/cups/backend-available
mv /usr/lib/cups/backend/parallel /usr/lib/cups/backend-available/
mv /usr/lib/cups/backend/serial /usr/lib/cups/backend-available/
mv /usr/lib/cups/backend/cups-brf /usr/lib/cups/backend-available/