diff --git a/packages/softether-vpn/CMakeLists.txt.patch b/packages/softether-vpn/CMakeLists.txt.patch new file mode 100644 index 000000000..00a649cdf --- /dev/null +++ b/packages/softether-vpn/CMakeLists.txt.patch @@ -0,0 +1,13 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -41,8 +41,8 @@ + + include(CheckIncludeFile) + Check_Include_File(sys/auxv.h HAVE_SYS_AUXV) +- if(EXISTS "/lib/systemd/system") +- set(CMAKE_INSTALL_SYSTEMD_UNITDIR "/lib/systemd/system" CACHE STRING "Where to install systemd unit files") ++ if(TRUE) ++ set(CMAKE_INSTALL_SYSTEMD_UNITDIR "@TERMUX_PREFIX@/lib/systemd/system" CACHE STRING "Where to install systemd unit files") + endif() + endif() + diff --git a/packages/softether-vpn/build.sh b/packages/softether-vpn/build.sh new file mode 100644 index 000000000..199e2c93b --- /dev/null +++ b/packages/softether-vpn/build.sh @@ -0,0 +1,44 @@ +TERMUX_PKG_HOMEPAGE=https://www.softether.org/ +TERMUX_PKG_DESCRIPTION="An open-source cross-platform multi-protocol VPN program" +TERMUX_PKG_LICENSE="Apache-2.0" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=(5.02.5180) +TERMUX_PKG_VERSION+=(1.0.18) +TERMUX_PKG_SRCURL=(https://github.com/SoftEtherVPN/SoftEtherVPN/releases/download/${TERMUX_PKG_VERSION}/SoftEtherVPN-${TERMUX_PKG_VERSION}.tar.xz + https://github.com/jedisct1/libsodium/archive/${TERMUX_PKG_VERSION[1]}-RELEASE.tar.gz) +TERMUX_PKG_SHA256=(b5649a8ea3cc6477325e09e2248ef708d434ee3b2251eb8764bcfc15fb1de456 + b7292dd1da67a049c8e78415cd498ec138d194cfdb302e716b08d26b80fecc10) +TERMUX_PKG_DEPENDS="libiconv, libsodium, ncurses, openssl, readline, zlib" +TERMUX_PKG_FORCE_CMAKE=true +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +-DHAS_SSE2=OFF +" +TERMUX_PKG_HOSTBUILD=true +TERMUX_PKG_RM_AFTER_INSTALL="lib/systemd" + +termux_step_post_get_source() { + mv libsodium-${TERMUX_PKG_VERSION[1]}-RELEASE libsodium +} + +termux_step_host_build() { + local _PREFIX_FOR_BUILD=$TERMUX_PKG_HOSTBUILD_DIR/prefix + mkdir -p $_PREFIX_FOR_BUILD + mkdir -p libsodium + pushd libsodium + $TERMUX_PKG_SRCDIR/libsodium/configure --prefix=$_PREFIX_FOR_BUILD + make -j $TERMUX_MAKE_PROCESSES + make install + popd + + export PKG_CONFIG_PATH=$_PREFIX_FOR_BUILD/lib/pkgconfig + + termux_setup_cmake + cmake $TERMUX_PKG_SRCDIR + make -j $TERMUX_MAKE_PROCESSES + + unset PKG_CONFIG_PATH +} + +termux_step_post_configure() { + export PATH=$TERMUX_PKG_HOSTBUILD_DIR/src/hamcorebuilder:$PATH +} diff --git a/packages/softether-vpn/src-CMakeLists.txt.patch b/packages/softether-vpn/src-CMakeLists.txt.patch new file mode 100644 index 000000000..6fe9c2024 --- /dev/null +++ b/packages/softether-vpn/src-CMakeLists.txt.patch @@ -0,0 +1,11 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -69,7 +69,7 @@ + + add_definitions(-DUNIX -DOS_UNIX) + +- if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") ++ if(${CMAKE_SYSTEM_NAME} MATCHES "Android|Linux") + add_definitions(-DUNIX_LINUX) + if("$ENV{USE_MUSL}" STREQUAL "YES") + add_definitions(-DUNIX_LINUX_MUSL) diff --git a/packages/softether-vpn/src-Cedar-CMakeLists.txt.patch b/packages/softether-vpn/src-Cedar-CMakeLists.txt.patch new file mode 100644 index 000000000..3bc9f4b27 --- /dev/null +++ b/packages/softether-vpn/src-Cedar-CMakeLists.txt.patch @@ -0,0 +1,10 @@ +--- a/src/Cedar/CMakeLists.txt ++++ b/src/Cedar/CMakeLists.txt +@@ -19,7 +19,6 @@ + RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}" + ) + +-cmake_host_system_information(RESULT HAS_SSE2 QUERY HAS_SSE2) + + set(BLAKE2_SRC_PATH $,${TOP_DIRECTORY}/3rdparty/BLAKE2/sse,${TOP_DIRECTORY}/3rdparty/BLAKE2/ref>) + set(BLAKE2_SRC $,${BLAKE2_SRC_PATH}/blake2s.c,${BLAKE2_SRC_PATH}/blake2s-ref.c>) diff --git a/packages/softether-vpn/src-Cedar-Cedar.c.patch b/packages/softether-vpn/src-Cedar-Cedar.c.patch new file mode 100644 index 000000000..d0c2528f2 --- /dev/null +++ b/packages/softether-vpn/src-Cedar-Cedar.c.patch @@ -0,0 +1,11 @@ +--- a/src/Cedar/Cedar.c ++++ b/src/Cedar/Cedar.c +@@ -1290,7 +1290,7 @@ + // Initialize net service list + void InitNetSvcList(CEDAR *cedar) + { +- char filename[MAX_PATH] = "/etc/services"; ++ char filename[MAX_PATH] = "@TERMUX_PREFIX@/etc/services"; + BUF *b; + // Validate arguments + if (cedar == NULL) diff --git a/packages/softether-vpn/src-Mayaqua-FileIO.c.orig.patch b/packages/softether-vpn/src-Mayaqua-FileIO.c.orig.patch new file mode 100644 index 000000000..d35b4c7f6 --- /dev/null +++ b/packages/softether-vpn/src-Mayaqua-FileIO.c.orig.patch @@ -0,0 +1,13 @@ +--- a/src/Mayaqua/FileIO.c ++++ b/src/Mayaqua/FileIO.c +@@ -20,8 +20,8 @@ + + #include + +-static char exe_file_name[MAX_SIZE] = "/tmp/a.out"; +-static wchar_t exe_file_name_w[MAX_SIZE] = L"/tmp/a.out"; ++static char exe_file_name[MAX_SIZE] = "@TERMUX_PREFIX@/tmp/a.out"; ++static wchar_t exe_file_name_w[MAX_SIZE] = L"@TERMUX_PREFIX@/tmp/a.out"; + static LIST *hamcore = NULL; + static HAMCORE *hamcore_io = NULL; + diff --git a/packages/softether-vpn/src-Mayaqua-Mayaqua.c.orig.patch b/packages/softether-vpn/src-Mayaqua-Mayaqua.c.orig.patch new file mode 100644 index 000000000..50916c5d2 --- /dev/null +++ b/packages/softether-vpn/src-Mayaqua-Mayaqua.c.orig.patch @@ -0,0 +1,25 @@ +--- a/src/Mayaqua/Mayaqua.c ++++ b/src/Mayaqua/Mayaqua.c +@@ -620,11 +620,11 @@ + UINT64 now = SystemTime64(); + IO *o; + +- MakeDir("/tmp"); ++ MakeDir("@TERMUX_PREFIX@/tmp"); + + Format(tmp2, sizeof(tmp2), "%I64u", now); + +- Format(tmp, sizeof(tmp), "/tmp/.%s", tmp2); ++ Format(tmp, sizeof(tmp), "@TERMUX_PREFIX@/tmp/.%s", tmp2); + + o = FileCreate(tmp); + if (o == NULL) +@@ -632,7 +632,7 @@ + o = FileOpen(tmp, false); + if (o == NULL) + { +- Print("Unable to use /tmp.\n\n"); ++ Print("Unable to use @TERMUX_PREFIX@/tmp.\n\n"); + exit(0); + } + } diff --git a/packages/softether-vpn/src-Mayaqua-Network.c.orig.patch b/packages/softether-vpn/src-Mayaqua-Network.c.orig.patch new file mode 100644 index 000000000..a90cacc32 --- /dev/null +++ b/packages/softether-vpn/src-Mayaqua-Network.c.orig.patch @@ -0,0 +1,29 @@ +--- a/src/Mayaqua/Network.c ++++ b/src/Mayaqua/Network.c +@@ -8024,7 +8024,7 @@ + + GetLocalHostIP4(ip); + +- b = ReadDump("/etc/resolv.conf"); ++ b = ReadDump("@TERMUX_PREFIX@/etc/resolv.conf"); + if (b != NULL) + { + char *s; +@@ -9980,7 +9980,7 @@ + bool UnixGetDomainName(char *name, UINT size) + { + bool ret = false; +- BUF *b = ReadDump("/etc/resolv.conf"); ++ BUF *b = ReadDump("@TERMUX_PREFIX@/etc/resolv.conf"); + + if (b == NULL) + { +@@ -14907,7 +14907,7 @@ + return false; + } + +- b = ReadDump("/etc/hosts"); ++ b = ReadDump("@TERMUX_PREFIX@/etc/hosts"); + if (b == NULL) + { + return false; diff --git a/packages/softether-vpn/src-Mayaqua-Unix.c.orig.patch b/packages/softether-vpn/src-Mayaqua-Unix.c.orig.patch new file mode 100644 index 000000000..b716b8a89 --- /dev/null +++ b/packages/softether-vpn/src-Mayaqua-Unix.c.orig.patch @@ -0,0 +1,25 @@ +--- a/src/Mayaqua/Unix.c ++++ b/src/Mayaqua/Unix.c +@@ -298,7 +298,7 @@ + char *vm_str_list = "Hypervisor detected,VMware Virtual Platform,VMware Virtual USB,qemu,xen,paravirtualized,virtual hd,virtualhd,virtual pc,virtualpc,kvm,oracle vm,oraclevm,parallels,xvm,bochs"; + + #ifdef UNIX_LINUX +- t = UnixExec("/bin/dmesg"); ++ t = UnixExec("@TERMUX_PREFIX@/bin/dmesg"); + + if (t != NULL) + { +@@ -363,11 +363,11 @@ + // Mac OS X + if (b) + { +- UnixExecSilent("/usr/sbin/sysctl -w net.inet.ipsec.esp_port=4500"); ++ UnixExecSilent("@TERMUX_PREFIX@/bin/sysctl -w net.inet.ipsec.esp_port=4500"); + } + else + { +- UnixExecSilent("/usr/sbin/sysctl -w net.inet.ipsec.esp_port=4501"); ++ UnixExecSilent("@TERMUX_PREFIX@/bin/sysctl -w net.inet.ipsec.esp_port=4501"); + } + } + }