Skip to content

Commit

Permalink
Merge branch 'xmake-io:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
24bit-xjkp authored Aug 27, 2024
2 parents 14da28c + 8dd37a6 commit b395edb
Show file tree
Hide file tree
Showing 49 changed files with 1,262 additions and 263 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/cosmocc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Cosmocc (x86_64)

on:
pull_request:
push:
release:
types: [published]

jobs:
build:

strategy:
matrix:
os: [macos-12]
arch: [x86_64]

runs-on: ${{ matrix.os }}

concurrency:
group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-Cosmocc-${{ matrix.arch }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Prepare local xmake
run: cp -rf . ../xmake-source
- uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: local#../xmake-source

- name: Installation
run: |
brew install dmd
brew install dub
- name: Build
run: |
cd core
xmake f --embed=y -y -cvD
xmake -v
cd ..
- name: Tests
run: |
ls -l core/build/
core/build/xmake --version
core/build/xmake lua -v -D tests/run.lua
- uses: actions/upload-artifact@v2
with:
name: xmake
path: core/build/xmake
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

## master (unreleased)

### New features

* [#5462](https://github.com/xmake-io/xmake/pull/5462): Add `xmake l cli.bisect`
* [#5488](https://github.com/xmake-io/xmake/pull/5488): Support for using cosmocc to build xmake binary
* [#5491](https://github.com/xmake-io/xmake/pull/5491): Provide single xmake binary with embeded lua files

### Changes

* [#5507](https://github.com/xmake-io/xmake/issues/5507): Use treeless to improve git.clone

### Bugs fixed

* [#4750](https://github.com/xmake-io/xmake/issues/4750): Fix compile_commands generator for `xmake tests`
* [#5465](https://github.com/xmake-io/xmake/pull/5465): Fix lock package requires

## v2.9.4

### New features
Expand Down Expand Up @@ -1854,6 +1869,21 @@

## master (开发中)

### 新特性

* [#5462](https://github.com/xmake-io/xmake/pull/5462): 添加 `xmake l cli.bisect`
* [#5488](https://github.com/xmake-io/xmake/pull/5488): 支持使用 cosmocc 去构建 xmake 自身二进制
* [#5491](https://github.com/xmake-io/xmake/pull/5491): 支持提供内嵌 lua 文件的单个 xmake 二进制文件

### 改进

* [#5507](https://github.com/xmake-io/xmake/issues/5507): 改进 git clone 下载速度

### Bugs 修复

* [#4750](https://github.com/xmake-io/xmake/issues/4750): 修复 compile_commands 生成器,支持 `xmake tests`
* [#5465](https://github.com/xmake-io/xmake/pull/5465): 修复 package requires lock

## v2.9.4

### 新特性
Expand Down
62 changes: 61 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,9 @@ _os_tryrm() {
}

# get temporary file
# https://github.com/xmake-io/xmake/issues/5464
_os_tmpfile() {
_ret=$(mktemp)
_ret=$(mktemp "${TMPDIR-/tmp}/tmp.XXXXXXXX")
}

# try run program
Expand Down Expand Up @@ -421,11 +422,17 @@ path_toolname() {
emcc) toolname="emcc";;
*/em++) toolname="emxx";;
em++) toolname="emxx";;
*/cosmocc) toolname="cosmocc";;
cosmocc) toolname="cosmocc";;
*/cosmoc++) toolname="cosmocxx";;
cosmoc++) toolname="cosmocxx";;
*-ar) toolname="ar";;
*/ar) toolname="ar";;
ar) toolname="ar";;
*/emar) toolname="emar";;
emar) toolname="emar";;
*/cosmoar) toolname="cosmoar";;
cosmoar) toolname="cosmoar";;
cc) toolname="gcc";;
*/cc) toolname="gcc";;
c++) toolname="gxx";;
Expand Down Expand Up @@ -647,6 +654,8 @@ elif string_contains "${os_arch}" "armv7"; then
os_arch="armv7"
elif string_contains "${os_arch}" "arm"; then
os_arch="arm"
elif string_contains "${os_arch}" "power macintosh"; then
os_arch="ppc"
fi

