Skip to content

Commit

Permalink
Merge pull request #12 from mneumann/support-dragonfly
Browse files Browse the repository at this point in the history
Cross-compile libsavi_runtime.bc for DragonFly
  • Loading branch information
jemc authored Sep 30, 2022
2 parents 3deefea + b7f5682 commit ef1f6ce
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,33 @@ build_task:
freebsd_instance:
image: freebsd-13-1-release-amd64

- name: x86_64-unknown-dragonfly
environment:
TRIPLE: x86_64-unknown-dragonfly
DEPS_INSTALL_PRE: "pkg update \
&& pkg install -y cmake gmake libunwind git llvm14 \
&& ln -s /usr/local/bin/llvm-link14 /usr/local/bin/llvm-link"
DEPS_INSTALL: " \
curl -L --fail http://www.ravenports.com/repository/dragonfly:6.2:x86:64/All/ravensys-root-single-dragonfly-3.2_6.tzst \
| tar --strip-components=5 -xvzf - \
&& sh -c 'cd DragonFly/usr/lib/gcc80 && ln -s libgcc_pic.a libgcc.a' \
&& mkdir -p DragonFly/usr/include \
&& curl -L --fail https://raw.githubusercontent.com/DragonFlyBSD/DragonFlyBSD/DragonFly_RELEASE_6_2/lib/libexecinfo/execinfo.h \
> DragonFly/usr/include/execinfo.h \
&& patch /usr/include/sys/stdatomic.h \
platform-patches/dragonfly-stdatomic.patch \
-o DragonFly/usr/include/stdatomic.h \
"
CFLAGS: ${DEBUGINFO_CFLAGS} -IDragonFly/usr/include
EXTRA_CMAKE_FLAGS: >
-DCMAKE_C_COMPILER_TARGET=x86_64-unknown-dragonfly
-DCMAKE_SYSTEM_NAME=DragonFly
-DCMAKE_SYSTEM_PROCESSOR=x86_64
-DCMAKE_C_COMPILER_WORKS=true
-DCMAKE_CXX_COMPILER_WORKS=true
freebsd_instance:
image: freebsd-13-1-release-amd64

- name: x86_64-apple-macosx
environment:
TRIPLE: x86_64-apple-macosx
Expand Down Expand Up @@ -181,6 +208,7 @@ bundle_task:
- x86_64-unknown-linux-musl
- arm64-unknown-linux-musl
- x86_64-unknown-freebsd
- x86_64-unknown-dragonfly
- x86_64-apple-macosx
- arm64-apple-macosx
- x86_64-unknown-windows-msvc
Expand Down
25 changes: 25 additions & 0 deletions platform-patches/dragonfly-stdatomic.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--- stdatomic.h 2022-09-29 20:56:00.477454696 -0700
+++ stdatomic.h 2022-09-29 15:57:30.770539373 -0700
@@ -33,7 +33,11 @@
#define _STDATOMIC_H_

#include <sys/cdefs.h>
+#if defined(__FreeBSD__)
#include <sys/_types.h>
+#elif defined(__DragonFly__)
+#include <sys/types.h>
+#endif

#if __has_extension(c_atomic) || __has_extension(cxx_atomic)
#define __CLANG_ATOMICS
@@ -195,8 +199,10 @@
typedef _Atomic(unsigned long) atomic_ulong;
typedef _Atomic(long long) atomic_llong;
typedef _Atomic(unsigned long long) atomic_ullong;
+#if !defined(__DragonFly__)
typedef _Atomic(__char16_t) atomic_char16_t;
typedef _Atomic(__char32_t) atomic_char32_t;
+#endif
typedef _Atomic(___wchar_t) atomic_wchar_t;
typedef _Atomic(__int_least8_t) atomic_int_least8_t;
typedef _Atomic(__uint_least8_t) atomic_uint_least8_t;

0 comments on commit ef1f6ce

Please sign in to comment.