comparison lib/libblockdev/libblockdev.sh @ 906:61459eb42b0f

lib/libblockdev: initial import, closes #2207
author David Demelier <markand@malikania.fr>
date Mon, 26 Aug 2019 20:15:00 +0200
parents
children ddab65a5b3f5
comparison
equal deleted inserted replaced
905:ddd05af79e28 906:61459eb42b0f
1 #!/bin/sh
2 #
3 # Copyright (c) 2019 David Demelier <markand@malikania.fr>
4 #
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
8 #
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #
17
18 # TODO: add more options as packages are available
19
20 PKGNAME=libblockdev
21 PKGVERSION=2.22
22 PKGREVISION=1
23 PKGLICENSE="LGPLv21"
24 PKGSUMMARY="a library for manipulating block devices"
25 PKGDOWNLOAD="https://github.com/storaged-project/libblockdev/releases/download/$PKGVERSION-1/$PKGNAME-$PKGVERSION.tar.gz"
26 PKGOPTIONS="LVM PYTHON"
27
28 : ${CHOST:=$(uname -m)-linux-musl}
29 : ${CBUILD:=$(uname -m)-linux-musl}
30 : ${CC:=clang}
31 : ${CFLAGS:=-O2}
32 : ${CXX:=clang++}
33 : ${CXXFLAGS:=-O2}
34 : ${LDFLAGS:=}
35 : ${LIBS:=}
36 : ${LVM:=yes}
37 : ${PYTHON:=yes}
38
39 if [ "$LVM" = "yes" ]; then
40 PKGDEPENDS="lvm2 $PKGDEPENDS"
41 with_lvm="--with-lvm --with-lvm_dbus"
42 else
43 with_lvm="--without-lvm --without-lvm_dbus"
44 fi
45
46 if [ "$PYTHON" = "yes" ]; then
47 PKGDEPENDS="python $PKGDEPENDS"
48 with_python="--with-python3"
49 else
50 with_python="--without-python3"
51 fi
52
53 build()
54 {
55 rm -rf $PKGNAME-$PKGVERSION
56 tar xvf $PKGNAME-$PKGVERSION.tar.gz
57 cd $PKGNAME-$PKGVERSION
58
59 CC="$CC" \
60 CFLAGS="$CFLAGS" \
61 CXX="$CXX" \
62 CXXFLAGS="$CXXFLAGS" \
63 LDFLAGS="$LDFLAGS" \
64 LIBS="$LIBS" \
65 ./configure \
66 --build=$CBUILD \
67 --host=$CHOST \
68 --prefix= \
69 --without-btrfs \
70 --without-crypto \
71 --without-dmraid \
72 --without-fs \
73 --without-kbd \
74 --without-mdraid \
75 --without-nvdimm \
76 --without-part \
77 --without-python2 \
78 --without-tools \
79 --without-vdo \
80 $with_lvm \
81 $with_python
82 make
83 make install DESTDIR=$DESTDIR
84 find $DESTDIR -type f -name "*.la" -delete
85
86 cd ..
87 rm -rf $PKGNAME-$PKGVERSION
88 }