# set the default target platform
Expand Down Expand Up @@ -982,6 +991,8 @@ _get_abstract_flags() {
clangxx) _get_abstract_flag_for_gcc_clang "${toolkind}" "${toolname}" "${itemname}" "${value}"; flag="${_ret}";;
emcc) _get_abstract_flag_for_gcc_clang "${toolkind}" "${toolname}" "${itemname}" "${value}"; flag="${_ret}";;
emxx) _get_abstract_flag_for_gcc_clang "${toolkind}" "${toolname}" "${itemname}" "${value}"; flag="${_ret}";;
cosmocc) _get_abstract_flag_for_gcc_clang "${toolkind}" "${toolname}" "${itemname}" "${value}"; flag="${_ret}";;
cosmocxx) _get_abstract_flag_for_gcc_clang "${toolkind}" "${toolname}" "${itemname}" "${value}"; flag="${_ret}";;
*) raise "unknown toolname(${toolname})!" ;;
esac
if test_nz "${flag}"; then
Expand Down Expand Up @@ -1699,8 +1710,11 @@ _get_target_toolchain_flags() {
clangxx) _get_target_toolchain_flags_for_clang "${name}" "${toolkind}"; flags="${_ret}";;
emcc) _get_target_toolchain_flags_for_clang "${name}" "${toolkind}"; flags="${_ret}";;
emxx) _get_target_toolchain_flags_for_clang "${name}" "${toolkind}"; flags="${_ret}";;
cosmocc) _get_target_toolchain_flags_for_gcc "${name}" "${toolkind}"; flags="${_ret}";;
cosmocxx) _get_target_toolchain_flags_for_gcc "${name}" "${toolkind}"; flags="${_ret}";;
ar) _get_target_toolchain_flags_for_ar "${name}" "${toolkind}"; flags="${_ret}";;
emar) _get_target_toolchain_flags_for_ar "${name}" "${toolkind}"; flags="${_ret}";;
cosmoar) _get_target_toolchain_flags_for_ar "${name}" "${toolkind}"; flags="${_ret}";;
*) raise "unknown toolname(${toolname})!" ;;
esac
_ret="${flags}"
Expand Down Expand Up @@ -2716,6 +2730,7 @@ Common options:
- mingw
- macosx
- linux
- wasm
--arch=ARCH Compile for the given architecture. (default: '"${_target_arch_default}"')
- msys: i386 x86_64
- cross: i386 x86_64 arm arm64 mips mips64 riscv riscv64 loong64 s390x ppc ppc64 sh4
Expand All @@ -2733,6 +2748,8 @@ Common options:
--toolchain=TOOLCHAIN Set toolchain name.
- clang
- gcc
- emcc
- cosmocc
--buildir=DIR Set build directory. (default: '"${xmake_sh_buildir}"')
Autoconf options:
Expand Down Expand Up @@ -3024,6 +3041,18 @@ toolchain "emcc"
set_toolset "ar" "emar" "ar"
toolchain_end

# cosmocc toolchain, e.g. ./configure --plat=linux --toolchain=cosmocc
toolchain "cosmocc"
set_toolset "as" "cosmocc"
set_toolset "cc" "cosmocc"
set_toolset "cxx" "cosmocc" "cosmoc++"
set_toolset "mm" "cosmocc"
set_toolset "mxx" "cosmocc" "cosmoc++"
set_toolset "ld" "cosmoc++" "cosmocc"
set_toolset "sh" "cosmoc++" "cosmocc"
set_toolset "ar" "cosmoar"
toolchain_end

