File tree Expand file tree Collapse file tree 5 files changed +30
-23
lines changed Expand file tree Collapse file tree 5 files changed +30
-23
lines changed Original file line number Diff line number Diff line change @@ -386,3 +386,18 @@ jobs:
386386 run : |
387387 cd $GITHUB_WORKSPACE
388388 make --debug test
389+
390+ openbsd :
391+ runs-on : ubuntu-latest
392+ steps :
393+ - uses : actions/checkout@v3
394+ - name : build + test
395+ uses : vmactions/openbsd-vm@v1
396+ with :
397+ usesh : true
398+ prepare : |
399+ pkg_add cmake
400+ run : |
401+ cmake -B build
402+ cmake --build build -j $(sysctl -n hw.ncpu)
403+ ./build/qjs -qd
Original file line number Diff line number Diff line change @@ -145,10 +145,7 @@ if(BUILD_QJS_LIBC)
145145 list (APPEND qjs_sources quickjs-libc.c)
146146endif ()
147147list (APPEND qjs_defines _GNU_SOURCE)
148- list (APPEND qjs_libs qjs)
149- if (NOT WIN32 )
150- list (APPEND qjs_libs dl)
151- endif ()
148+ list (APPEND qjs_libs qjs ${CMAKE_DL_LIBS} )
152149if (NOT MSVC )
153150 list (APPEND qjs_libs m pthread)
154151endif ()
Original file line number Diff line number Diff line change @@ -135,13 +135,10 @@ static inline size_t js_trace_malloc_usable_size(void *ptr)
135135 return malloc_size (ptr );
136136#elif defined(_WIN32 )
137137 return _msize (ptr );
138- #elif defined(EMSCRIPTEN )
139- return 0 ;
140138#elif defined(__linux__ )
141139 return malloc_usable_size (ptr );
142140#else
143- /* change this to `return 0;` if compilation fails */
144- return malloc_usable_size (ptr );
141+ return 0 ;
145142#endif
146143}
147144
@@ -257,13 +254,10 @@ static const JSMallocFunctions trace_mf = {
257254 malloc_size ,
258255#elif defined(_WIN32 )
259256 (size_t (* )(const void * ))_msize ,
260- #elif defined(EMSCRIPTEN )
261- NULL ,
262257#elif defined(__linux__ ) || defined (__CYGWIN__ )
263258 (size_t (* )(const void * ))malloc_usable_size ,
264259#else
265- /* change this to `NULL,` if compilation fails */
266- malloc_usable_size ,
260+ NULL ,
267261#endif
268262};
269263
Original file line number Diff line number Diff line change @@ -73,12 +73,15 @@ typedef sig_t sighandler_t;
7373#endif
7474#endif /* __APPLE__ */
7575
76+ #if defined(__OpenBSD__ )
77+ typedef sig_t sighandler_t ;
78+ extern char * * environ ;
7679#endif
7780
78- #if !defined(_WIN32 )
7981/* enable the os.Worker API. IT relies on POSIX threads */
8082#define USE_WORKER
81- #endif
83+
84+ #endif /* _WIN32 */
8285
8386#ifdef USE_WORKER
8487#include <pthread.h>
@@ -3584,8 +3587,12 @@ void js_std_set_worker_new_context_func(JSContext *(*func)(JSRuntime *rt))
35843587#define OS_PLATFORM "js"
35853588#elif defined(__CYGWIN__ )
35863589#define OS_PLATFORM "cygwin"
3587- #else
3590+ #elif defined( __linux__ )
35883591#define OS_PLATFORM "linux"
3592+ #elif defined(__OpenBSD__ )
3593+ #define OS_PLATFORM "openbsd"
3594+ #else
3595+ #define OS_PLATFORM "unknown"
35893596#endif
35903597
35913598#define OS_FLAG (x ) JS_PROP_INT32_DEF(#x, x, JS_PROP_CONFIGURABLE )
Original file line number Diff line number Diff line change @@ -1646,13 +1646,10 @@ static inline size_t js_def_malloc_usable_size(void *ptr)
16461646 return malloc_size(ptr);
16471647#elif defined(_WIN32)
16481648 return _msize(ptr);
1649- #elif defined(EMSCRIPTEN)
1650- return 0;
16511649#elif defined(__linux__)
16521650 return malloc_usable_size(ptr);
16531651#else
1654- /* change this to `return 0;` if compilation fails */
1655- return malloc_usable_size(ptr);
1652+ return 0;
16561653#endif
16571654}
16581655
@@ -1720,13 +1717,10 @@ static const JSMallocFunctions def_malloc_funcs = {
17201717 malloc_size,
17211718#elif defined(_WIN32)
17221719 (size_t (*)(const void *))_msize,
1723- #elif defined(EMSCRIPTEN)
1724- NULL,
17251720#elif defined(__linux__) || defined (__CYGWIN__)
17261721 (size_t (*)(const void *))malloc_usable_size,
17271722#else
1728- /* change this to `NULL,` if compilation fails */
1729- malloc_usable_size,
1723+ NULL,
17301724#endif
17311725};
17321726
You can’t perform that action at this time.
0 commit comments