aboutsummaryrefslogtreecommitdiffstats
path: root/community/mtd-utils/APKBUILD
blob: befb340d2357f0152183d2528999b652fef3f6b0 (plain) (blame)
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
# Maintainer: Olliver Schinagl <oliver@schinagl.nl>
pkgname=mtd-utils
pkgver=2.1.0
pkgrel=0
pkgdesc="Utilities for handling MTD devices, and for dealing with FTL, NFTL JFFS2, etc."
url="http://www.linux-mtd.infradead.org/"
arch="noarch"
license="GPL-2.0-only"
makedepends="
	acl-dev
	autoconf
	automake
	coreutils
	cmocka-dev
	libtool
	linux-headers
	lzo-dev
	openssl-dev
	util-linux-dev
	zlib-dev
	"
checkdepends="findutils"
options="!check" # checks fail on builders
_subpackages="
	$pkgname-flash::all
	$pkgname-jffs::all
	$pkgname-misc::all
	$pkgname-nand::all
	$pkgname-nor::all
	$pkgname-ubi::all
	"
subpackages="$pkgname-doc $_subpackages"
_githash="1dba7944fe18978415a3ffc43932359a36b99b25"
source="
	$pkgname-$pkgver.tar.gz::http://git.infradead.org/mtd-utils.git/snapshot/$_githash.tar.gz
	0001-unittests-test_lib-Include-proper-header-for-_IOC_SI.patch
	0002-unittests-libmtd_test-Include-fcntl-header.patch
	0003-unittests-Define-the-use-of-_GNU_SOURCE.patch
	"
builddir="$srcdir/$pkgname-$(echo "$_githash" | cut -c1-7)"

build() {
	./autogen.sh
	./configure \
	            --build="$CBUILD" \
	            --enable-tests \
	            --enable-unit-tests \
	            --host="$CHOST" \
	            --mandir="/usr/share/man" \
	            --prefix="/usr" \
	            --sysconfdir="/etc"
	make
}

_cat_found_file() {
	local _rc="$?"
	find -name "$1" -type f -ls -printf '%P {{{\n' -exec cat -v -n '{}' ';' -printf '}}} %P\n'
	return "$_rc"
}

check() {
	make check || _cat_found_file 'test-suite.log'
}

flash() {
	pkgdesc="MTD utils (flash commands)"

	mkdir -p "$subpkgdir/usr/sbin"
	find "$pkgdir/usr/sbin/" -type f \( \
	     -iname '*flash*' \) \
	     -exec mv -t "$subpkgdir/usr/sbin/" "{}" +
}

jffs() {
	pkgdesc="MTD utils (JFFS* commands)"

	echo "$subpkgdir"
	mkdir -p "$subpkgdir/usr/sbin"
	find "$pkgdir/usr/sbin/" -type f \(\
	     -iname '*jffs*' -o -iname 'sumtool' \)\
	     -exec mv -t "$subpkgdir/usr/sbin/" "{}" +
}

misc() {
	pkgdesc="MTD utils (miscellaneous commands)"

	mkdir -p "$subpkgdir/usr/sbin"
	find "$pkgdir/usr/sbin/" -type f \(\
	     -iname '*doc*' -o -iname 'ftl*' -o \
	     -iname 'mtdpart' -o -iname 'mtd_debug' -o \
	     -iname 'recv_image' -o -iname 'serve_image' \)\
	     -exec mv -t "$subpkgdir/usr/sbin/" "{}" +
}

nand() {
	pkgdesc="MTD utils (NAND and FTL commands)"

	mkdir -p "$subpkgdir/usr/sbin"
	find "$pkgdir/usr/sbin/" -type f \(\
	     -iname 'nand*' -o -iname 'nftl*' \)\
	     -exec mv -t "$subpkgdir/usr/sbin/" "{}" +
}

nor() {
	pkgdesc="MTD utils (NOR flash commands)"

	mkdir -p "$subpkgdir/usr/sbin"
	find "$pkgdir/usr/sbin/" -type f \(\
	     -iname '*nor*' -o -iname 'rfd*' \)\
	     -exec mv -t "$subpkgdir/usr/sbin/" "{}" +
}

ubi() {
	pkgdesc="MTD utils (UBI and UBIFS commands)"

	mkdir -p "$subpkgdir/usr/sbin"
	find "$pkgdir/usr/sbin/" -type f \(\
	     -iname '*ubi*' -o \
	     -iname 'lsmtd' -o -iname 'mtdinfo' \)\
	     -exec mv -t "$subpkgdir/usr/sbin/" "{}" +
}

package() {
	depends="$_subpackages"

	make DESTDIR="$pkgdir" install
}

sha512sums="bb64b6cbdaee3c731ed1dc136064507fbfffe8a45879b0c4024a2b46d320875252f42af8dc268b30247ebb81a7a89b951e19a896bb415de38877c45b031e1081  mtd-utils-2.1.0.tar.gz
70013f50fad529e94733cd86349d4efe4d99c5febd7c407ab3db0c2995fd6be0524b3ebc59537ff13a4be9a8f63100468a9faa8590ea4d84f79995398b0fd7d9  0001-unittests-test_lib-Include-proper-header-for-_IOC_SI.patch
eb6d72e2810218c90044f562ec2d58543f42066ca4719ec5c1199dfdebeacacbde931b59ad12a39df7834fb2b8cef240bed839840c11b3cac9761dd44e63bca8  0002-unittests-libmtd_test-Include-fcntl-header.patch
e29c485a96b959c26f39a0a05a78e2a562f2bda0a2acc7ed532b6ebda46139f9e4c88b4df0f9dc13051dd5aa50ad60f82880f3da412b59d46fca527a88a30f5d  0003-unittests-Define-the-use-of-_GNU_SOURCE.patch"