# check platform
_check_platform() {
if test "x${_target_plat}" = "x"; then
Expand Down Expand Up @@ -3090,6 +3119,8 @@ _toolchain_compcmd() {
clangxx) _toolchain_compcmd_for_gcc_clang "${program}" "${objectfile}" "${sourcefile}" "${flags}"; compcmd="${_ret}";;
emcc) _toolchain_compcmd_for_gcc_clang "${program}" "${objectfile}" "${sourcefile}" "${flags}"; compcmd="${_ret}";;
emxx) _toolchain_compcmd_for_gcc_clang "${program}" "${objectfile}" "${sourcefile}" "${flags}"; compcmd="${_ret}";;
cosmocc) _toolchain_compcmd_for_gcc_clang "${program}" "${objectfile}" "${sourcefile}" "${flags}"; compcmd="${_ret}";;
cosmocxx) _toolchain_compcmd_for_gcc_clang "${program}" "${objectfile}" "${sourcefile}" "${flags}"; compcmd="${_ret}";;
*) raise "unknown toolname(${toolname})!" ;;
esac
_ret="${compcmd}"
Expand All @@ -3110,8 +3141,11 @@ _toolchain_linkcmd() {
clangxx) _toolchain_linkcmd_for_gcc_clang "${toolkind}" "${program}" "${binaryfile}" "${objectfiles}" "${flags}"; linkcmd="${_ret}";;
emcc) _toolchain_linkcmd_for_gcc_clang "${toolkind}" "${program}" "${binaryfile}" "${objectfiles}" "${flags}"; linkcmd="${_ret}";;
emxx) _toolchain_linkcmd_for_gcc_clang "${toolkind}" "${program}" "${binaryfile}" "${objectfiles}" "${flags}"; linkcmd="${_ret}";;
cosmocc) _toolchain_linkcmd_for_gcc_clang "${toolkind}" "${program}" "${binaryfile}" "${objectfiles}" "${flags}"; linkcmd="${_ret}";;
cosmocxx) _toolchain_linkcmd_for_gcc_clang "${toolkind}" "${program}" "${binaryfile}" "${objectfiles}" "${flags}"; linkcmd="${_ret}";;
ar) _toolchain_linkcmd_for_ar "${toolkind}" "${program}" "${binaryfile}" "${objectfiles}" "${flags}"; linkcmd="${_ret}";;
emar) _toolchain_linkcmd_for_ar "${toolkind}" "${program}" "${binaryfile}" "${objectfiles}" "${flags}"; linkcmd="${_ret}";;
cosmoar) _toolchain_linkcmd_for_ar "${toolkind}" "${program}" "${binaryfile}" "${objectfiles}" "${flags}"; linkcmd="${_ret}";;
*) raise "unknown toolname(${toolname})!" ;;
esac
_ret="${linkcmd}"
Expand Down Expand Up @@ -3234,6 +3268,24 @@ _toolchain_try_ar() {
return 1
}

# try cosmoar
_toolchain_try_cosmoar() {
if test "x${_toolchain_try_cosmoar_result}" = "xok"; then
return 0
elif test "x${_toolchain_try_cosmoar_result}" = "xno"; then
return 1
fi

local kind="${1}"
local program="${2}"
if _os_runv "${program}" "--version"; then
_toolchain_try_cosmoar_result="ok"
return 0
fi
_toolchain_try_cosmoar_result="no"
return 1
}

