tmake_zbar.sh - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
tmake_zbar.sh (3843B)
---
1 #!/bin/bash
2
3 # This script can be used on Linux hosts to build native libzbar binaries.
4 # sudo apt-get install pkg-config libx11-dev libx11-6 libv4l-dev libxv-dev libxext-dev libjpeg-dev
5 #
6 # It can also be used to cross-compile to Windows:
7 # $ sudo apt-get install mingw-w64 mingw-w64-tools win-iconv-mingw-w64-dev
8 # For a Windows x86 (32-bit) target, run:
9 # $ GCC_TRIPLET_HOST="i686-w64-mingw32" BUILD_TYPE="wine" ./contrib/make_zbar.sh
10 # Or for a Windows x86_64 (64-bit) target, run:
11 # $ GCC_TRIPLET_HOST="x86_64-w64-mingw32" BUILD_TYPE="wine" ./contrib/make_zbar.sh
12
13 ZBAR_VERSION="d2893738411be897a04caa42ffc13d1f6107d3c6"
14
15 set -e
16
17 . $(dirname "$0")/build_tools_util.sh || (echo "Could not source build_tools_util.sh" && exit 1)
18
19 here=$(dirname $(realpath "$0" 2> /dev/null || grealpath "$0"))
20 CONTRIB="$here"
21 PROJECT_ROOT="$CONTRIB/.."
22
23 pkgname="zbar"
24 info "Building $pkgname..."
25
26 (
27 cd $CONTRIB
28 if [ ! -d zbar ]; then
29 git clone https://github.com/mchehab/zbar.git
30 fi
31 cd zbar
32 if ! $(git cat-file -e ${ZBAR_VERSION}) ; then
33 info "Could not find requested version $ZBAR_VERSION in local clone; fetching..."
34 git fetch --all
35 fi
36 git reset --hard
37 git clean -dfxq
38 git checkout "${ZBAR_VERSION}^{commit}"
39
40 if [ "$BUILD_TYPE" = "wine" ] ; then
41 echo "libzbar_la_LDFLAGS += -Wc,-static" >> zbar/Makefile.am
42 echo "LDFLAGS += -Wc,-static" >> Makefile.am
43 fi
44 if ! [ -x configure ] ; then
45 autoreconf -vfi || fail "Could not run autoreconf for $pkgname. Please make sure you have automake and libtool installed, and try again."
46 fi
47 if ! [ -r config.status ] ; then
48 if [ "$BUILD_TYPE" = "wine" ] ; then
49 # windows target
50 ./configure \
51 $AUTOCONF_FLAGS \
52 --prefix="$here/$pkgname/dist" \
53 --with-x=no \
54 --enable-pthread=no \
55 --enable-doc=no \
56 --enable-video=yes \
57 --with-directshow=yes \
58 --with-jpeg=no \
59 --with-python=no \
60 --with-gtk=no \
61 --with-qt=no \
62 --with-java=no \
63 --with-imagemagick=no \
64 --with-dbus=no \
65 --enable-codes=qrcode \
66 --disable-dependency-tracking \
67 --disable-static \
68 --enable-shared || fail "Could not configure $pkgname. Please make sure you have a C compiler installed and try again."
69 else
70 # linux target
71 ./configure \
72 $AUTOCONF_FLAGS \
73 --prefix="$here/$pkgname/dist" \
74 --with-x=yes \
75 --enable-pthread=no \
76 --enable-doc=no \
77 --enable-video=yes \
78 --with-jpeg=yes \
79 --with-python=no \
80 --with-gtk=no \
81 --with-qt=no \
82 --with-java=no \
83 --with-imagemagick=no \
84 --with-dbus=no \
85 --enable-codes=qrcode \
86 --disable-static \
87 --enable-shared || fail "Could not configure $pkgname. Please make sure you have a C compiler installed and try again."
88 fi
89 fi
90 make -j4 || fail "Could not build $pkgname"
91 make install || fail "Could not install $pkgname"
92 . "$here/$pkgname/dist/lib/libzbar.la"
93 host_strip "$here/$pkgname/dist/lib/$dlname"
94 cp -fpv "$here/$pkgname/dist/lib/$dlname" "$PROJECT_ROOT/electrum" || fail "Could not copy the $pkgname binary to its destination"
95 info "$dlname has been placed in the inner 'electrum' folder."
96 if [ -n "$DLL_TARGET_DIR" ] ; then
97 cp -fpv "$here/$pkgname/dist/lib/$dlname" "$DLL_TARGET_DIR" || fail "Could not copy the $pkgname binary to DLL_TARGET_DIR"
98 fi
99 )