mirror of https://github.com/oxen-io/lokinet
Merge pull request #1847 from majestrate/mip64-cross-2022-01-30
update cross compiling infra
This commit is contained in:
commit
d66364ab7c
|
@ -234,6 +234,7 @@ add_static_target(zlib zlib_external libz.a)
|
|||
|
||||
|
||||
set(openssl_system_env "")
|
||||
set(openssl_configure_command ./config)
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
if(ARCH_TRIPLET STREQUAL x86_64-w64-mingw32)
|
||||
set(openssl_system_env SYSTEM=MINGW64 RC=${CMAKE_RC_COMPILER} AR=${ARCH_TRIPLET}-ar RANLIB=${ARCH_TRIPLET}-ranlib)
|
||||
|
@ -242,13 +243,25 @@ if(CMAKE_CROSSCOMPILING)
|
|||
elseif(ANDROID)
|
||||
set(openssl_system_env SYSTEM=Linux MACHINE=${android_machine} LD=${deps_ld} RANLIB=${deps_ranlib} AR=${deps_ar})
|
||||
set(openssl_extra_opts no-asm)
|
||||
elseif(ARCH_TRIPLET STREQUAL mips64-linux-gnuabi64)
|
||||
set(openssl_system_env SYSTEM=Linux MACHINE=mips64)
|
||||
set(openssl_configure_command ./Configure linux64-mips64)
|
||||
elseif(ARCH_TRIPLET STREQUAL mips-linux-gnu)
|
||||
set(openssl_system_env SYSTEM=Linux MACHINE=mips)
|
||||
elseif(ARCH_TRIPLET STREQUAL mipsel-linux-gnu)
|
||||
set(openssl_system_env SYSTEM=Linux MACHINE=mipsel)
|
||||
elseif(ARCH_TRIPLET STREQUAL aarch64-linux-gnu)
|
||||
# cross compile arm64
|
||||
set(openssl_system_env SYSTEM=Linux MACHINE=aarch64)
|
||||
endif()
|
||||
elseif(CMAKE_C_FLAGS MATCHES "-march=armv7")
|
||||
# Help openssl figure out that we're building from armv7 even if on armv8 hardware:
|
||||
set(openssl_system_env SYSTEM=Linux MACHINE=armv7)
|
||||
endif()
|
||||
|
||||
|
||||
build_external(openssl
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env CC=${deps_cc} ${openssl_system_env} ./config
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env CC=${deps_cc} ${openssl_system_env} ${openssl_configure_command}
|
||||
--prefix=${DEPS_DESTDIR} ${openssl_extra_opts} no-shared no-capieng no-dso no-dtls1 no-ec_nistp_64_gcc_128 no-gost
|
||||
no-heartbeats no-md2 no-rc5 no-rdrand no-rfc3779 no-sctp no-ssl-trace no-ssl2 no-ssl3
|
||||
no-static-engine no-tests no-weak-ssl-ciphers no-zlib no-zlib-dynamic "CFLAGS=${deps_CFLAGS}"
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# helper script for me for when i cross compile
|
||||
# t. jeff
|
||||
#
|
||||
die() {
|
||||
echo $@
|
||||
exit 1
|
||||
}
|
||||
|
||||
root="$(readlink -e $(dirname $0)/../)"
|
||||
cd $root
|
||||
set -e
|
||||
set -x
|
||||
test $# = 0 && die no targets provided
|
||||
mkdir -p build-cross
|
||||
echo "all: $@" > build-cross/Makefile
|
||||
for targ in $@ ; do
|
||||
mkdir -p $root/build-cross/build-$targ
|
||||
cd $root/build-cross/build-$targ
|
||||
cmake \
|
||||
-G 'Unix Makefiles' \
|
||||
-DCMAKE_EXE_LINKER_FLAGS=-fstack-protector \
|
||||
-DCMAKE_CXX_FLAGS=-fdiagnostics-color=always\
|
||||
-DCMAKE_TOOLCHAIN_FILE=$root/contrib/cross/$targ.toolchain.cmake\
|
||||
-DBUILD_STATIC_DEPS=ON \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DBUILD_LIBLOKINET=OFF \
|
||||
-DWITH_TESTS=OFF \
|
||||
-DNATIVE_BUILD=OFF \
|
||||
-DSTATIC_LINK=ON \
|
||||
-DWITH_SYSTEMD=OFF \
|
||||
-DFORCE_OXENMQ_SUBMODULE=ON \
|
||||
-DSUBMODULE_CHECK=OFF \
|
||||
-DWITH_LTO=OFF \
|
||||
-DWITH_BOOTSTRAP=OFF \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
$root
|
||||
cd $root/build-cross
|
||||
echo -ne "$targ:\n\t\$(MAKE) -C build-$targ\n" >> $root/build-cross/Makefile
|
||||
|
||||
done
|
||||
cd $root
|
||||
make -j${JOBS:-$(nproc)} -C build-cross
|
|
@ -1,6 +1,6 @@
|
|||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(TOOLCHAIN_PREFIX aarch64-linux-gnu)
|
||||
#set(TOOLCHAIN_SUFFIX)
|
||||
set(TOOLCHAIN_SUFFIX)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
|
||||
|
@ -10,3 +10,4 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|||
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc${TOOLCHAIN_SUFFIX})
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++${TOOLCHAIN_SUFFIX})
|
||||
set(ARCH_TRIPLET ${TOOLCHAIN_PREFIX})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(TOOLCHAIN_PREFIX arm-linux-gnueabihf)
|
||||
set(TOOLCHAIN_SUFFIX -8)
|
||||
set(TOOLCHAIN_SUFFIX)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(TOOLCHAIN_PREFIX mips-linux-gnu)
|
||||
set(TOOLCHAIN_SUFFIX)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc${TOOLCHAIN_SUFFIX})
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++${TOOLCHAIN_SUFFIX})
|
||||
set(ARCH_TRIPLET ${TOOLCHAIN_PREFIX})
|
|
@ -0,0 +1,13 @@
|
|||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(TOOLCHAIN_PREFIX mips64-linux-gnuabi64)
|
||||
set(TOOLCHAIN_SUFFIX)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc${TOOLCHAIN_SUFFIX})
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++${TOOLCHAIN_SUFFIX})
|
||||
set(ARCH_TRIPLET ${TOOLCHAIN_PREFIX})
|
|
@ -0,0 +1,13 @@
|
|||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(TOOLCHAIN_PREFIX mipsel-linux-gnu)
|
||||
set(TOOLCHAIN_SUFFIX)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc${TOOLCHAIN_SUFFIX})
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++${TOOLCHAIN_SUFFIX})
|
||||
set(ARCH_TRIPLET ${TOOLCHAIN_PREFIX})
|
|
@ -1,6 +1,6 @@
|
|||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(TOOLCHAIN_PREFIX powerpc64le-linux-gnu)
|
||||
set(TOOLCHAIN_SUFFIX -8)
|
||||
set(TOOLCHAIN_SUFFIX)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
|
||||
|
|
25
readme.md
25
readme.md
|
@ -59,9 +59,28 @@ If you want to build from source:
|
|||
$ make -j$(nproc)
|
||||
$ sudo make install
|
||||
|
||||
#### Cross Compile
|
||||
|
||||
supported cross targets:
|
||||
|
||||
* aarch64
|
||||
* armhf
|
||||
* mips
|
||||
* mips64
|
||||
* mipsel
|
||||
* ppc64le
|
||||
|
||||
install the toolchain for `$arch` this example is `aarch64`
|
||||
|
||||
$ sudo apt install g{cc,++}-aarch64-linux-gnu
|
||||
|
||||
build 1 or many cross targets:
|
||||
|
||||
$ ./contrib/cross.sh arch_1 arch_2 ... arch_n
|
||||
|
||||
### macOS
|
||||
|
||||
Lokinet ~~is~~ will be available on the Apple App store.
|
||||
Lokinet ~~is~~ will be available on the Apple App store.
|
||||
|
||||
Source code compilation of Lokinet by end users is not supported or permitted by apple on their platforms, see [this](contrib/macos/README.txt) for more information. If you find this disagreeable consider using a platform that permits compiling from source.
|
||||
|
||||
|
@ -112,11 +131,11 @@ lokinet`, etc.
|
|||
|
||||
### Running on Linux (without debs)
|
||||
|
||||
**DO NOT RUN AS ROOT**, run as normal user.
|
||||
**DO NOT RUN AS ROOT**, run as normal user.
|
||||
|
||||
set up the initial configs:
|
||||
|
||||
$ lokinet -g
|
||||
$ lokinet -g
|
||||
$ lokinet-bootstrap
|
||||
|
||||
after you create default config, run it:
|
||||
|
|
Loading…
Reference in New Issue