Add Cygwin compatibility
This commit is contained in:
parent
9c2614c2fa
commit
56738d8b4b
6 changed files with 46 additions and 8 deletions
36
.github/workflows/ci.yml
vendored
36
.github/workflows/ci.yml
vendored
|
@ -350,3 +350,39 @@ jobs:
|
||||||
emmake make -C build qjs_wasm -j$(getconf _NPROCESSORS_ONLN)
|
emmake make -C build qjs_wasm -j$(getconf _NPROCESSORS_ONLN)
|
||||||
- name: result
|
- name: result
|
||||||
run: ls -lh build
|
run: ls -lh build
|
||||||
|
|
||||||
|
cygwin:
|
||||||
|
runs-on: windows-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
|
||||||
|
steps:
|
||||||
|
- name: Set up Cygwin
|
||||||
|
uses: cygwin/cygwin-install-action@master
|
||||||
|
with:
|
||||||
|
packages: make cmake gcc-g++ bash
|
||||||
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
|
||||||
|
# Plain `make` fails here with this error:
|
||||||
|
# No rule to make target '/cygdrive/d/a/quickjs-ng/quickjs-ng/cutils.c',
|
||||||
|
# needed by 'CMakeFiles/qjs.dir/cutils.c.o'. Stop.
|
||||||
|
#
|
||||||
|
# For some reason, making the build directory then `make`ing in there
|
||||||
|
# fixes it.
|
||||||
|
run: |
|
||||||
|
cd $GITHUB_WORKSPACE
|
||||||
|
make build/CMakeCache.txt
|
||||||
|
make --directory build
|
||||||
|
|
||||||
|
- name: stats
|
||||||
|
run: |
|
||||||
|
cd $GITHUB_WORKSPACE
|
||||||
|
make --debug stats
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
run: |
|
||||||
|
cd $GITHUB_WORKSPACE
|
||||||
|
make --debug test
|
||||||
|
|
4
qjs.c
4
qjs.c
|
@ -36,7 +36,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <malloc/malloc.h>
|
#include <malloc/malloc.h>
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__) || defined(__CYGWIN__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ static const JSMallocFunctions trace_mf = {
|
||||||
(size_t (*)(const void *))_msize,
|
(size_t (*)(const void *))_msize,
|
||||||
#elif defined(EMSCRIPTEN)
|
#elif defined(EMSCRIPTEN)
|
||||||
NULL,
|
NULL,
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__) || defined(__CYGWIN__)
|
||||||
(size_t (*)(const void *))malloc_usable_size,
|
(size_t (*)(const void *))malloc_usable_size,
|
||||||
#else
|
#else
|
||||||
/* change this to `NULL,` if compilation fails */
|
/* change this to `NULL,` if compilation fails */
|
||||||
|
|
|
@ -3582,6 +3582,8 @@ void js_std_set_worker_new_context_func(JSContext *(*func)(JSRuntime *rt))
|
||||||
#define OS_PLATFORM "darwin"
|
#define OS_PLATFORM "darwin"
|
||||||
#elif defined(EMSCRIPTEN)
|
#elif defined(EMSCRIPTEN)
|
||||||
#define OS_PLATFORM "js"
|
#define OS_PLATFORM "js"
|
||||||
|
#elif defined(__CYGWIN__)
|
||||||
|
#define OS_PLATFORM "cygwin"
|
||||||
#else
|
#else
|
||||||
#define OS_PLATFORM "linux"
|
#define OS_PLATFORM "linux"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <malloc/malloc.h>
|
#include <malloc/malloc.h>
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__) || defined(__CYGWIN__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
#include <malloc_np.h>
|
#include <malloc_np.h>
|
||||||
|
@ -1722,7 +1722,7 @@ static const JSMallocFunctions def_malloc_funcs = {
|
||||||
(size_t (*)(const void *))_msize,
|
(size_t (*)(const void *))_msize,
|
||||||
#elif defined(EMSCRIPTEN)
|
#elif defined(EMSCRIPTEN)
|
||||||
NULL,
|
NULL,
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__) || defined (__CYGWIN__)
|
||||||
(size_t (*)(const void *))malloc_usable_size,
|
(size_t (*)(const void *))malloc_usable_size,
|
||||||
#else
|
#else
|
||||||
/* change this to `NULL,` if compilation fails */
|
/* change this to `NULL,` if compilation fails */
|
||||||
|
|
|
@ -1668,7 +1668,7 @@ int run_test(const char *filename, int index)
|
||||||
/* XXX: should extract the phase */
|
/* XXX: should extract the phase */
|
||||||
char *q = find_tag(p, "type:", &state);
|
char *q = find_tag(p, "type:", &state);
|
||||||
if (q) {
|
if (q) {
|
||||||
while (isspace(*q))
|
while (isspace((unsigned char)*q))
|
||||||
q++;
|
q++;
|
||||||
error_type = strdup_len(q, strcspn(q, " \n"));
|
error_type = strdup_len(q, strcspn(q, " \n"));
|
||||||
}
|
}
|
||||||
|
@ -2089,7 +2089,7 @@ int main(int argc, char **argv)
|
||||||
update_exclude_dirs();
|
update_exclude_dirs();
|
||||||
|
|
||||||
if (is_dir_list) {
|
if (is_dir_list) {
|
||||||
if (optind < argc && !isdigit(argv[optind][0])) {
|
if (optind < argc && !isdigit((unsigned char)argv[optind][0])) {
|
||||||
filename = argv[optind++];
|
filename = argv[optind++];
|
||||||
namelist_load(&test_list, filename);
|
namelist_load(&test_list, filename);
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,8 +345,8 @@ function test_number()
|
||||||
assert(Number.isNaN(Number("-")));
|
assert(Number.isNaN(Number("-")));
|
||||||
assert(Number.isNaN(Number("\x00a")));
|
assert(Number.isNaN(Number("\x00a")));
|
||||||
|
|
||||||
// TODO: Fix rounding errors on Windows.
|
// TODO: Fix rounding errors on Windows/Cygwin.
|
||||||
if (os.platform === 'win32') {
|
if (['win32', 'cygwin'].includes(os.platform)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue