summaryrefslogtreecommitdiff
path: root/core/src/cli/xmake.sh
diff options
context:
space:
mode:
authorruki <[email protected]>2024-09-24 23:22:20 +0800
committerruki <[email protected]>2024-09-24 23:22:20 +0800
commitc2294cfacd63067dbe3ec1f9cd43f4d85808219c (patch)
tree95d9bf5d048df8c261b0917ff43e3bb4f3c9842b /core/src/cli/xmake.sh
parent583f8e6944130e157ec85b8a975a76733b3eb775 (diff)
rename demo to cli
Diffstat (limited to 'core/src/cli/xmake.sh')
-rwxr-xr-xcore/src/cli/xmake.sh75
1 files changed, 75 insertions, 0 deletions
diff --git a/core/src/cli/xmake.sh b/core/src/cli/xmake.sh
new file mode 100755
index 000000000..531a6e86a
--- /dev/null
+++ b/core/src/cli/xmake.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+target "cli"
+ add_deps "xmake"
+ set_kind "binary"
+ set_basename "xmake"
+ set_targetdir "${buildir}"
+
+ # add definitions
+ add_defines "__tb_prefix__=\"xmake\""
+
+ # add includes directory
+ add_includedirs "${projectdir}/core" "${projectdir}/core/src"
+
+ # add the common source files
+ add_files "**.c"
+
+ # add links
+ if is_plat "macosx" && is_config "runtime" "luajit"; then
+ add_ldflags "-all_load" "-pagezero_size 10000" "-image_base 100000000"
+ elif is_plat "mingw"; then
+ add_ldflags "-static-libgcc"
+ fi
+
+ # add install files
+ add_installfiles "${projectdir}/(xmake/**.lua)" "share"
+ add_installfiles "${projectdir}/(xmake/scripts/*)" "share"
+ add_installfiles "${projectdir}/(xmake/scripts/cmake_importfiles/**)" "share"
+ add_installfiles "${projectdir}/(xmake/scripts/completions/**)" "share"
+ add_installfiles "${projectdir}/(xmake/scripts/xpack/**)" "share"
+ add_installfiles "${projectdir}/(xmake/scripts/xrepo/**)" "share"
+ add_installfiles "${projectdir}/(xmake/scripts/virtualenvs/**)" "share"
+ add_installfiles "${projectdir}/(xmake/scripts/pac/**)" "share"
+ add_installfiles "${projectdir}/(xmake/scripts/conan/**)" "share"
+ add_installfiles "${projectdir}/(xmake/scripts/module/**)" "share"
+ add_installfiles "${projectdir}/(xmake/templates/**)" "share"
+ add_installfiles "${projectdir}/scripts/xrepo.sh" "bin" "xrepo"
+
+ # fix os.exec() call incorrect program from /mingw64/bin. e.g. python, ..
+ #
+ # because xmake is installed to /mingw64/bin/xmake,
+ # os.exec/CreateProcess always gives the highest priority to finding the process from /mingw64/bin (if it exists),
+ # rather than from the $PATH environment variable.
+ #
+ # we install the xmake executable into a separate directory to ensure
+ # that os.exec() does not look for additional executables.
+ #
+ # @see https://github.com/xmake-io/xmake/issues/3628
+ if is_host "msys"; then
+ after_install "xmake_after_install"
+ fi
+
+ # add syslinks
+ add_options "atomic"
+ if is_plat "mingw" "msys" "cygwin"; then
+ add_syslinks "ws2_32" "pthread" "m"
+ elif is_plat "bsd"; then
+ add_syslinks "pthread" "m"
+ elif is_plat "haiku"; then
+ add_syslinks "pthread" "network" "m"
+ elif test_nz "${TERMUX_ARCH}"; then
+ add_syslinks "m" "dl"
+ else
+ add_syslinks "pthread" "dl" "m" "c"
+ fi
+
+xmake_after_install() {
+ local target=${1}
+ local installdir=${2}
+ if test_eq "${project_generator}" "gmake"; then
+ print "\t@if test -f ${installdir}/bin/xmake.exe; then rm ${installdir}/bin/xmake.exe; fi" >> "${xmake_sh_makefile}"
+ print "\t@cp ${projectdir}/scripts/msys/xmake.sh ${installdir}/bin/xmake" >> "${xmake_sh_makefile}"
+ print "\t@cp ${buildir}/xmake.exe ${installdir}/share/xmake" >> "${xmake_sh_makefile}"
+ fi
+}