aboutsummaryrefslogtreecommitdiff
path: root/print/hplip/hplip.build
blob: 37ffcfa64b937d61c913f283c2da7b63e3cab131 (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
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>

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

NAME=hplip
VERSION=3.13.5
BUILD=1
DEPENDS=('ghostscript >= 9.06-1' 'snmp >= 5.7.2-1' 'dbus >= 1.6.8-1')
OPTDEPENDS=('usb >= 1.0.15-1' 'cups >= 1.6.2-1' 'python >= 2.7.4-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}: hplip (HP print/scan/fax support)
${NAME}:
${NAME}: HPLIP is an HP developed solution for printing, scanning, and faxing
${NAME}: with HP inkjet and laser based printers in Linux. The HPLIP project
${NAME}: provides printing support for more than 1400 HP printer models,
${NAME}: including Deskjet, Officejet, Photosmart, PSC (Print Scan Copy),
${NAME}: Business Inkjet, LaserJet, and LaserJet MFP.
${NAME}:
${NAME}: Homepage: http://hplipopensource.com
${NAME}:
${NAME}:
EOF

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

if [ -x usr/bin/update-desktop-database ]; then
  usr/bin/update-desktop-database usr/share/applications >/dev/null 2>&1
fi
EOF

# Sources

SRCNAME[0]=${NAME}
SRCVERS[0]=${VERSION}
SRCPACK[0]=${URL[sf]}/${SRCNAME[0]}/${SRCNAME[0]}/${SRCVERS[0]}/${SRCNAME[0]}-${SRCVERS[0]}.tar.gz
SRCCOPY[0]="GPL2 BSD3 MIT"

build0()
{
find . -type f -exec sed -i 's~^#.*env python~#!/usr/bin/env python2~' {} +
find . -name "*.py" -exec sed -i '1s|#!/usr/bin/python|#!/usr/bin/python2|' {} +
sed -i 's|python ./print.py|python2 ./print.py|' scan.py
sed -i 's|python ./testpage.py|python2 ./testpage.py|' setup.py
sed -i 's|python ./setup.py|python2 ./setup.py|' ui4/devmgr5.py ui4/nodevicesdialog.py 
sed -i 's|python %HOME%|python2 %HOME%|' base/utils.py
sed -i 's|python ./plugin.py|python2 ./plugin.py|' base/pkit.py
# https://bugs.archlinux.org/task/30085 - hack found in Gentoo
# Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip
# The hpcups driver does not use foomatic-rip
(
  cd ppd/hpijs
  for file in *.ppd.gz; do
    rm -f ${file}.temp
    gunzip -c ${file} | sed 's|foomatic-rip-hplip|foomatic-rip|g' | gzip > ${file}.temp
    mv ${file}.temp ${file}
  done
)
#LIBS="-Wl,--as-needed $(pkg-config libusb --libs)"
export PYTHON=python2
sed -i 's|/usr/lib/systemd/system|/usr/share/systemd/system|g' Makefile.{am,in}
CFLAGS="${FLAGS}" CXXFLAGS="${FLAGS}" \
./configure \
 --build="${ARCH}-slackware-linux" \
 --host="${ARCH}-slackware-linux" \
 --disable-dependency-tracking \
 --enable-static=no \
 --enable-shared=yes \
 --prefix=/usr \
 --mandir="${SYS_DIR[man]}" \
 --sysconfdir="${SYS_DIR[etc]}" \
 --libdir="${SYS_DIR[lib]}" \
 --localstatedir="${SYS_DIR[var]}" \
 --docdir="${SYS_DIR[html]}/${SRCNAME[0]}" \
 --with-docdir="${SYS_DIR[html]}/${SRCNAME[0]}" \
 --with-cupsbackenddir="${SYS_DIR[lib]}/exec/cups/backend" \
 --with-cupsfilterdir="${SYS_DIR[lib]}/exec/cups/filter" \
 --with-hpppddir="${SYS_DIR[share]}/cups/model/HP" \
 --with-drvdir="${SYS_DIR[share]}/cups/drv/hp" \
 --disable-foomatic-rip-hplip-install \
 --enable-foomatic-ppd-install \
 --enable-foomatic-drv-install \
 --enable-hpcups-install \
 --enable-new-hpcups \
 --enable-pp-build \
 --enable-cups-ppd-install \
 --enable-cups-drv-install \
 --enable-hpijs-install \
 --enable-network-build=yes \
 --enable-shadow-build \
 --disable-scan-build \
 --enable-gui-build \
 --enable-fax-build \
 --enable-qt4 \
 --enable-policykit \
 --enable-udev-acl-rules
#FIXME: --enable-scan-build when we have sane
#FIXME: PAM
make ${JOBS}
make install DESTDIR="${PKG}" rulesdir="${SYS_DIR[udevrules]}"
mv \
 ${PKG}${SYS_DIR[etc]}/cron.daily/hplip_cron \
 ${PKG}${SYS_DIR[etc]}/cron.daily/hplip
# Log dir should not be world writeable
chmod 775 \
  ${PKG}${SYS_DIR[var]}/log/{hp,hp/tmp}
rm -rf \
 ${PKG}${SYS_DIR[etc]}/{sane.d,xdg} \
 ${PKG}${SYS_DIR[share]}/hal
}