# try program
_toolchain_try_program() {
local toolchain="${1}"
Expand All @@ -3248,8 +3300,11 @@ _toolchain_try_program() {
clangxx) _toolchain_try_clangxx "${kind}" "${program}" && ok=true;;
emcc) _toolchain_try_clang "${kind}" "${program}" && ok=true;;
emxx) _toolchain_try_clangxx "${kind}" "${program}" && ok=true;;
cosmocc) _toolchain_try_gcc "${kind}" "${program}" && ok=true;;
cosmocxx) _toolchain_try_gxx "${kind}" "${program}" && ok=true;;
ar) _toolchain_try_ar "${kind}" "${program}" && ok=true;;
emar) _toolchain_try_ar "${kind}" "${program}" && ok=true;;
cosmoar) _toolchain_try_cosmoar "${kind}" "${program}" && ok=true;;
*) raise "unknown toolname(${toolname})!" ;;
esac
if ${ok}; then
Expand Down Expand Up @@ -3979,6 +4034,8 @@ _gmake_add_build_object() {
clangxx) _gmake_add_build_object_for_gcc_clang "${sourcekind}" "${sourcefile}" "${objectfile}" "${flagname}";;
emcc) _gmake_add_build_object_for_gcc_clang "${sourcekind}" "${sourcefile}" "${objectfile}" "${flagname}";;
emxx) _gmake_add_build_object_for_gcc_clang "${sourcekind}" "${sourcefile}" "${objectfile}" "${flagname}";;
cosmocc) _gmake_add_build_object_for_gcc_clang "${sourcekind}" "${sourcefile}" "${objectfile}" "${flagname}";;
cosmocxx) _gmake_add_build_object_for_gcc_clang "${sourcekind}" "${sourcefile}" "${objectfile}" "${flagname}";;
*) raise "unknown toolname(${toolname})!" ;;
esac
echo "" >> "${xmake_sh_makefile}"
Expand Down Expand Up @@ -4059,8 +4116,11 @@ _gmake_add_build_target() {
clangxx) _gmake_add_build_target_for_gcc_clang "${toolkind}" "${targetfile}" "${objectfiles}" "${flagname}";;
emcc) _gmake_add_build_target_for_gcc_clang "${toolkind}" "${targetfile}" "${objectfiles}" "${flagname}";;
emxx) _gmake_add_build_target_for_gcc_clang "${toolkind}" "${targetfile}" "${objectfiles}" "${flagname}";;
cosmocc) _gmake_add_build_target_for_gcc_clang "${toolkind}" "${targetfile}" "${objectfiles}" "${flagname}";;
cosmocxx) _gmake_add_build_target_for_gcc_clang "${toolkind}" "${targetfile}" "${objectfiles}" "${flagname}";;
ar) _gmake_add_build_target_for_ar "${toolkind}" "${targetfile}" "${objectfiles}" "${flagname}";;
emar) _gmake_add_build_target_for_ar "${toolkind}" "${targetfile}" "${objectfiles}" "${flagname}";;
cosmoar) _gmake_add_build_target_for_ar "${toolkind}" "${targetfile}" "${objectfiles}" "${flagname}";;
*) raise "unknown toolname(${toolname})!" ;;
esac

Expand Down
21 changes: 17 additions & 4 deletions core/src/tbox/inc/linux/tbox.config.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,13 @@
#define TB_CONFIG_POSIX_HAVE_FDATASYNC 1
/* #undef TB_CONFIG_POSIX_HAVE_COPYFILE */
#define TB_CONFIG_POSIX_HAVE_SENDFILE 1
#define TB_CONFIG_POSIX_HAVE_EPOLL_CREATE 1
#define TB_CONFIG_POSIX_HAVE_EPOLL_WAIT 1
#ifdef __COSMOPOLITAN__
/* #undef TB_CONFIG_POSIX_HAVE_EPOLL_CREATE */
/* #undef TB_CONFIG_POSIX_HAVE_EPOLL_WAIT */
#else
# define TB_CONFIG_POSIX_HAVE_EPOLL_CREATE 1
# define TB_CONFIG_POSIX_HAVE_EPOLL_WAIT 1
#endif
#if defined(__ANDROID__)
/* #undef TB_CONFIG_POSIX_HAVE_POSIX_SPAWNP */
#else
Expand All @@ -196,7 +201,11 @@
#define TB_CONFIG_POSIX_HAVE_FCNTL 1
#define TB_CONFIG_POSIX_HAVE_PIPE 1
/* #undef TB_CONFIG_POSIX_HAVE_PIPE2 */
#define TB_CONFIG_POSIX_HAVE_MKFIFO 1
#ifdef __COSMOPOLITAN__
/* #undef TB_CONFIG_POSIX_HAVE_MKFIFO */
#else
# define TB_CONFIG_POSIX_HAVE_MKFIFO 1
#endif
#define TB_CONFIG_POSIX_HAVE_FUTIMENS 1
#define TB_CONFIG_POSIX_HAVE_UTIMENSAT 1

Expand All @@ -211,6 +220,10 @@
/* #undef TB_CONFIG_SYSTEMV_HAVE_VALGRIND_STACK_REGISTER */

// linux functions
#define TB_CONFIG_LINUX_HAVE_INOTIFY_INIT 1
#ifdef __COSMOPOLITAN__
/* #undef TB_CONFIG_LINUX_HAVE_INOTIFY_INIT */
#else
# define TB_CONFIG_LINUX_HAVE_INOTIFY_INIT 1
#endif

#endif
Loading

0 comments on commit b395edb

Please sign in to comment.