Skip to content
Draft
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .orchestra/config/components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#! Do not push upstream components defined here.
#! You should define them in a separate file and use overlay annotations.
min_orchestra_version: "3.1.0"
components: {}
add_to_path:
- $ORCHESTRA_ROOT/link-only/bin
Expand Down
46 changes: 40 additions & 6 deletions .orchestra/config/components/boost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#@yaml/text-templated-strings
---
#@ def boost():
#@ def boost(is_windows):
license: LICENSE_1_0.txt
configure: |
mkdir -p "$BUILD_DIR"
Expand All @@ -16,15 +16,48 @@ configure: |
install: |
cd "$BUILD_DIR"

(@- if is_windows: @)

echo "using clang : : x86_64-w64-mingw32-clang++ -pthread -stdlib=libc++ -D_WIN32_WINNT=0x6000 -D_LIBCPP_HAS_THREAD_API_WIN32 -fvisibility-inlines-hidden -fvisibility=hidden -fgnuc-version=4.8.0 : ;" > user-config.jam

./b2 \
--prefix="${DESTDIR}${ORCHESTRA_ROOT}" \
--ignore-site-config toolset='clang'
--user-config=user-config.jam \
--with-test \
--prefix="${DESTDIR}${ORCHESTRA_ROOT}/x86_64-w64-mingw32" \
--ignore-site-config \
address-model=64 \
architecture=x86 \
variant=release \
link=shared \
toolset=clang \
target-os=windows

./b2 \
--prefix="${DESTDIR}${ORCHESTRA_ROOT}" \
--ignore-site-config toolset='clang' \
--user-config=user-config.jam \
--with-test \
--prefix="${DESTDIR}${ORCHESTRA_ROOT}/x86_64-w64-mingw32" \
--ignore-site-config \
address-model=64 \
architecture=x86 \
variant=release \
link=shared \
toolset=clang \
target-os=windows \
install

(@- else: @)

./b2 \
--prefix="${DESTDIR}${ORCHESTRA_ROOT}" \
--ignore-site-config toolset='clang'

./b2 \
--prefix="${DESTDIR}${ORCHESTRA_ROOT}" \
--ignore-site-config toolset='clang' \
install

(@- end @)

build_dependencies:
- host-cxx-toolchain
- glibc
Expand All @@ -37,4 +70,5 @@ dependencies:
#@overlay/match-child-defaults missing_ok=True
---
components:
boost: #@ single_build_component(**boost())
boost: #@ single_build_component(**boost(False))
windows/boost: #@ single_build_component(**boost(True))
6 changes: 3 additions & 3 deletions .orchestra/config/components/clang_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

---
#@ def cmake_opts():
- -DLLVM_ENABLE_PROJECTS="clang;compiler-rt;libcxxabi;libcxx;clang-tools-extra"
- -DBUILD_SHARED_LIBS=OFF
- -DLLVM_ENABLE_ZLIB=OFF
-DLLVM_ENABLE_PROJECTS: "clang;compiler-rt;libcxxabi;libcxx;clang-tools-extra;lld"
-DBUILD_SHARED_LIBS: "OFF"
-DLLVM_ENABLE_ZLIB: "OFF"
#@ end

#@yaml/text-templated-strings
Expand Down
52 changes: 46 additions & 6 deletions .orchestra/config/components/glib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
#@ load("/lib/ninja.lib.yml", "ninja")

#@ source_url = "https://download.gnome.org/sources/glib/2.64/glib-2.64.5.tar.xz"
#@ proxy_libintl_url = "https://github.com/frida/proxy-libintl/archive/refs/tags/0.1.tar.gz"

#@yaml/text-templated-strings
---
#@ def glib_args():
#@ def glib_args(is_windows):
license: source/COPYING
configure: |
mkdir -p "$BUILD_DIR/source"
Expand All @@ -16,13 +17,51 @@ configure: |
sed -i 's|^.*HAVE_LANGINFO_.*1.*$||' "$BUILD_DIR/source/meson.build"
sed -i -e '/subdir.*tests/d' "$BUILD_DIR"/source/{.,gio,glib}/meson.build

CC=clang \
CXX=clang++ \
(@- if is_windows: @)

extract.sh --into "$BUILD_DIR/source/subprojects/proxy-libintl" (@= proxy_libintl_url @)

export CC=x86_64-w64-mingw32-clang
export CXX=x86_64-w64-mingw32-clang++

echo "
[binaries]
c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ranlib = 'x86_64-w64-mingw32-ranlib'
ar = 'x86_64-w64-mingw32-ar'
strip = 'x86_64-w64-mingw32-strip'
pkgconfig = 'x86_64-w64-mingw32-pkg-config'
windres = 'x86_64-w64-mingw32-windres'

[properties]
needs_exe_wrapper = true

