Bring back the mingw32 builds ##windows
* Massage conflicting function signatures spotted by mingw * Fix the spp visibility issue * Enable 32 and 64bit mingw builds in the CI
This commit is contained in:
parent
bf7ecde2cd
commit
4327d8322f
|
@ -133,7 +133,6 @@ jobs:
|
|||
/tmp/bin/rabin2 -l /tmp/bin/r2
|
||||
build-spaces:
|
||||
name: linux-meson-spaces
|
||||
continue-on-error: true
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
|
|
@ -7,6 +7,34 @@ on:
|
|||
pull_request:
|
||||
|
||||
jobs:
|
||||
w32-mingw:
|
||||
name: w32-mingw
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Compiling
|
||||
run: |
|
||||
export PATH=${HOME}/.local/bin:${HOME}/Library/Python/3.9/bin:${PATH}
|
||||
sudo apt-get --assume-yes install python3-wheel gperf python3-setuptools cabextract gperf gcc-mingw-w64
|
||||
sys/mingw32.sh
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: radare2*.zip
|
||||
w64-mingw:
|
||||
name: w64-mingw
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Compiling
|
||||
run: |
|
||||
export PATH=${HOME}/.local/bin:${HOME}/Library/Python/3.9/bin:${PATH}
|
||||
sudo apt-get --assume-yes install python3-wheel gperf python3-setuptools cabextract gperf gcc-mingw-w64
|
||||
sys/mingw64.sh
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
path: radare2*.zip
|
||||
w64-make:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
|
|
|
@ -58,7 +58,7 @@ static ut64 baddr(RBinFile *bf) {
|
|||
}
|
||||
|
||||
// unreachable because check_buffer only supports the above architectures
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static RBinAddr *binsym(RBinFile *bf, int type) {
|
||||
|
|
|
@ -313,12 +313,10 @@ typedef int (*PrintfCallback)(const char *str, ...) R_PRINTF_CHECK(1, 2);
|
|||
#elif R_INLINE
|
||||
#define R_API inline
|
||||
#else
|
||||
#if __MINGW32__
|
||||
#if __WINDOWS__
|
||||
#define R_API __declspec(dllexport)
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define R_API __attribute__((visibility("default")))
|
||||
#elif defined(_MSC_VER)
|
||||
#define R_API __declspec(dllexport)
|
||||
#else
|
||||
#define R_API
|
||||
#endif
|
||||
|
|
|
@ -19,13 +19,13 @@ extern "C" {
|
|||
R_API BOOL r_w32_ProcessIdToSessionId(DWORD a, DWORD *b);
|
||||
R_API BOOL r_w32_CancelSynchronousIo(HANDLE a);
|
||||
R_API DWORD r_w32_GetProcessImageFileName(HANDLE,LPSTR,DWORD);
|
||||
R_API DWORD r_w32_GetModuleBaseName(HANDLE, HMODULE, LPTSTR, DWORD);
|
||||
// R_API DWORD r_w32_GetModuleBaseName(HANDLE, HMODULE, LPSTR, DWORD);
|
||||
R_API BOOL r_w32_GetModuleInformation(HANDLE, HMODULE, LPMODULEINFO, DWORD);
|
||||
R_API BOOL r_w32_DebugBreakProcess(HANDLE);
|
||||
R_API DWORD r_w32_GetThreadId(HANDLE); // Vista
|
||||
R_API DWORD r_w32_GetProcessId(HANDLE); // XP
|
||||
R_API BOOL r_w32_QueryFullProcessImageName(HANDLE, DWORD, LPTSTR, PDWORD);
|
||||
R_API DWORD r_w32_GetMappedFileName(HANDLE, LPVOID, LPTSTR, DWORD);
|
||||
R_API BOOL r_w32_QueryFullProcessImageName(HANDLE, DWORD, LPSTR, PDWORD);
|
||||
R_API DWORD r_w32_GetMappedFileName(HANDLE, LPVOID, LPSTR, DWORD);
|
||||
R_API NTSTATUS r_w32_NtQuerySystemInformation(ULONG, PVOID, ULONG, PULONG);
|
||||
R_API NTSTATUS r_w32_NtQueryInformationThread(HANDLE, ULONG, PVOID, ULONG, PULONG);
|
||||
R_API NTSTATUS r_w32_NtDuplicateObject(HANDLE, HANDLE, HANDLE, PHANDLE, ACCESS_MASK, ULONG, ULONG);
|
||||
|
@ -35,7 +35,7 @@ R_API BOOL r_w32_InitializeContext(PVOID, DWORD, PCONTEXT*, PDWORD);
|
|||
R_API BOOL r_w32_GetXStateFeaturesMask(PCONTEXT Context, PDWORD64);
|
||||
R_API PVOID r_w32_LocateXStateFeature(PCONTEXT Context, DWORD, PDWORD);
|
||||
R_API BOOL r_w32_SetXStateFeaturesMask(PCONTEXT Context, DWORD64);
|
||||
R_API DWORD r_w32_GetModuleFileNameEx(HANDLE, HMODULE, LPTSTR, DWORD);
|
||||
R_API DWORD r_w32_GetModuleFileNameEx(HANDLE, HMODULE, LPSTR, DWORD);
|
||||
// thcond
|
||||
R_API FARPROC r_w32_InitializeConditionVariable(PCONDITION_VARIABLE a);
|
||||
R_API FARPROC r_w32_WakeConditionVariable(PCONDITION_VARIABLE a);
|
||||
|
|
|
@ -141,7 +141,7 @@ static int fork_and_ptraceme(RIO *io, int bits, const char *cmd) {
|
|||
wrap->params.func.user = &p;
|
||||
r_w32dw_waitret (wrap);
|
||||
if (!r_w32dw_ret (wrap)) {
|
||||
r_w32dw_err (wrap);
|
||||
(void)r_w32dw_err (wrap);
|
||||
r_sys_perror ("fork_and_ptraceme/CreateProcess");
|
||||
free (appname_);
|
||||
free (cmdline_);
|
||||
|
|
|
@ -5,5 +5,6 @@ OBJS=lang.o
|
|||
R2DEPS=r_util r_cons
|
||||
|
||||
include ../rules.mk
|
||||
LDFLAGS+=$(LIBR)/util/libr_util.$(EXT_SO)
|
||||
# include $(LIBR)/util/spp.mk
|
||||
CFLAGS+=-I$(SHLR)/spp
|
||||
# CFLAGS+=-I$(SHLR)/spp
|
||||
|
|
|
@ -64,11 +64,15 @@ R_API char *r_str_donut(int osize) {
|
|||
float f = sin (j);
|
||||
float g = cos (A);
|
||||
float h = d + 2;
|
||||
float D = 1 / (c* h*e+f*g+5),l=cos(i),m=cos(B),n=sin(B),t=c*h*g-f*e;
|
||||
float D = 1 / (c* h*e+f*g+5);
|
||||
float l = cos (i);
|
||||
float m = cos (B);
|
||||
float n = sin (B);
|
||||
float t = c*h*g-f*e;
|
||||
int x = (int)(Align+Width*D*(l*h*m-t*n));
|
||||
int y = (int)(12 + Height*D*(l*h*n +t*m));
|
||||
int o = x + 80 * y;
|
||||
int N = 8*((f*e-c*d*g)*m-c*d*e-f*g-l*d*n);
|
||||
int N = (int)(8 * ((f*e-c*d*g)*m-c*d*e-f*g-l*d*n));
|
||||
if (22 > y && y > 0 && x > 0 && 80 > x && D > z[o]) {
|
||||
z[o] = D;
|
||||
b[o] = " .,-:!/|S$@&"[N > 0? N: 0];
|
||||
|
|
|
@ -220,11 +220,7 @@ R_API int r_sys_truncate(const char *file, int sz) {
|
|||
if (fd == -1) {
|
||||
return false;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
int r = _chsize (fd, sz);
|
||||
#else
|
||||
int r = ftruncate (fd, sz);
|
||||
#endif
|
||||
if (r != 0) {
|
||||
eprintf ("Could not resize '%s' file\n", file);
|
||||
close (fd);
|
||||
|
@ -1243,7 +1239,7 @@ R_API char *r_sys_whoami(void) {
|
|||
char buf[32];
|
||||
#if __WINDOWS__
|
||||
DWORD buf_sz = sizeof (buf);
|
||||
if (!GetUserName (buf, (LPDWORD)&buf_sz) ) {
|
||||
if (!GetUserName ((LPWSTR)buf, (LPDWORD)&buf_sz) ) {
|
||||
return strdup ("?");
|
||||
}
|
||||
#elif __wasi__
|
||||
|
@ -1265,7 +1261,7 @@ R_API int r_sys_uid(void) {
|
|||
char buf[32];
|
||||
DWORD buf_sz = sizeof (buf);
|
||||
// TODO
|
||||
if (!GetUserName (buf, (LPDWORD)&buf_sz) ) {
|
||||
if (!GetUserName ((LPWSTR)buf, (LPDWORD)&buf_sz) ) {
|
||||
return 1; //
|
||||
}
|
||||
return 0;
|
||||
|
@ -1282,7 +1278,7 @@ R_API int r_sys_getpid(void) {
|
|||
#elif __UNIX__
|
||||
return getpid ();
|
||||
#elif __WINDOWS__
|
||||
return GetCurrentProcessId();
|
||||
return (int)GetCurrentProcessId ();
|
||||
#else
|
||||
#pragma message ("r_sys_getpid not implemented for this platform")
|
||||
return -1;
|
||||
|
|
|
@ -199,7 +199,7 @@ R_API BOOL r_w32_CancelSynchronousIo(HANDLE a) {
|
|||
return x? x (a): 0;
|
||||
}
|
||||
|
||||
R_API BOOL r_w32_QueryFullProcessImageName(HANDLE h, DWORD p, LPTSTR s, PDWORD l) {
|
||||
R_API BOOL r_w32_QueryFullProcessImageName(HANDLE h, DWORD p, LPSTR s, PDWORD l) {
|
||||
static DWORD (WINAPI *x)(HANDLE, DWORD, LPTSTR, PDWORD) = NULL;
|
||||
if (!x) {
|
||||
HANDLE lib = w32_loadlib ("kernel32", "kernel32.dll");
|
||||
|
|
|
@ -7,6 +7,7 @@ ONELIB=0
|
|||
OSTYPE=windows
|
||||
LINK=
|
||||
AR=${CROSS}ar
|
||||
EXT_AR=lib
|
||||
CC_AR=${AR} -r ${LIBAR}
|
||||
PARTIALLD=${CROSS}ld -r --whole-archive
|
||||
PICFLAGS=
|
||||
|
|
|
@ -10,7 +10,7 @@ AR=${CROSS}ar
|
|||
CC_AR=${AR} -r ${LIBAR}
|
||||
PARTIALLD=${CROSS}ld -r --whole-archive
|
||||
PICFLAGS=
|
||||
EXT_AR=a
|
||||
EXT_AR=lib
|
||||
EXT_SO=dll
|
||||
CFLAGS+=${PICFLAGS} -MD -D__WINDOWS__=1
|
||||
CC_LIB=${CC} -shared -o
|
||||
|
|
|
@ -83,7 +83,7 @@ all:
|
|||
exit 1
|
||||
endif
|
||||
|
||||
preall: libwinkd capstone-build bochs
|
||||
preall: libwinkd capstone-build bochs sdbs
|
||||
@for MOD in ${MODS} ; do \
|
||||
echo $(MAKE) -C $$MOD ; \
|
||||
$(MAKE) -C $$MOD HAVE_VALA= ROOT="${PWD}/../" CC="${CC}" ; \
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
NAME=r_java
|
||||
ifeq ($(CC),cccl)
|
||||
EXT_AR=lib
|
||||
else
|
||||
EXT_AR=a
|
||||
endif
|
||||
LIBAR?=libr_java.$(EXT_AR)
|
||||
|
||||
include ../../config-user.mk
|
||||
include ../../mk/${COMPILER}.mk
|
||||
include ../../libr/config.mk
|
||||
include ../../global.mk
|
||||
include ../../mk/platform.mk
|
||||
|
@ -14,6 +9,8 @@ _INCLUDE_MK_GCC_=
|
|||
include ../../mk/${COMPILER}.mk
|
||||
SHLR?=..
|
||||
include ../zip/deps.mk
|
||||
LIBAR=libr_java.$(EXT_AR)
|
||||
CC_AR=$(AR) -r $(LIBAR)
|
||||
|
||||
OSTYPE?=$(shell uname | tr 'A-Z' 'a-z')
|
||||
ifeq (${OSTYPE},)
|
||||
|
@ -34,11 +31,11 @@ OBJS=code.o class.o ops.o dsojson.o
|
|||
|
||||
include ../../shlr/sdb.mk
|
||||
|
||||
all: libr_java.$(EXT_AR)
|
||||
all: $(LIBAR)
|
||||
|
||||
RANLIB?=ranlib
|
||||
|
||||
libr_java.$(EXT_AR): ${OBJS}
|
||||
$(LIBAR): ${OBJS}
|
||||
rm -f libr_java.$(EXT_AR)
|
||||
${CC_AR} ${OBJS}
|
||||
${RANLIB} libr_java.$(EXT_AR)
|
||||
|
@ -49,4 +46,4 @@ out: ${OBJS} main.o
|
|||
-lr_util ../sdb/src/libsdb.$(EXT_AR) ${LINK} -o out
|
||||
|
||||
clean:
|
||||
rm -f ${OBJS} main.o a.out libr_java.$(EXT_AR) out
|
||||
rm -f ${OBJS} main.o a.out $(LIBAR) out
|
||||
|
|
|
@ -15,7 +15,7 @@ endif
|
|||
|
||||
CFLAGS?=-Wall -O2
|
||||
|
||||
CFLAGS+=-fvisibility=hidden
|
||||
#CFLAGS+=-fvisibility=hidden
|
||||
CFLAGS+=-DUSE_R2=$(SPP_USE_R2)
|
||||
CFLAGS+=-DHAVE_FORK=$(SPP_HAVE_FORK)
|
||||
CFLAGS+=-DVERSION=$(VERSION)
|
||||
|
@ -31,11 +31,9 @@ ${BIN}: config.h ${OBJ}
|
|||
r2lib: config.h
|
||||
${CC} -DUSE_R2=1 -c ${CFLAGS} ${LDFLAGS} -o spp.o spp.c
|
||||
|
||||
BINS=acr cpp pod sh
|
||||
symlinks:
|
||||
ln -s ${BIN} acr
|
||||
ln -s ${BIN} cpp
|
||||
ln -s ${BIN} pod
|
||||
ln -s ${BIN} sh
|
||||
for a in $(BINS); do ln -s ${BIN} $$a ; done
|
||||
|
||||
test:
|
||||
@for a in t/*spp* ; do \
|
||||
|
|
|
@ -7,6 +7,19 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if __WIN32__
|
||||
#undef HAVE_SYSTEM
|
||||
#define HAVE_SYSTEM 0
|
||||
#undef __WINDOWS__
|
||||
#define __WINDOWS__ 1
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#undef HAVE_SYSTEM
|
||||
#define HAVE_SYSTEM 0
|
||||
#undef __WINDOWS__
|
||||
#define __WINDOWS__ 1
|
||||
#endif
|
||||
|
||||
static char *spp_var_get(char *var) {
|
||||
return r_sys_getenv (var);
|
||||
}
|
||||
|
@ -90,7 +103,11 @@ static TAG_CALLBACK(spp_getrandom) {
|
|||
return 0;
|
||||
}
|
||||
// XXX srsly? this is pretty bad random
|
||||
#if __WINDOWS__
|
||||
srand (r_sys_getpid ());
|
||||
#else
|
||||
srandom (r_sys_getpid ()); // TODO: change this to be portable
|
||||
#endif
|
||||
max = atoi (buf);
|
||||
if (max > 0) {
|
||||
max = (int)(rand () % max);
|
||||
|
@ -179,7 +196,7 @@ static TAG_CALLBACK(spp_system) {
|
|||
#if HAVE_SYSTEM
|
||||
char *str = cmd_to_str (buf);
|
||||
out_printf (out, "%s", str);
|
||||
free(str);
|
||||
free (str);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,12 +8,6 @@
|
|||
#define R_NEW0(x) (x*)calloc(1,sizeof(x))
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
S_API void out_printf(Output *out, char *str, ...);
|
||||
#else
|
||||
S_API void out_printf(Output *out, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
#endif
|
||||
|
||||
#if USE_R2
|
||||
#include <r_util.h>
|
||||
#else
|
||||
|
@ -30,4 +24,10 @@ char *r_sys_getenv(const char *key);
|
|||
int r_sys_getpid(void);
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
S_API void out_printf(Output *out, char *str, ...);
|
||||
#else
|
||||
S_API void out_printf(Output *out, char *str, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* MIT pancake <pancake@nopcode.org> (C) 2009-2020 */
|
||||
/* MIT pancake <pancake@nopcode.org> (C) 2009-2021 */
|
||||
|
||||
#include "spp.h"
|
||||
#include "r_api.h"
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
#elif R_INLINE
|
||||
#define S_API inline
|
||||
#else
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define S_API __attribute__((visibility("default")))
|
||||
#elif defined(_MSC_VER)
|
||||
#if __WIN32__ || MINGW32 && !__CYGWIN__ || _MSC_VER
|
||||
#define S_API __declspec(dllexport)
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define S_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define S_API
|
||||
#endif
|
||||
|
@ -41,7 +41,7 @@
|
|||
#define __addr_t_defined
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if __WIN32__ || MINGW32 && !__CYGWIN__ || _MSC_VER
|
||||
#if __WIN32__ && (!__CYGWIN__ || _MSC_VER || __MINGW32__)
|
||||
#ifndef _MSC_VER
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
@ -52,7 +52,7 @@
|
|||
#undef __BSD__
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#if __WINDOWS__ || __WIN32__ || __MINGW32__
|
||||
#include <io.h>
|
||||
#define popen _popen
|
||||
#define pclose _pclose
|
||||
|
@ -65,6 +65,8 @@
|
|||
#ifndef DLL_LOCAL
|
||||
#ifdef _MSC_VER
|
||||
#define DLL_LOCAL
|
||||
#elif __WIN32__
|
||||
#define DLL_LOCAL
|
||||
#else
|
||||
#define DLL_LOCAL __attribute__ ((visibility ("hidden")))
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
#!/bin/sh
|
||||
rm -f plugins.cfg
|
||||
cp -f dist/plugins-cfg/plugins.mingw.cfg plugins.cfg
|
||||
./configure --with-ostype=windows --with-compiler=i686-w64-mingw32-gcc --prefix=/
|
||||
make -j4
|
||||
export CC=i686-w64-mingw32-gcc
|
||||
./configure --with-ostype=windows --with-compiler=i686-w64-mingw32-gcc --prefix=/ --without-libuv || exit 1
|
||||
make -j4 || exit 1
|
||||
# install
|
||||
rm -rf prefix
|
||||
make install DESTDIR=$PWD/prefix || exit 1
|
||||
D="radare2-`./configure -qV`-mingw32"
|
||||
rm -rf "$D"
|
||||
mkdir -p "$D"
|
||||
cp -f prefix/bin/*.exe "$D"
|
||||
cp -f prefix/lib/*.dll "$D"
|
||||
ls -l "$D"
|
||||
exec zip -r "$D.zip" "$D"
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
cp -f dist/plugins-cfg/plugins.mingw.cfg plugins.cfg
|
||||
export CC=x86_64-w64-mingw32-gcc
|
||||
./configure --with-ostype=windows --with-compiler=x86_64-w64-mingw32-gcc --prefix=/ --without-libuv || exit 1
|
||||
make -j4 || exit 1
|
||||
# install
|
||||
rm -rf prefix
|
||||
make install DESTDIR=$PWD/prefix || exit 1
|
||||
D="radare2-`./configure -qV`-mingw64"
|
||||
rm -rf "$D"
|
||||
mkdir -p $D || exit 1
|
||||
cp -f prefix/bin/*.exe "$D"
|
||||
cp -f prefix/lib/*.dll "$D"
|
||||
ls -l "$D"
|
||||
zip -r "$D.zip" "$D" || exit 1
|
Loading…
Reference in New Issue