summaryrefslogtreecommitdiff
path: root/libre/lirc-parabola-grsec/PKGBUILD
blob: d8fa2f122edebf837a4180730465c85d55e9af96 (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
# $Id: PKGBUILD 220120 2014-08-16 22:32:11Z lfleischer $
# Maintainer (Arch): Paul Mattal <paul@archlinux.org>
# Maintainer: André Silva <emulatorman@parabola.nu>
# Contributor: Luke Shumaker <lukeshu@sbcglobal.net>
# Contributor: Márcio Silva <coadde@parabola.nu>

# Kernel info
_basekernel=3.15
_kernelname=-grsec

# Source info
_pkgname=lirc-parabola${_kernelname}
# Only build lirc-utils once; for the stock kernel
if [[ -n "${_kernelname}" ]]; then
  pkgname=$_pkgname
else
  pkgbase=$_pkgname
  pkgname=("$_pkgname" lirc-utils-parabola)
fi

_pkgver=0.9.1a
[[ $_pkgver =~ [a-z]$ ]] && pkgver="${_pkgver:0:-1}.${_pkgver: -1}" || pkgver="$_pkgver"

url="http://www.lirc.org/"
license=('GPL')
source=("http://prdownloads.sourceforge.net/lirc/lirc-${_pkgver}.tar.bz2"
	"wpc8769l-build-fix.patch"
        lirc.logrotate
        irexec.service
        lirc.tmpfiles)
md5sums=('1f1fac162ed309dd50f307e96a292957'
         '9ec33169b3407f74264062d7679dd269'
         '3deb02604b37811d41816e9b4385fcc3'
         '32df3b9bc859565d6acf5f0e5b747083'
         'febf25c154a7d36f01159e84f26c2d9a')

# Package info
pkgrel=1.${_basekernel/./}
epoch=1
arch=('i686' 'x86_64' 'mips64el')
options=('!makeflags' '!strip')
makedepends=('help2man' 'alsa-lib' 'libx11' 'libftdi-compat' 'libirman' 'python2')

# Generic (you shouldn't have to modify any of these variables)
_toohigh=$(IFS=. read a b <<<$_basekernel; echo $a.$((b+1)))
_extramodules=extramodules-${_basekernel}${_kernelname}
makedepends+=("linux-libre${_kernelname}>=${_basekernel}"         "linux-libre${_kernelname}<${_toohigh}"
              "linux-libre${_kernelname}-headers>=${_basekernel}" "linux-libre${_kernelname}-headers<${_toohigh}")

prepare() {
  cd "${srcdir}/lirc-${_pkgver}"

  patch -Np1 -i "${srcdir}/wpc8769l-build-fix.patch"

  sed -i '/AC_PATH_XTRA/d' configure.ac
  sed -e 's/@X_CFLAGS@//g' \
      -e 's/@X_LIBS@//g' \
      -e 's/@X_PRE_LIBS@//g' \
      -e 's/@X_EXTRA_LIBS@//g' -i Makefile.am tools/Makefile.am

  libtoolize
  autoreconf
}

build() {
  cd "${srcdir}/lirc-${_pkgver}"
  _kernver="$(cat /usr/lib/modules/${_extramodules}/version)"

  PYTHON=python2 ./configure --enable-sandboxed --prefix=/usr \
      --with-driver=all --with-kerneldir="/usr/lib/modules/${_kernver}/build/" \
      --with-moduledir="/usr/lib/modules/${_kernver}/kernel/drivers/misc" \
      --sbindir=/usr/bin --with-transmitter

  # Remove drivers already in kernel
  sed -e "s:lirc_dev::" -e "s:lirc_bt829::" -e "s:lirc_igorplugusb::" \
      -e "s:lirc_imon::" -e "s:lirc_parallel::" -e "s:lirc_sasem::" \
      -e "s:lirc_serial::" -e "s:lirc_sir::" -e "s:lirc_ttusbir::" \
      -e "s:lirc_atiusb::" -e "s:lirc_i2c::" \
      -i Makefile drivers/Makefile drivers/*/Makefile tools/Makefile
  make
}

_package_lirc() {
  pkgdesc="Linux Infrared Remote Control kernel modules (built for the linux-libre${_kernelname} kernel package)"
  depends=('lirc-libre-utils' "linux-libre${_kernelname}>=${_basekernel}" "linux-libre${_kernelname}<${_toohigh}")
  replaces=('lirc+pctv')
  [[ -z "$_kernelname" ]] || provides=("lirc-parabola=${pkgver}")
  install=kmod.install

  replaces+=( "lirc${_kernelname}"           "lirc-libre${_kernelname}")
  conflicts+=("lirc${_kernelname}"           "lirc-libre${_kernelname}")
  provides+=( "lirc${_kernelname}=${pkgver}" "lirc-libre${_kernelname}=${pkgver}")

  cd "${srcdir}/lirc-${_pkgver}/drivers"

  # Set the correct extramodules directory for install
  cp -f "${startdir}/${install}" "${startdir}/${install}.pkg"
  true && install=${install}.pkg
  sed -r "s/(_extramodules=).*/\1${_extramodules}/" -i "${startdir}/${install}"

  make DESTDIR="${pkgdir}" moduledir="/usr/lib/modules/${_extramodules}" install
  gzip -9 "${pkgdir}/usr/lib/modules/${_extramodules}"/*.ko
}
if [[ -n "$_kernelname" ]]; then
  eval "package() { _package_lirc; }"
else
  eval "package_${_pkgname}() { _package_lirc; }"
fi

package_lirc-utils-parabola() {
  pkgdesc="Linux Infrared Remote Control utilities"
  depends=('alsa-lib' 'libx11' 'libftdi-compat' 'libirman')
  optdepends=('python2: pronto2lirc utility')
  options=('strip')
  backup=('etc/lirc/lirc_options.conf' 'etc/lirc/lircd.conf' 'etc/lirc/lircmd.conf')

  replaces=( 'lirc-utils'         'lirc-utils-libre')
  conflicts=('lirc-utils'         'lirc-utils-libre')
  provides=( "lirc-utils=$pkgver" "lirc-utils-libre=$pkgver")
  install=kmod.install

  cd "${srcdir}/lirc-${_pkgver}"

  make DESTDIR="${pkgdir}" install

  install -Dm644 "${srcdir}"/irexec.service "${pkgdir}"/usr/lib/systemd/system/irexec.service
  install -Dm644 "${srcdir}"/lirc.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/lirc.conf

  cp -rp remotes "${pkgdir}/usr/share/lirc"
  chmod -R go-w "${pkgdir}/usr/share/lirc/"

  # install the logrotate config
  install -Dm644 "${srcdir}/lirc.logrotate" "${pkgdir}/etc/logrotate.d/lirc"
    
  # remove built modules
  rm -r "${pkgdir}/usr/lib/modules"
}