diff options
| author | ruki <[email protected]> | 2023-11-22 23:34:12 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-22 23:34:12 +0800 |
| commit | 0babd67de3c23dbdf8402b9ad8fa98edc825ab71 (patch) | |
| tree | cea5f12337dbe2cb35caccb66088fc9978a98a06 | |
| parent | 0415ab4d9b7ba347aed638422a7b40885da2943e (diff) | |
improve to install xmake for msys/mingw
| -rwxr-xr-x | configure | 30 | ||||
| -rwxr-xr-x | core/src/demo/xmake.sh | 9 |
2 files changed, 38 insertions, 1 deletions
@@ -2531,6 +2531,24 @@ add_options() { done } +# before_install in target +before_install() { + if ! ${_loading_targets}; then + return + fi + local funcname="${1}" + _add_target_item "${_xmake_sh_target_current}" "before_install" "${funcname}" +} + +# after_install in target +after_install() { + if ! ${_loading_targets}; then + return + fi + local funcname="${1}" + _add_target_item "${_xmake_sh_target_current}" "after_install" "${funcname}" +} + #----------------------------------------------------------------------------- # toolchain configuration apis # @@ -4190,6 +4208,12 @@ _gmake_add_install_target() { installdir="\$(INSTALLDIR)" fi + # before install + _get_target_item "${target}" "before_install"; local before_install="${_ret}" + if test_nz "${before_install}"; then + eval ${before_install} "\${target}" "\${installdir}" + fi + # @see https://github.com/tboox/tbox/issues/214 install_for_soname=false if test_eq "${targetkind}" "shared"; then @@ -4287,6 +4311,12 @@ _gmake_add_install_target() { print "\t@cp -p ${srcinstallfile} ${dstinstallfile}" >> "${xmake_sh_makefile}" done fi + + # after install + _get_target_item "${target}" "after_install"; local after_install="${_ret}" + if test_nz "${after_install}"; then + eval ${after_install} "\${target}" "\${installdir}" + fi } _gmake_add_install_targets() { diff --git a/core/src/demo/xmake.sh b/core/src/demo/xmake.sh index d91b50d99..d50c6cbf3 100755 --- a/core/src/demo/xmake.sh +++ b/core/src/demo/xmake.sh @@ -39,8 +39,8 @@ target "demo" # # @see https://github.com/xmake-io/xmake/issues/3628 if is_host "msys"; then + after_install "xmake_after_install" add_installfiles "${projectdir}/scripts/msys/xmake.sh" "bin" "xmake" - add_installfiles "${buildir}/xmake.exe" "share/xmake" fi # add syslinks @@ -56,3 +56,10 @@ target "demo" else add_syslinks "pthread" "dl" "m" "c" fi + +xmake_after_install() { + local target=${1} + local installdir=${2} + print "\t@if test -f ${installdir}/bin/xmake.exe; then rm ${installdir}/bin/xmake.exe; fi" >> "${xmake_sh_makefile}" + print "\t@cp ${buildir}/xmake.exe ${installdir}/share/xmake" >> "${xmake_sh_makefile}" +} |
