summaryrefslogtreecommitdiffstats
path: root/main/crystalhd-git-grsec/APKBUILD
blob: 019a73724f23b3daf51bec8d37466758a83af1e8 (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
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:

_flavor=${FLAVOR:-grsec}
_realname=crystalhd-git
_name=$_realname-$_flavor

_kpkg=linux-$_flavor
_kver=3.6.11
_kpkgrel=2

_mypkgrel=0
_date=20121126

# source the kernel version
if [ -f ../../main/linux-$_flavor/APKBUILD ]; then
        . ../../main/linux-$_flavor/APKBUILD
        [ "$_kver" != "$pkgver" ] && die "$_name: Please update _kver to $pkgver"
        [ "$_kpkgrel" != "$pkgrel" ] && die "$_name: Please update _kpkgrel to $pkgrel"
fi

_kernelver=$_kver-r$_kpkgrel
_abi_release=$_kver-${_flavor}

pkgname=$_name
pkgver=20121205
pkgrel=$(($_kpkgrel + $_mypkgrel))
pkgdesc="Broadcom CrystalHD kernel driver"
url="http://git.linuxtv.org/jarod/crystalhd.git"
arch="all"
license="GPL2"
depends=""
depends_dev=""
makedepends="$depends_dev automake autoconf linux-$_flavor-dev=$_kernelver"
install=""
subpackages="$pkgname-dev libcrystalhd"
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-${_date}.tar.gz
	crystalhd-use_8_DMA_buffers-0.1.patch"

_giturl="git://linuxtv.org/jarod/crystalhd.git"
_upload="dev.alpinelinux.org:/archive/$pkgname/"
_libdir="$srcdir/$pkgname-$_date/linux_lib/libcrystalhd"
_kerdir="$srcdir/$pkgname-$_date/driver/linux"
_builddir="$srcdir/$pkgname-$_date"

snapshot() {
        local _date=$(date +%Y%m%d)
        local _pkg=$pkgname-$_date.tar.gz
        mkdir -p "$srcdir"
        cd "$srcdir"
        msg "Creating snapshot: $_pkg"
        rm -rf ${_giturl##*/}
        git clone --depth=1 --bare $_giturl || return 1
        git --git-dir ${_giturl##*/} archive -o $_pkg \
                --prefix=$pkgname-$_date/ HEAD \
                || return 1
        msg "Uploading to $_upload"
        rsync -Lave ssh $_pkg $_upload || return 1
        cd "$startdir"
        sed -i -e "s/^pkgver=.*/pkgver=$_date/" \
                APKBUILD || return 1
        abuild checksum
}

prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_libdir"
	msg "building library"
	make || return 1
	cd "$_kerdir"
	msg "building module"
	export GCC_SPECS=/usr/share/gcc/hardenednopie.specs
	autoconf
	./configure --prefix=/usr \
		--with-kernel-path=/usr/src/linux-headers-${_abi_release}
	make || return 1
}

package() {
	cd "$_kerdir"
	mkdir -p "$pkgdir"/lib/modules/"$_abi_release"/kernel/drivers/video/broadcom
	install -m 0644 crystalhd.ko \
		"$pkgdir"/lib/modules/"$_abi_release"/kernel/drivers/video/broadcom
	cd "$_libdir"
	make DESTDIR="$pkgdir" install || return 1
}

dev() {
	default_dev
}

libcrystalhd() {
	pkgdesc="Broadcom CrystalHD kernel library"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/lib \
		"$subpkgdir"/usr/
}

md5sums="3459e3b206702cea539f09fb9abbb4f8  crystalhd-git-grsec-20121126.tar.gz
e617ef3212dd46749d61247b5cbb51bd  crystalhd-use_8_DMA_buffers-0.1.patch"