Skip to content

Commit

Permalink
more updates to accommodate mingw64-gcc 14.1 with jq using setenv (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidaty authored Jul 30, 2024
1 parent badf65a commit 9f54b5c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
6 changes: 4 additions & 2 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ ifeq ($(WIN),0)
endif
endif
CONFIGURE_HOST=
CFLAGS_SETENV=
else
BUILD_SUBDIR=win/${DBG_SUBDIR}
EXE=.exe
CFLAGS+= -D__USE_MINGW_ANSI_STDIO -D_ISOC99_SOURCE
CFLAGS+= -Wl,--strip-all
CONFIGURE_HOST=--host=x86_64-w64-mingw32
CFLAGS_SETENV=-Dsetenv\(a,b,c\)=_putenv_s\(a,b\)
endif

CFLAGS+=-std=gnu11
Expand Down Expand Up @@ -386,7 +388,7 @@ lib-jq: ${JQ_LIB}

${JQ_BUNDLE_LIB}: ${JQ_SRC} # -D_REENTRANT needed for clang to not break
cd ${JQ_SRC} \
&& CC="${CC}" CFLAGS="${CFLAGS} -D_REENTRANT" ./configure \
&& CC="${CC}" CFLAGS="${CFLAGS} -D_REENTRANT ${CFLAGS_SETENV}" ./configure \
--prefix="${JQ_PREFIX}" \
--disable-maintainer-mode \
--without-oniguruma \
Expand All @@ -395,7 +397,7 @@ ${JQ_BUNDLE_LIB}: ${JQ_SRC} # -D_REENTRANT needed for clang to not break
--disable-shared \
--enable-static \
${CONFIGURE_HOST} \
&& (${MAKE} install -k || echo)
&& (${MAKE} install -k)

${JSONWRITER_OBJECT}: ${JSONWRITER_SRC}/jsonwriter.c
@mkdir -p `dirname "$@"`
Expand Down
10 changes: 0 additions & 10 deletions app/utils/dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@

#include <zsv/utils/dl.h>

#ifdef _WIN32

#include <windows.h>
#define RTLD_LAZY 0
void *dlsym(void* handle, const char* symbol) {
return (void *)GetProcAddress((HINSTANCE)(handle), (symbol));
}
#endif


void (*zsv_dlsym(void *restrict handle, const char *restrict name))(void) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
Expand Down
5 changes: 5 additions & 0 deletions app/utils/win/dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
#include <windows.h>
#include <zsv/utils/os.h>

#define RTLD_LAZY 0
void *dlsym(void* handle, const char* symbol) {
return (void *)GetProcAddress((HINSTANCE)(handle), (symbol));
}

void *dlopen(const char *dll_name, int flags) {
(void)flags;
wchar_t wbuf[PATH_MAX];
Expand Down

0 comments on commit 9f54b5c

Please sign in to comment.