SoftEtherVPN_Stable icon indicating copy to clipboard operation
SoftEtherVPN_Stable copied to clipboard

allow to redefine ar and ranlib

Open svlobanov opened this issue 3 years ago • 1 comments
trafficstars

Makefiles call 'ar r' and 'ranlib' command. It causes issues on cross-compilation (e.g. build on macos for linux target)

This patch allows to redifine ar and ranlib using AR and RANLIB Makefile variables

This patch is fully backward compatible. Default values for AR=ar and RANLIB=ranlib to reproduce current behaviour if these variables are not set.

Signed-off-by: Sergey V. Lobanov [email protected]

Additional comment: Looks like makefiles were deleted in dev/main tree but this (stable) tree is still actual so please accept this patch to stable tree to simplify cross-compile builds

svlobanov avatar Jan 14 '22 23:01 svlobanov

Maybe add a test line, how to cross-compile it under macOS now.

cross-compile example is in OpenWrt project, my version working on macos (build host=macos, target=linux): https://github.com/openwrt/packages/blob/bc8e3e3d7903b5160b2d3a42f80877a1e06e8c0f/net/softethervpn/Makefile

General idea is:

  1. make hamcore.se2 using host compiler (apple clang on macos) with src/makefiles/macos_XXX.mak Makefile
  2. shift timestamp for hamcore.se2 to protect it from rebuilding with target toolchain (otherwise, it will fail if target and build hosts are different)
  3. build everything else using target toolchain with src/makefiles/linux_XXX.mak

svlobanov avatar Jan 15 '22 11:01 svlobanov