71 lines
1.8 KiB
Bash
Executable file
71 lines
1.8 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#
|
|
# Ham'n'Cheese
|
|
# Copyright (C) 2023-2024 Scott Duensing <scott@kangaroopunch.com>
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# as published by the Free Software Foundation; either version 3
|
|
# of the License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, see <http://www.gnu.org/licenses/>
|
|
#
|
|
|
|
|
|
# Build n2n.
|
|
|
|
|
|
BUILDROOT=${PWD}
|
|
|
|
mkdir -p bin
|
|
|
|
|
|
function buildn2n() {
|
|
TRIPLE=$1
|
|
SUFFIX=$2
|
|
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
|
|
cd build
|
|
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN} ..
|
|
make
|
|
popd
|
|
|
|
pushd n2n
|
|
cd include
|
|
ln -f -s ../../N2Nconfig.h config.h
|
|
cd ..
|
|
ln -f -s ../N2NCMakeLists.txt CMakeLists.txt
|
|
[[ -d build ]] && rm -rf build
|
|
mkdir -p build
|
|
cd build
|
|
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN} ..
|
|
make
|
|
upx -9 edge${SUFFIX}
|
|
upx -9 supernode${SUFFIX}
|
|
mv edge${SUFFIX} ../../bin/${TRIPLE}-edge${SUFFIX}
|
|
mv supernode${SUFFIX} ../../bin/${TRIPLE}-supernode${SUFFIX}
|
|
popd
|
|
}
|
|
|
|
|
|
buildn2n "x86_64-linux-gnu"
|
|
buildn2n "x86_64-w64-mingw32" ".exe"
|