-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathbuild_deps.sh
executable file
·79 lines (69 loc) · 2.41 KB
/
build_deps.sh
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
#!/usr/bin/env bash
#
# Download and build dependencies as static libs
#
# Inputs:
# CROSS_COMPILE - if set to a gcc tuple, tries to crosscompile
# (e.g., x86_64-w64-mingw32)
#
set -e
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
source $BASE_DIR/scripts/common.sh
# Download dependencies if not done already
$BASE_DIR/scripts/download_deps.sh
# Initialize some directories
mkdir -p $DEPS_INSTALL_DIR
cd $DEPS_DIR
# Build zlib
if [[ ! -e $DEPS_INSTALL_DIR/lib/libz.a ]]; then
echo Building zlib...
rm -fr $DEPS_DIR/zlib-*
tar xf $DOWNLOAD_DIR/zlib-$ZLIB_VERSION.tar.gz
cd zlib-$ZLIB_VERSION
if [ -n "$CROSS_COMPILE" ]; then
ZLIB_CONFIGURE_ENV="CC=$CROSS_COMPILE-gcc"
fi
(export $ZLIB_CONFIGURE_ENV; PKG_CONFIG_PATH=$PKG_CONFIG_PATH ./configure --prefix=$DEPS_INSTALL_DIR --static)
make $MAKE_FLAGS
make install
cd $DEPS_DIR
fi
# Build libconfuse
if [[ ! -e $DEPS_INSTALL_DIR/lib/libconfuse.a ]]; then
echo Building libconfuse...
rm -fr $DEPS_DIR/confuse-*
tar xf $DOWNLOAD_DIR/confuse-$CONFUSE_VERSION.tar.gz
cd confuse-$CONFUSE_VERSION
PKG_CONFIG_PATH=$PKG_CONFIG_PATH ./configure $CONFIGURE_ARGS --prefix=$DEPS_INSTALL_DIR --disable-examples --enable-shared=no
make $MAKE_FLAGS
make install
cd $DEPS_DIR
fi
# Build libarchive
if [[ ! -e $DEPS_INSTALL_DIR/lib/libarchive.a ]]; then
echo Building libarchive...
rm -fr libarchive-*
tar xf $DOWNLOAD_DIR/libarchive-$LIBARCHIVE_VERSION.tar.gz
cd libarchive-$LIBARCHIVE_VERSION
PKG_CONFIG_PATH=$PKG_CONFIG_PATH LDFLAGS=-L$DEPS_INSTALL_DIR/lib CPPFLAGS=-I$DEPS_INSTALL_DIR/include ./configure \
$CONFIGURE_ARGS \
--prefix=$DEPS_INSTALL_DIR --without-xml2 --without-openssl \
--without-nettle --without-expat --without-lzo2 --without-lzma \
--without-bz2lib --without-iconv --enable-shared=no --disable-bsdtar \
--disable-bsdcpio --disable-bsdcat --disable-xattr \
--without-libiconv-prefix --without-lz4 --without-cng --without-zstd
make $MAKE_FLAGS
make install
cd $DEPS_DIR
fi
# Return to the base directory
cd $BASE_DIR
echo Dependencies built successfully!
echo
echo To compile fwup statically with these libraries, run:
echo
echo "./autogen.sh # if you're compiling from source"
echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH ./configure $CONFIGURE_ARGS --enable-shared=no
echo make
echo make check
echo make install