[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
" > windows.meson

(@- else: @)

export CC=clang
export CXX=clang++

(@- end @)

meson setup \
--buildtype plain \
--libdir=lib \
(@- if is_windows: @)
--cross-file windows.meson \
--prefix "$ORCHESTRA_ROOT/x86_64-w64-mingw32" \
-Dlibelf=disabled \
(@- else: @)
--prefix "$ORCHESTRA_ROOT" \
(@- end @)
--wrap-mode nodownload \
--buildtype plain \
--libdir=lib \
-Ddefault_library=shared \
-Dselinux=disabled \
-Dxattr=false \
Expand Down Expand Up @@ -54,4 +93,5 @@ dependencies:
#@overlay/match-child-defaults missing_ok=True
---
components:
glib: #@ single_build_component(**glib_args())
glib: #@ single_build_component(**glib_args(False))
windows/glib: #@ single_build_component(**glib_args(True))
14 changes: 10 additions & 4 deletions .orchestra/config/components/libffi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@

#@yaml/text-templated-strings
---
#@ def libffi_args():
#@ def libffi_args(is_windows):
license: LICENSE
configure: |
mkdir -p "$BUILD_DIR"
extract.sh --into "$BUILD_DIR" (@= source_url @)

cd "$BUILD_DIR"
./configure \
(@- if is_windows: @)
--host=x86_64-w64-mingw32 \
--prefix="$ORCHESTRA_ROOT/x86_64-w64-mingw32" \
(@- else: @)
--prefix="$ORCHESTRA_ROOT" \
(@- end @)
--disable-multi-os-directory \
--disable-static \
--disable-pax_emutramp \
--disable-debug \
--prefix="$ORCHESTRA_ROOT"
--disable-debug
build_system: make
build_dependencies:
- host-c-toolchain
Expand All @@ -29,4 +34,5 @@ build_dependencies:
#@overlay/match-child-defaults missing_ok=True
---
components:
libffi: #@ single_build_component(**libffi_args())
libffi: #@ single_build_component(**libffi_args(False))
windows/libffi: #@ single_build_component(**libffi_args(True))
56 changes: 41 additions & 15 deletions .orchestra/config/components/llvm.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@
#@ load("@ytt:data", "data")
#@ load("@ytt:overlay", "overlay")
#@ load("/components/llvm_common.lib.yml", "configure_llvm")
#@ load("/lib/assert.lib.yml", "assert")
#@ load("/lib/optimization_flavors.lib.yml", "typical_project_flavors")
#@ load("/lib/fn_args.lib.yml", "mandatory")
#@ load("/lib/ninja.lib.yml", "ninja")

#@yaml/text-templated-strings
---
#@ def cmake_opts():
- -DBUILD_SHARED_LIBS=ON
- -DLLVM_ENABLE_PROJECTS="clang"
- -DCMAKE_C_COMPILER="(@= data.values.regular_c_compiler @)"
- -DCMAKE_CXX_COMPILER="(@= data.values.regular_cxx_compiler @)"
-DBUILD_SHARED_LIBS: "ON"
-DLLVM_ENABLE_PROJECTS: "clang"
#@ end

#@yaml/text-templated-strings
---
#@ def additional_windows_cmake_opts():
-DCMAKE_C_COMPILER: x86_64-w64-mingw32-clang
-DCMAKE_CXX_COMPILER: x86_64-w64-mingw32-clang++
-DCMAKE_CXX_FLAGS: "-pthread -stdlib=libc++ -D_WIN32_WINNT=0x6000 -D_LIBCPP_HAS_THREAD_API_WIN32 -fvisibility-inlines-hidden -fvisibility=hidden -fuse-ld=lld"
-DCMAKE_INSTALL_PREFIX: "$ORCHESTRA_ROOT/x86_64-w64-mingw32"
-DCMAKE_SKIP_RPATH: "ON"
-DCMAKE_SYSTEM_NAME: "Windows"
-DWIN32: "ON"
-DWIN32_TARGET_REVNG: "ON"
-DLLVM_DEFAULT_TARGET_TRIPLE: "x86_64-linux-gnu"
-DLLVM_ENABLE_Z3_SOLVER: "OFF"
-DLLVM_BUILD_EXAMPLES: "OFF"
-DLLVM_INCLUDE_EXAMPLES: "OFF"
-DLLVM_BUILD_TESTS: "OFF"
-DLLVM_INCLUDE_TESTS: "OFF"
-DLLVM_ENABLE_ZLIB: "OFF"
-DLLVM_ENABLE_TERMINFO: "OFF"
#@ end

#@yaml/text-templated-strings
---
#@ def llvm_component(use_asan=False):
#@ def llvm_component(platform=mandatory, use_asan=False):
#@ assert(platform in ["linux", "windows"])
#@ all_cmake_opts = dict(cmake_opts())

repository: llvm-project
license: llvm/LICENSE.TXT
default_build: optimized
Expand All @@ -26,25 +48,28 @@ builds:
#@ cflags = f_options["extra_compiler_flags"]
#@ ndebug = f_options["ndebug"]
(@= flavor @):
configure: #@ configure_llvm(cmake_build_type=build_type, cflags=cflags, additional_cmake_options=cmake_opts(), source_dir="$SOURCE_DIR")
#@ if platform == "windows":
#@ all_cmake_opts.update(dict(additional_windows_cmake_opts()))
#@ end
configure: |
(@= configure_llvm(cmake_build_type=build_type, cflags=cflags, additional_cmake_options=all_cmake_opts, source_dir="$SOURCE_DIR") @)
install: |
cd "$BUILD_DIR"
(@= ninja @) install

CLANG_RELEASE_IDX="$ORCHESTRA_ROOT/share/orchestra/clang-release.idx"
if [ -e "$CLANG_RELEASE_IDX" ]; then
cat "$CLANG_RELEASE_IDX" | while read f; do
rm "${TMP_ROOT}${ORCHESTRA_ROOT}/$f" || true
done
fi
remove-files-from-other-component.sh clang-release "${TMP_ROOT}${ORCHESTRA_ROOT}"

if test "$RUN_TESTS" -eq 1; then
(@= ninja @) check-all
fi

(@- if platform == "windows": @)
ln -s ../../x86_64-w64-mingw32/usr/bin/libwinpthread-1.dll "${TMP_ROOT}${ORCHESTRA_ROOT}/win64/bin/"
(@ end -@)
build_dependencies:
- cmake
- host-cxx-toolchain
#@ if/end platform == "windows":
- toolchain/win64/gcc
dependencies:
- host-libcxx
- libunwind
Expand All @@ -57,4 +82,5 @@ builds:
#@overlay/match-child-defaults missing_ok=True
---
components:
llvm: #@ llvm_component()
llvm: #@ llvm_component(platform="linux")
windows/llvm: #@ llvm_component(platform="windows")
43 changes: 27 additions & 16 deletions .orchestra/config/components/llvm_common.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,41 @@
#@ load("/lib/shell.lib.yml", "expand_args")
#@ load("/lib/cmake.lib.yml", "cmake")

---
#@ def _default_cmake_options(cmake_build_type, cflags):
-DCMAKE_BUILD_RPATH: "\\$ORIGIN/../lib:$ORCHESTRA_ROOT/lib"
-DCMAKE_INSTALL_RPATH: "$RPATH_PLACEHOLDER/lib"
-DCMAKE_BUILD_TYPE: #@ cmake_build_type
-DCMAKE_EXE_LINKER_FLAGS: #@ cflags
-DCMAKE_SHARED_LINKER_FLAGS: #@ cflags
-DCMAKE_MODULE_LINKER_FLAGS: #@ cflags
-DCMAKE_CXX_FLAGS: #@ cflags
-DLLVM_TARGETS_TO_BUILD: "AArch64;AMDGPU;ARM;Mips;SystemZ;X86"
-DLLVM_ENABLE_DUMP: "ON"
-DLLVM_ENABLE_TERMINFO: "OFF"
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT: "OFF"
-DLLVM_ENABLE_Z3_SOLVER: "OFF"
-DLLVM_INCLUDE_GO_TESTS: "OFF"
-DCMAKE_GENERATOR: "Ninja"
#@ end

---
#@ def default_cmake_options(*args):
#@ return dict(_default_cmake_options(*args))
#@ end


#@yaml/text-templated-strings
---
#@ def _configure_llvm(cmake_build_type=mandatory, cflags=mandatory, additional_cmake_options=mandatory, source_dir="$SOURCE_DIR"):
#@ cmake_opts = default_cmake_options(cmake_build_type, cflags)
#@ cmake_opts.update(additional_cmake_options)
- |
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR";
(@= cmake @) \
(@= cmake(additional_cmake_args=cmake_opts) @) \
"(@= source_dir @)/llvm" \
-GNinja \
-DCMAKE_BUILD_RPATH="\$ORIGIN/../lib:$ORCHESTRA_ROOT/lib" \
-DCMAKE_INSTALL_RPATH="$RPATH_PLACEHOLDER/lib" \
-DCMAKE_BUILD_TYPE="(@= cmake_build_type @)" \
-DCMAKE_EXE_LINKER_FLAGS="(@= cflags @)" \
-DCMAKE_SHARED_LINKER_FLAGS="(@= cflags @)" \
-DCMAKE_MODULE_LINKER_FLAGS="(@= cflags @)" \
-DCMAKE_CXX_FLAGS="(@= cflags @)" \
-DLLVM_TARGETS_TO_BUILD="AArch64;AMDGPU;ARM;Mips;SystemZ;X86" \
-DLLVM_ENABLE_DUMP=ON \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF \
-DCMAKE_CXX_STANDARD=20 \
Comment on lines +38 to 40
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why CMAKE_CXX_STANDARD is defined here and not by default_cmake_options or additional_cmake_options?

-DLLVM_ENABLE_Z3_SOLVER=OFF \
-DLLVM_INCLUDE_GO_TESTS=OFF \
(@= expand_args(additional_cmake_options) @) \
-Wno-dev
#@ end

Expand Down
Loading