aboutsummaryrefslogtreecommitdiffstats
path: root/community/mtd-utils/APKBUILD
blob: 9842c3912b5976736c92a807a90adee6d0d4a93c (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
# Maintainer: Olliver Schinagl <oliver@schinagl.nl>
pkgname="mtd-utils"
pkgver="2.1.1"
pkgrel="0"
pkgdesc="Utilities for handling MTD devices, and for dealing with FTL, NFTL JFFS2, etc."
options="!check" # Tests fail on builder
url="http://www.linux-mtd.infradead.org/"
arch="all"
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
	zstd-dev
	"
checkdepends="findutils"
_subpackages="
	$pkgname-flash
	$pkgname-jffs
	$pkgname-misc
	$pkgname-nand
	$pkgname-nor
	$pkgname-ubi
	"
subpackages="$pkgname-doc $_subpackages"
_githash="beb39b15e926747fe404376ceb148c1b56c998f6"
source="
	$pkgname-$pkgver.tar.gz::http://git.infradead.org/mtd-utils.git/snapshot/$_githash.tar.gz
	"
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="ec5b0bb00ec97ca759fc1cca83af716fb24f9465d70d61c38cf5ab02e7e30b456d2c884ade6dc594dc37412bbb6100cb954bcb4f5a0caf35e6581a0652f6496d  mtd-utils-2.1.1.tar.gz"