forked from captainjack64/hacktv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_win64.sh
executable file
·116 lines (92 loc) · 2.86 KB
/
build_win64.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
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
#!/bin/bash
set -e
set -x
HOST=x86_64-w64-mingw32
PREFIX=$(pwd)/build_win64/install_root
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
mkdir -p $PREFIX
cd build_win64
if [[ ! -f $PREFIX/lib/libusb-1.0.a ]]; then
if [[ ! -f libusb-1.0.22.tar.bz2 ]]; then
wget https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.tar.bz2
tar -xvjf libusb-1.0.22.tar.bz2
fi
cd libusb-1.0.22
./configure --host=$HOST --prefix=$PREFIX --enable-static --disable-shared
make -j4 install
cd ..
fi
if [[ ! -f $PREFIX/lib/libhackrf.a ]]; then
if [[ ! -f hackrf-2018.01.1.tar.gz ]]; then
wget https://github.com/mossmann/hackrf/archive/v2018.01.1/hackrf-2018.01.1.tar.gz
tar -xvzf hackrf-2018.01.1.tar.gz
fi
rm -rf hackrf-2018.01.1/host/libhackrf/build
mkdir -p hackrf-2018.01.1/host/libhackrf/build
cd hackrf-2018.01.1/host/libhackrf/build
mingw64-cmake \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_INSTALL_LIBPREFIX=$PREFIX/lib \
-DLIBUSB_INCLUDE_DIR=$PREFIX/include/libusb-1.0 \
-DLIBUSB_LIBRARIES=$PREFIX/lib/libusb-1.0.a
make -j4 install
cd ../../../..
mv $PREFIX/bin/*.a $PREFIX/lib/
find $PREFIX -name libhackrf\*.dll\* -delete
fi
if [[ ! -f $PREFIX/lib/libosmo-fl2k.a ]]; then
if [[ ! -d osmo-fl2k ]]; then
git clone --depth 1 git://git.osmocom.org/osmo-fl2k
fi
rm -rf osmo-fl2k/build
mkdir -p osmo-fl2k/build
cd osmo-fl2k/build
mingw64-cmake \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_INSTALL_LIBPREFIX=$PREFIX \
-DCMAKE_INSTALL_LIBDIR=$PREFIX/lib \
-DLIBUSB_INCLUDE_DIR=$PREFIX/include/libusb-1.0 \
-DLIBUSB_LIBRARIES=$PREFIX/lib/libusb-1.0.a
make -j4 install
cd ../..
mv $PREFIX/lib/liblibosmo-fl2k_static.a $PREFIX/lib/libosmo-fl2k.a
fi
if [[ ! -f $PREFIX/lib/libfdk-aac.a ]]; then
if [[ ! -d fdk-aac ]]; then
git clone https://github.com/mstorsjo/fdk-aac.git
fi
cd fdk-aac
./autogen.sh
./configure --host=$HOST --prefix=$PREFIX --enable-static --disable-shared
make -j4 install
cd ..
fi
if [[ ! -f $PREFIX/lib/libopus.a ]]; then
if [[ ! -f opus-1.3.tar.gz ]]; then
wget https://archive.mozilla.org/pub/opus/opus-1.3.tar.gz
tar -xvzf opus-1.3.tar.gz
fi
cd opus-1.3
./configure --host=$HOST --prefix=$PREFIX --enable-static --disable-shared --disable-doc --disable-extra-programs
make -j4 install
cd ..
fi
if [[ ! -f $PREFIX/lib/libavformat.a ]]; then
if [[ ! -d ffmpeg ]]; then
git clone --depth 1 https://github.com/FFmpeg/FFmpeg.git ffmpeg
fi
cd ffmpeg
./configure \
--enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libopus \
--enable-static --disable-shared --disable-programs \
--disable-outdevs --disable-encoders \
--arch=x86_64 --target-os=mingw64 --cross-prefix=$HOST- \
--pkg-config=pkg-config --prefix=$PREFIX
make -j4 install
cd ..
fi
cd ..
CROSS_HOST=$HOST- make -j4 EXTRA_LDFLAGS="-static" EXTRA_PKGS="libusb-1.0"
mv -f hacktv hacktv.exe || true
$HOST-strip hacktv.exe
echo "Done"