summaryrefslogtreecommitdiff
path: root/community/rt3562sta/PKGBUILD
blob: 7ef335c9e3579ad6ac8ae2f04b79bd58a1f1f842 (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
# $Id: PKGBUILD 79180 2012-10-31 07:25:39Z tpowa $
# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
# Based on SUSE spec https://build.opensuse.org/package/files?package=rt3562sta&project=driver%3Awireless

pkgname=rt3562sta
pkgver=2.4.1.1
pkgrel=20
pkgdesc="Ralink RT3562 PCI WLAN adaptors kernel module"
arch=(i686 x86_64)
url="http://www.mediatek.com/en/Products/support.php?sn=501"
license=('GPL')
depends=('linux')
makedepends=('linux-headers')
install=$pkgname.install
source=(
	http://dl.dropbox.com/u/362439/DPO_RT3562_3592_3062_LinuxSTA_V${pkgver}_20101217.tgz
	$pkgname-$pkgver-config.patch
	$pkgname-$pkgver-gcc-warnings-x86_64.patch
	$pkgname-$pkgver-WPA-mixed.patch
	$pkgname-$pkgver-convert-devicename-to-wlanX.patch
	$pkgname-$pkgver-remove-potential-conflicts-with-rt2860sta.patch
	$pkgname-$pkgver-return_nonvoid.patch
	$pkgname-$pkgver-reduce_debug_output.patch
	$pkgname-$pkgver-remove_date_time.patch
)

build() {
	_kernver=$(pacman -Q linux | cut -d . -f 2 | cut -f 1 -d -)
	KERNEL_RELEASE=$(cat /usr/lib/modules/extramodules-3.$_kernver-ARCH/version)

	cd "$srcdir/DPO_RT3562_3592_3062_LinuxSTA_V2.4.1.1_20101217"
	patch -p0 -i "$srcdir/$pkgname-$pkgver-config.patch"
	[ "$CARCH" == "x86_64" ] && patch -p0 -i "$srcdir/$pkgname-$pkgver-gcc-warnings-x86_64.patch"
	patch -p0 -i "$srcdir/$pkgname-$pkgver-WPA-mixed.patch"
	patch -p0 -i "$srcdir/$pkgname-$pkgver-convert-devicename-to-wlanX.patch"
	patch -p0 -i "$srcdir/$pkgname-$pkgver-remove-potential-conflicts-with-rt2860sta.patch"
	patch -p0 -i "$srcdir/$pkgname-$pkgver-return_nonvoid.patch"
	patch -p0 -i "$srcdir/$pkgname-$pkgver-reduce_debug_output.patch"
	patch -p0 -i "$srcdir/$pkgname-$pkgver-remove_date_time.patch"

	# clean up this mess of mixing RT2860STA with RT3562STA
	# in documentation files
	mv RT2860STA.dat RT3562STA.dat
	mv RT2860STACard.dat RT3562STACard.dat
	sed -i 's/2860/3562/g' *STA* iwpriv_usage.txt

	# as we change the default name of the interface from raX to wlanX, change respective references in documentation, too
	sed -i 's|ra0|wlan0|g' *.txt README* *.dat
	sed -i 's|ra1|wlan1|g' *.txt README* *.dat
	sed -i 's|ra2|wlan2|g' *.txt README* *.dat

	export EXTRA_CFLAGS="-DVERSION=$pkgver"

	# this Makefile is far too strict...
	echo "LINUX_SRC = /usr/lib/modules/$KERNEL_RELEASE/build" >> Makefile

	make
}

package() {
	_kernver=$(pacman -Q linux | cut -d . -f 2 | cut -f 1 -d -)
	depends=("linux>=3.${_kernver}" "linux<3.$(expr ${_kernver} + 1)")
	KERNEL_VERSION=$(cat /usr/lib/modules/extramodules-3.$_kernver-ARCH/version)
	msg "Kernel = $KERNEL_VERSION"

	cd "$srcdir/DPO_RT3562_3592_3062_LinuxSTA_V2.4.1.1_20101217"

	install -Dm 0640 RT3562STA.dat "$pkgdir/etc/Wireless/RT3562STA/RT3562STA.dat"
	install -Dm 0644 os/linux/$pkgname.ko "$pkgdir/usr/lib/modules/extramodules-3.$_kernver-ARCH/$pkgname.ko"
	install -dm 0755 "$pkgdir/usr/share/doc/$pkgname"
	install -m 0644 iwpriv_usage.txt README* RT3562STA* sta_ate_iwpriv_usage.txt "$pkgdir/usr/share/doc/$pkgname"

	find "$pkgdir" -name '*.ko' -exec gzip -9 {} \;
	sed -i "s|extramodules-.*-ARCH|extramodules-3.$_kernver-ARCH|" "$startdir/$pkgname.install"
}

sha256sums=('71cd27784009894198f03470ec88e77f2cd176bf5f8d93b4dd984d3a3e543d5a'
            'b1465fceaac99f26cc0e7db0562d2bf103b57656f0b7b57e404f59efb3373b27'
            'd013ed5981a02be27b4aaf1e03670d68dbb16f40d9eb84930e58a96fc38ef947'
            'c962d014ea6e84a8c3398ff13e4709cc309c29134cac0b5c702eab1026799887'
            'e966d96026baee0447d6ad26742bcc40baa3f94530573d58f4eca842e107f809'
            '7d2a83edfe6664a8e923dcda636c871220efc7ff4a82ab76a62fc97a11f2fcaa'
            'd672b58cdb278e3ecaeb46f3e5e477e1da7d2fd5dbf896521a4d0993743b9ab9'
            '4d1d5eb5c22d356af62f4f55d12b04eb8a557ea9c664edfbc79c9e0454ccca4e'
            'a888d045b142127070c2c23ed1a84306d5202896265c828cf7e125ec2dd52389')