Skip to content

Commit d4bb59c

Browse files
authored
Merge pull request #41 from semarie/openbsd
FEAT: OpenBSD support
2 parents 06425a7 + 6286bd3 commit d4bb59c

File tree

4 files changed

+100
-8
lines changed

4 files changed

+100
-8
lines changed

make/pre-make.r3

+2
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ os: any [
156156
Macintosh: macos
157157
Windows: windows
158158
Linux: linux
159+
OpenBSD: openbsd
159160
) platform
160161
]
161162
sys: any [
@@ -167,6 +168,7 @@ sys: any [
167168
ios: darwin
168169
windows: win32
169170
linux: linux
171+
openbsd: openbsd
170172
) os
171173
]
172174
abi: any [

make/rebol3.nest

+94-5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ target-linux: [
3939
vendor: pc
4040
compiler: gcc
4141
]
42+
target-openbsd: [
43+
os: openbsd
44+
sys: openbsd
45+
vendor: unknown
46+
compiler: clang
47+
]
4248

4349
core-files: [
4450
%core/a-constants.c
@@ -380,6 +386,12 @@ include-image-codecs: [
380386
#if MacOS? [
381387
:include-image-os-codec
382388
]
389+
#if OpenBSD? [
390+
:include-native-bmp-codec
391+
:include-native-png-codec
392+
:include-native-jpg-codec
393+
:include-native-gif-codec
394+
]
383395
:include-native-qoi-codec
384396
mezz-lib-files: %mezz/codec-image-ext.reb ; png/size? function and similar
385397
]
@@ -417,12 +429,25 @@ include-midi: [
417429
#if Linux? [
418430
; there is no support yet
419431
]
432+
#if OpenBSD? [
433+
; there is no support yet
434+
]
420435
]
421436

422437
;- native utilities:
423438
include-bincode: [core-files: %core/u-bincode.c]
424439
include-dialecting: [core-files: %core/u-dialect.c config: INCLUDE_DELECT]
425-
include-iconv: [core-files: %core/u-iconv.c #if macOS? [library: %iconv]]
440+
include-iconv: [
441+
core-files: %core/u-iconv.c
442+
#if macOS? [
443+
library: %iconv
444+
]
445+
#if OpenBSD? [
446+
library: %iconv
447+
cflags: "-I/usr/local/include"
448+
lflag: "-L/usr/local/lib"
449+
]
450+
]
426451

427452
;- native cryptography:
428453
include-cryptography: [
@@ -662,6 +687,10 @@ common: [
662687
library: %m
663688
defines: ENDIAN_LITTLE
664689
]
690+
#if OpenBSD? [
691+
library: %m
692+
defines: ENDIAN_LITTLE
693+
]
665694
]
666695

667696
common-host: [
@@ -677,6 +706,9 @@ common-host: [
677706
; flag: -fvisibility=hidden
678707
flag: -fPIC ; position independent (used for libs)
679708
]
709+
#if OpenBSD? [
710+
flag: -fPIC ; position independent (used for libs)
711+
]
680712
]
681713

682714
arch-x64: [
@@ -696,6 +728,9 @@ arch-x64: [
696728
defines: TO_OSX_X64
697729
defines: __LP64__ ; same like LLP64, but long (integer) has 64 bits instead of 32
698730
]
731+
#if OpenBSD? [
732+
defines: TO_OPENBSD
733+
]
699734
]
700735
arch-x86: [
701736
arch: x86
@@ -707,6 +742,9 @@ arch-x86: [
707742
resource-options: "--target=pe-i386"
708743
defines: TO_WIN32
709744
]
745+
#if OpenBSD? [
746+
defines: TO_OPENBSD
747+
]
710748
]
711749
arch-arm64: [
712750
:arch-x64
@@ -932,21 +970,72 @@ eggs: [
932970
:make-x64-host
933971
]
934972
]
973+
#if OpenBSD? [
974+
"Rebol/Base openbsd-x64" [
975+
name: %rebol3-base-openbsd-x64
976+
:target-openbsd
977+
:make-x64-exe
978+
]
979+
"Rebol/Core openbsd-x64" [
980+
name: %rebol3-core-openbsd-x64
981+
:target-openbsd
982+
:include-rebol-core
983+
:make-x64-exe
984+
]
985+
"Rebol/Bulk openbsd-x64" [
986+
name: %rebol3-bulk-openbsd-x64
987+
:target-openbsd
988+
:include-rebol-bulk
989+
:make-x64-exe
990+
]
991+
992+
"Rebol/Core openbsd-x64 shared library" [
993+
name: %lib-rebol3-core-openbsd-x64
994+
:target-openbsd
995+
:include-rebol-core
996+
:make-x64-dll
997+
]
998+
"Rebol/Core openbsd-x64 host application" [
999+
name: %host-core-openbsd-x64
1000+
shared: %lib-rebol3-core-openbsd-x64
1001+
:target-openbsd
1002+
:include-rebol-core
1003+
:make-x64-host
1004+
]
1005+
]
9351006
"Test extension 32bit" [
9361007
name: %test-x86.rebx
9371008
files: only %tests/extension/test.c
9381009
:arch-x86
9391010
compiler: gcc
9401011
flags: [-O2 shared]
941-
#if Linux? [ flag: -fPIC ]
942-
#either macOS? [:target-macos][compiler: gcc]
1012+
#if Linux? [
1013+
flag: -fPIC
1014+
compiler: gcc
1015+
]
1016+
#if MacOS? [
1017+
:target-macos
1018+
]
1019+
#if OpenBSD? [
1020+
flag: -fPIC
1021+
:target-openbsd
1022+
]
9431023
]
9441024
"Test extension 64bit" [
9451025
name: %test-x64.rebx
9461026
files: only %tests/extension/test.c
9471027
:arch-x64
9481028
flags: [-O2 shared]
949-
#if Linux? [ flag: -fPIC ]
950-
#either macOS? [:target-macos][compiler: gcc]
1029+
#if Linux? [
1030+
flag: -fPIC
1031+
compiler: gcc
1032+
]
1033+
#if MacOS? [
1034+
:target-macos
1035+
]
1036+
#if OpenBSD? [
1037+
flag: -fPIC
1038+
:target-openbsd
1039+
]
9511040
]
9521041
]

src/core/u-rsa.c

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343

4444
#if defined(TO_OSX_X64) || defined(TO_OSXI) || defined(TO_OSX)
4545
#include <sys/malloc.h>
46+
#elif defined(TO_OPENBSD)
47+
/* malloc(3) is inside stdlib.h */
4648
#else
4749
#include <malloc.h>
4850
#endif

src/include/reb-config.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,9 @@ These are now obsolete (as of A107) and should be removed:
210210
#define USE_SETENV
211211
#endif
212212

213-
#ifdef TO_OBSD // OpenBSD
213+
#ifdef TO_OPENBSD // OpenBSD
214214
#undef INCLUDE_MIDI_DEVICE // Not implemented!
215-
#define COPY_STR(d,s,m) strlcpy(d,s,m)
216-
#define JOIN_STR(d,s,m) strlcat(d,s,m)
215+
#define USE_SETENV
217216
#endif
218217

219218
#ifdef TO_AMIGA // Target for OS4

0 commit comments

Comments
 (0)