N2N and Godot runtime with embedded edge now building for Linux and Windows.
This commit is contained in:
parent
f16608815f
commit
256c493e82
6 changed files with 151 additions and 19 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,6 +1,8 @@
|
||||||
*~
|
*~
|
||||||
output.log
|
output.log
|
||||||
bin/
|
bin/
|
||||||
|
n2n/CMakeLists.txt
|
||||||
|
n2n/include/config.h
|
||||||
modules/embedded/embeds/
|
modules/embedded/embeds/
|
||||||
hamncheese/export_presets.cfg
|
hamncheese/export_presets.cfg
|
||||||
temp/
|
temp/
|
||||||
|
|
85
N2NCMakeLists.txt
Normal file
85
N2NCMakeLists.txt
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
cmake_minimum_required(VERSION 3.22)
|
||||||
|
|
||||||
|
project(n2n VERSION 3.1.1)
|
||||||
|
|
||||||
|
set(N2N_SOURCE
|
||||||
|
src/aes.c
|
||||||
|
src/auth.c
|
||||||
|
src/cc20.c
|
||||||
|
src/curve25519.c
|
||||||
|
src/edge_management.c
|
||||||
|
src/edge_utils.c
|
||||||
|
src/header_encryption.c
|
||||||
|
src/hexdump.c
|
||||||
|
src/json.c
|
||||||
|
src/management.c
|
||||||
|
src/minilzo.c
|
||||||
|
src/n2n.c
|
||||||
|
src/n2n_port_mapping.c
|
||||||
|
src/n2n_regex.c
|
||||||
|
src/network_traffic_filter.c
|
||||||
|
src/pearson.c
|
||||||
|
src/random_numbers.c
|
||||||
|
src/sn_management.c
|
||||||
|
src/sn_selection.c
|
||||||
|
src/sn_utils.c
|
||||||
|
src/speck.c
|
||||||
|
src/tf.c
|
||||||
|
src/transform_aes.c
|
||||||
|
src/transform_cc20.c
|
||||||
|
src/transform_lzo.c
|
||||||
|
src/transform_null.c
|
||||||
|
src/transform_speck.c
|
||||||
|
src/transform_tf.c
|
||||||
|
src/transform_zstd.c
|
||||||
|
src/tuntap_freebsd.c
|
||||||
|
src/tuntap_linux.c
|
||||||
|
src/tuntap_netbsd.c
|
||||||
|
src/tuntap_osx.c
|
||||||
|
src/wire.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if(DEFINED WIN32)
|
||||||
|
set(WIN_IS_DUMB "lib")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(N2N_LIBS
|
||||||
|
n2n
|
||||||
|
${CMAKE_SOURCE_DIR}/thirdparty/libnatpmp/build/libnatpmp.a
|
||||||
|
${CMAKE_SOURCE_DIR}/thirdparty/miniupnp/miniupnpc/build/${WIN_IS_DUMB}libminiupnpc.a
|
||||||
|
)
|
||||||
|
|
||||||
|
if(DEFINED WIN32)
|
||||||
|
set(N2N_SOURCE
|
||||||
|
${N2N_SOURCE}
|
||||||
|
src/win32/edge_utils_win32.c
|
||||||
|
src/win32/getopt1.c
|
||||||
|
src/win32/getopt.c
|
||||||
|
src/win32/wintap.c
|
||||||
|
)
|
||||||
|
set(N2N_LIBS
|
||||||
|
${N2N_LIBS}
|
||||||
|
netapi32
|
||||||
|
ws2_32
|
||||||
|
iphlpapi
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
include
|
||||||
|
${CMAKE_SOURCE_DIR}/thirdparty/libnatpmp/build
|
||||||
|
${CMAKE_SOURCE_DIR}/thirdparty/miniupnp/miniupnpc/build
|
||||||
|
)
|
||||||
|
|
||||||
|
add_definitions(
|
||||||
|
-O2
|
||||||
|
-DNDEBUG
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(n2n ${N2N_SOURCE})
|
||||||
|
|
||||||
|
add_executable(edge src/edge.c)
|
||||||
|
target_link_libraries(edge ${N2N_LIBS})
|
||||||
|
|
||||||
|
add_executable(supernode src/supernode.c)
|
||||||
|
target_link_libraries(supernode ${N2N_LIBS})
|
44
N2Nconfig.h
Normal file
44
N2Nconfig.h
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/* include/config.h. Generated from config.h.in by configure. */
|
||||||
|
/* include/config.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `cap' library (-lcap). */
|
||||||
|
/* #undef HAVE_LIBCAP */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `crypto' library (-lcrypto). */
|
||||||
|
/* #undef HAVE_LIBCRYPTO */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `miniupnpc' library (-lminiupnpc). */
|
||||||
|
#define HAVE_LIBMINIUPNPC 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `natpmp' library (-lnatpmp). */
|
||||||
|
#define HAVE_LIBNATPMP 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pcap' library (-lpcap). */
|
||||||
|
/* #undef HAVE_LIBPCAP */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||||
|
//#define HAVE_LIBPTHREAD 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `zstd' library (-lzstd). */
|
||||||
|
/* #undef HAVE_LIBZSTD */
|
||||||
|
|
||||||
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
|
#define PACKAGE_BUGREPORT ""
|
||||||
|
|
||||||
|
/* Last change date */
|
||||||
|
#define PACKAGE_BUILDDATE "Sat Sep 23 18:31:22 CDT 2023"
|
||||||
|
|
||||||
|
/* Define to the full name of this package. */
|
||||||
|
#define PACKAGE_NAME "edge"
|
||||||
|
|
||||||
|
/* Define to the full name and version of this package. */
|
||||||
|
#define PACKAGE_STRING "edge 3.1.1"
|
||||||
|
|
||||||
|
/* Define to the one symbol short name of this package. */
|
||||||
|
#define PACKAGE_TARNAME "edge"
|
||||||
|
|
||||||
|
/* Define to the home page for this package. */
|
||||||
|
#define PACKAGE_URL ""
|
||||||
|
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#define PACKAGE_VERSION "3.1.1"
|
|
@ -67,6 +67,7 @@ LTO="lto=none" # Use "lto=full" for releases.
|
||||||
pushd bin
|
pushd bin
|
||||||
mkdir -p ../modules/embedded/embeds
|
mkdir -p ../modules/embedded/embeds
|
||||||
createEmbeddedBinary x86_64-linux-gnu-edge ../modules/embedded/embeds/linux_x86_64.h EDGE_H
|
createEmbeddedBinary x86_64-linux-gnu-edge ../modules/embedded/embeds/linux_x86_64.h EDGE_H
|
||||||
|
createEmbeddedBinary x86_64-w64-mingw32-edge.exe ../modules/embedded/embeds/windows_x86_64.h EDGE_H
|
||||||
popd
|
popd
|
||||||
|
|
||||||
pushd godot
|
pushd godot
|
||||||
|
@ -85,6 +86,7 @@ scons compiledb=yes
|
||||||
|
|
||||||
# Build Templates.
|
# Build Templates.
|
||||||
scons platform=linuxbsd target=template_release arch=x86_64 ${TEMPLATE} ${LTO}
|
scons platform=linuxbsd target=template_release arch=x86_64 ${TEMPLATE} ${LTO}
|
||||||
|
scons platform=windows target=template_release arch=x86_64 ${TEMPLATE} ${LTO}
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
|
33
build-n2n.sh
33
build-n2n.sh
|
@ -10,6 +10,7 @@ mkdir -p bin
|
||||||
|
|
||||||
function buildn2n() {
|
function buildn2n() {
|
||||||
TRIPLE=$1
|
TRIPLE=$1
|
||||||
|
SUFFIX=$2
|
||||||
TOOLCHAIN=${BUILDROOT}/cmake/${TRIPLE}.cmake
|
TOOLCHAIN=${BUILDROOT}/cmake/${TRIPLE}.cmake
|
||||||
|
|
||||||
pushd n2n/thirdparty/libnatpmp
|
pushd n2n/thirdparty/libnatpmp
|
||||||
|
@ -24,30 +25,28 @@ function buildn2n() {
|
||||||
pushd n2n/thirdparty/miniupnp/miniupnpc
|
pushd n2n/thirdparty/miniupnp/miniupnpc
|
||||||
[[ -d build ]] && rm -rf build
|
[[ -d build ]] && rm -rf build
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
|
cd build
|
||||||
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN} ..
|
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN} ..
|
||||||
make
|
make
|
||||||
popd
|
popd
|
||||||
|
|
||||||
pushd n2n
|
pushd n2n
|
||||||
./autogen.sh
|
cd include
|
||||||
CFLAGS="-I ${BUILDROOT}/n2n/thirdparty/libnatpmp -I ${BUILDROOT}/n2n/thirdparty/miniupnp/miniupnpc/include" \
|
ln -f -s ../../N2Nconfig.h config.h
|
||||||
LDFLAGS="-L ${BUILDROOT}/n2n/thirdparty/libnatpmp/build -L ${BUILDROOT}/n2n/thirdparty/miniupnp/miniupnpc/build" \
|
cd ..
|
||||||
./configure \
|
ln -f -s ../N2NCMakeLists.txt CMakeLists.txt
|
||||||
--target=${TRIPLE} \
|
[[ -d build ]] && rm -rf build
|
||||||
--host=${TRIPLE} \
|
mkdir -p build
|
||||||
--build=x86_64-linux \
|
cd build
|
||||||
--enable-pthread \
|
cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN} ..
|
||||||
--enable-natpmp \
|
make
|
||||||
--enable-miniupnp
|
upx -9 edge${SUFFIX}
|
||||||
make edge
|
upx -9 supernode${SUFFIX}
|
||||||
make supernode
|
mv edge${SUFFIX} ../../bin/${TRIPLE}-edge${SUFFIX}
|
||||||
upx -9 edge
|
mv supernode${SUFFIX} ../../bin/${TRIPLE}-supernode${SUFFIX}
|
||||||
upx -9 supernode
|
|
||||||
mv edge ../bin/${TRIPLE}-edge
|
|
||||||
mv supernode ../bin/${TRIPLE}-supernode
|
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
buildn2n "x86_64-linux-gnu"
|
buildn2n "x86_64-linux-gnu"
|
||||||
buildn2n "x86_64-w64-mingw32"
|
buildn2n "x86_64-w64-mingw32" ".exe"
|
||||||
|
|
|
@ -16,8 +16,8 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
#include "embeds/windows_x86_64.h"
|
#include "embeds/windows_x86_64.h"
|
||||||
unsigned char *data = x86_64_w64_mingw32_edge;
|
unsigned char *data = x86_64_w64_mingw32_edge_exe;
|
||||||
size_t length = (size_t)x86_64_w64_mingw32_edge_len;
|
size_t length = (size_t)x86_64_w64_mingw32_edge_exe_len;
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
#ifdef __arm__
|
#ifdef __arm__
|
||||||
#include "embeds/macos_arm64.h"
|
#include "embeds/macos_arm64.h"
|
||||||
|
|
Loading…
Add table
Reference in a new issue