53 lines
1.3 KiB
Bash
Executable file
53 lines
1.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Build n2n.
|
|
|
|
|
|
BUILDROOT=${PWD}
|
|
|
|
mkdir -p bin
|
|
|
|
|
|
function buildn2n() {
|
|
TRIPLE=$1
|
|
TOOLCHAIN=${BUILDROOT}/cmake/${TRIPLE}.cmake
|
|
|
|
pushd n2n/thirdparty/libnatpmp
|
|
sed -i 's/Iphlpapi/iphlpapi/g' CMakeLists.txt
|
|
[[ -d build ]] && rm -rf build
|
|
mkdir -p build
|
|
cd build
|
|
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN} ..
|
|
make
|
|
popd
|
|
|
|
pushd n2n/thirdparty/miniupnp/miniupnpc
|
|
[[ -d build ]] && rm -rf build
|
|
mkdir -p build
|
|
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN} ..
|
|
make
|
|
popd
|
|
|
|
pushd n2n
|
|
./autogen.sh
|
|
CFLAGS="-I ${BUILDROOT}/n2n/thirdparty/libnatpmp -I ${BUILDROOT}/n2n/thirdparty/miniupnp/miniupnpc/include" \
|
|
LDFLAGS="-L ${BUILDROOT}/n2n/thirdparty/libnatpmp/build -L ${BUILDROOT}/n2n/thirdparty/miniupnp/miniupnpc/build" \
|
|
./configure \
|
|
--target=${TRIPLE} \
|
|
--host=${TRIPLE} \
|
|
--build=x86_64-linux \
|
|
--enable-pthread \
|
|
--enable-natpmp \
|
|
--enable-miniupnp
|
|
make edge
|
|
make supernode
|
|
upx -9 edge
|
|
upx -9 supernode
|
|
mv edge ../bin/${TRIPLE}-edge
|
|
mv supernode ../bin/${TRIPLE}-supernode
|
|
popd
|
|
}
|
|
|
|
|
|
buildn2n "x86_64-linux-gnu"
|
|
buildn2n "x86_64-w64-mingw32"
|