From 4a0880003c0111ec397312ebaa989fb02ced633a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 24 Feb 2015 14:30:42 -0600 Subject: [PATCH] Support MinGW cross-builds on linux-x86 and x86_64 --- configure/os/CONFIG.Common.win32-x86-mingw | 3 ++- configure/os/CONFIG.linux-x86.win32-x86-mingw | 22 ++++++++++++++++++ .../os/CONFIG.linux-x86_64.win32-x86-mingw | 9 ++++++++ .../os/CONFIG.win32-x86-mingw.win32-x86-mingw | 11 ++++++--- .../os/CONFIG_SITE.Common.win32-x86-mingw | 10 ++++---- .../os/CONFIG_SITE.linux-x86.win32-x86-mingw | 23 +++++++++++++++++++ .../CONFIG_SITE.linux-x86_64.win32-x86-mingw | 8 +++++++ ...ONFIG_SITE.win32-x86-mingw.win32-x86-mingw | 14 ++++------- documentation/RELEASE_NOTES.html | 10 ++++++++ src/as/asHost.rc | 2 +- src/as/asIoc.rc | 2 +- src/ca/ca.rc | 2 +- src/cas/build/cas.rc | 2 +- src/db/dbIoc.rc | 2 +- src/dbStatic/dbStaticHost.rc | 2 +- src/dbStatic/dbStaticIoc.rc | 2 +- src/dbtools/dbtoolsIoc.rc | 2 +- src/dev/softDev/softDevIoc.rc | 2 +- src/dev/testDev/testDevIoc.rc | 2 +- src/gdd/gdd.rc | 2 +- src/libCom/Com.rc | 2 +- src/misc/misc.rc | 2 +- src/misc/miscIoc.rc | 2 +- src/rec/recIoc.rc | 2 +- src/registry/registryIoc.rc | 2 +- src/rsrv/rsrvIoc.rc | 2 +- 26 files changed, 107 insertions(+), 37 deletions(-) create mode 100644 configure/os/CONFIG.linux-x86.win32-x86-mingw create mode 100644 configure/os/CONFIG.linux-x86_64.win32-x86-mingw create mode 100644 configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw create mode 100644 configure/os/CONFIG_SITE.linux-x86_64.win32-x86-mingw diff --git a/configure/os/CONFIG.Common.win32-x86-mingw b/configure/os/CONFIG.Common.win32-x86-mingw index a229902a7..7ff9b5fe5 100644 --- a/configure/os/CONFIG.Common.win32-x86-mingw +++ b/configure/os/CONFIG.Common.win32-x86-mingw @@ -34,7 +34,8 @@ ARCH_DEP_LDFLAGS += -m32 # Override for -DUNIX from CONFIG.Common.UnixCommon OP_SYS_CPPFLAGS = -D_MINGW -EXE=.exe +EXE = .exe +RES = .coff VISC_DLL_NO = -DEPICS_DLL_NO VISC_DLL_YES = diff --git a/configure/os/CONFIG.linux-x86.win32-x86-mingw b/configure/os/CONFIG.linux-x86.win32-x86-mingw new file mode 100644 index 000000000..0e9c44c13 --- /dev/null +++ b/configure/os/CONFIG.linux-x86.win32-x86-mingw @@ -0,0 +1,22 @@ +# CONFIG.linux-x86.win32-x86-mingw +# +# Definitions for linux-x86 host win32-x86-mingw target builds +# Override these definitions in CONFIG_SITE.linux-x86.win32-x86-mingw +#------------------------------------------------------- + +# Include common gnu compiler definitions +include $(CONFIG)/CONFIG.gnuCommon + +# Add resource compiler +RCCMD = $(CMPLR_PREFIX)windres$(CMPLR_SUFFIX) $(INCLUDES) $< $@ + +# Remove -fPIC flags, add out-implib +SHRLIB_CFLAGS = +SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) +LOADABLE_SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) + +# Don't link with gcc library +GNU_LDLIBS_YES = + +# Link with winsock2 +OP_SYS_LDLIBS = -lws2_32 diff --git a/configure/os/CONFIG.linux-x86_64.win32-x86-mingw b/configure/os/CONFIG.linux-x86_64.win32-x86-mingw new file mode 100644 index 000000000..fe4edd1e8 --- /dev/null +++ b/configure/os/CONFIG.linux-x86_64.win32-x86-mingw @@ -0,0 +1,9 @@ +# CONFIG.linux-x86_64.win32-x86-mingw +# +# Definitions for linux-x86_64 host win32-x86-mingw target builds +# Override these definitions in CONFIG_SITE.linux-x86_64.win32-x86-mingw +#------------------------------------------------------- + +# Settings as for the linux-x86 host architecture +include $(CONFIG)/os/CONFIG.linux-x86.win32-x86-mingw + diff --git a/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw b/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw index 96fa115fc..c101376c8 100644 --- a/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw +++ b/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw @@ -9,22 +9,27 @@ # Include common gnu compiler definitions include $(CONFIG)/CONFIG.gnuCommon +# Undo various things set by CONFIG.gnuCommon + CMPLR_PREFIX = +# Remove $(GNU_BIN)/ path CC = $(CMPLR_PREFIX)gcc CCC = $(CMPLR_PREFIX)g++ AR = $(CMPLR_PREFIX)ar -rc LD = $(CMPLR_PREFIX)ld -r RANLIB = $(CMPLR_PREFIX)ranlib -RES = .coff + +# Add resource compiler RCCMD = $(CMPLR_PREFIX)windres $(INCLUDES) $< $@ -# No -fPIC avoids "-fPIC ignored for target (all code is position independent)" +# Remove -fPIC flags, add out-implib SHRLIB_CFLAGS = SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) LOADABLE_SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) -# Override linking with gcc library from CONFIG.gnuCommon +# Don't link with gcc library GNU_LDLIBS_YES = +# Link with winsock2 OP_SYS_LDLIBS = -lws2_32 diff --git a/configure/os/CONFIG_SITE.Common.win32-x86-mingw b/configure/os/CONFIG_SITE.Common.win32-x86-mingw index e61ffc7b9..39f219b19 100644 --- a/configure/os/CONFIG_SITE.Common.win32-x86-mingw +++ b/configure/os/CONFIG_SITE.Common.win32-x86-mingw @@ -1,11 +1,9 @@ -# CONFIG_SITE.win32-x86-mingw.Common +# CONFIG_SITE.Common.win32-x86-mingw # # $Revision-Id$ # -# Site Specific definitions for cygwin-x86 target -# Only the local epics system manager should modify this file +# Site Specific definitions for win32-x86-mingw target -# If readline is not installed comment the following line -# to omit command-line editing and history support +# If readline is available uncomment the following line +# to enable command-line editing and history support #COMMANDLINE_LIBRARY = READLINE - diff --git a/configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw b/configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw new file mode 100644 index 000000000..1d132b74d --- /dev/null +++ b/configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw @@ -0,0 +1,23 @@ +# CONFIG_SITE.linux-x86.win32-x86-mingw +# +# Configuration for linux-x86 host win32-x86-mingw target builds +#------------------------------------------------------- + +# Early versions of the MinGW cross-build tools can only build +# static (non-DLL) libraries. Fedora's cross-build of gcc 4.4.6 +# needs these uncommented, other distributions have not been +# tested with this release of Base: +SHARED_LIBRARIES = NO +STATIC_BUILD = YES + +# The cross-build tools are in $(GNU_DIR)/bin +# Default is /usr +#GNU_DIR = /usr/local + +# Different distribution cross-build packages use different prefixes: +# Ubuntu: +#CMPLR_PREFIX = i686-w64-mingw32- +# RHEL: +CMPLR_PREFIX = i686-pc-mingw32- +# Debian? +#CMPLR_PREFIX = i586-mingw32msvc- diff --git a/configure/os/CONFIG_SITE.linux-x86_64.win32-x86-mingw b/configure/os/CONFIG_SITE.linux-x86_64.win32-x86-mingw new file mode 100644 index 000000000..99836730a --- /dev/null +++ b/configure/os/CONFIG_SITE.linux-x86_64.win32-x86-mingw @@ -0,0 +1,8 @@ +# CONFIG_SITE.linux-x86_64.win32-x86-mingw +# +# Configuration for linux-x86_64 host win32-x86-mingw target builds +#------------------------------------------------------- + +# Inherit from the linux-x86 host architecture +include $(CONFIG)/os/CONFIG_SITE.linux-x86.win32-x86-mingw + diff --git a/configure/os/CONFIG_SITE.win32-x86-mingw.win32-x86-mingw b/configure/os/CONFIG_SITE.win32-x86-mingw.win32-x86-mingw index 259d1e0c8..9022b8e2b 100644 --- a/configure/os/CONFIG_SITE.win32-x86-mingw.win32-x86-mingw +++ b/configure/os/CONFIG_SITE.win32-x86-mingw.win32-x86-mingw @@ -3,15 +3,9 @@ # $Revision-Id$ # # Site Specific definitions for win32-x86-mingw target -# Only the local epics system manager should modify this file +# The MinGW bin directory must be in your path. -# Uncomment the following settings for MinGW_w32 releases -# /bin should be in your path -#CMPLR_PREFIX=i686-w64-mingw32- -#CC = $(CMPLR_PREFIX)gcc -#CCC = $(CMPLR_PREFIX)g++ -#AR = $(CMPLR_PREFIX)ar -rc -#LD = $(CMPLR_PREFIX)ld -r -#RANLIB = $(CMPLR_PREFIX)ranlib - +# Set the compiler prefix for your MinGW installation +#CMPLR_PREFIX = i686-w64-mingw32- +#CMPLR_PREFIX = i586-mingw32msvc- diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index c022df09f..98cd64ae7 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,16 @@ +

MinGW Cross-builds from Linux

+ +

Build configuration files have been back-ported from the 3.15 branch that +allows cross-building of the win32-x86-mingw target from either linux-x86 or +linux-x86_64 hosts. Many Linux distributions now package the necessary MinGW +cross-build tools and libraries to support this. Adjust the settings in +configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw and add win32-x86-mingw to +the CROSS_COMPILER_TARGET_ARCHS variable in configure/CONFIG_SITE or in +configure/os/CONFIG_SITE.linux-x86.Common.

+

Build rules for RTEMS GESYS modules

RTEMS target builds can now be configured to make GESYS modules by changing diff --git a/src/as/asHost.rc b/src/as/asHost.rc index 77981517e..6546cf8be 100644 --- a/src/as/asHost.rc +++ b/src/as/asHost.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/as/asIoc.rc b/src/as/asIoc.rc index f83a3c17e..c693af530 100644 --- a/src/as/asIoc.rc +++ b/src/as/asIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/ca/ca.rc b/src/ca/ca.rc index cf25cdf24..b1f87acb4 100644 --- a/src/ca/ca.rc +++ b/src/ca/ca.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/cas/build/cas.rc b/src/cas/build/cas.rc index 8ad47e360..6c84bced8 100644 --- a/src/cas/build/cas.rc +++ b/src/cas/build/cas.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/db/dbIoc.rc b/src/db/dbIoc.rc index 6b261fff3..5c810b0e5 100644 --- a/src/db/dbIoc.rc +++ b/src/db/dbIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/dbStatic/dbStaticHost.rc b/src/dbStatic/dbStaticHost.rc index a6d32066a..6065fc55c 100644 --- a/src/dbStatic/dbStaticHost.rc +++ b/src/dbStatic/dbStaticHost.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/dbStatic/dbStaticIoc.rc b/src/dbStatic/dbStaticIoc.rc index 865e8102d..b9f12cd80 100644 --- a/src/dbStatic/dbStaticIoc.rc +++ b/src/dbStatic/dbStaticIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/dbtools/dbtoolsIoc.rc b/src/dbtools/dbtoolsIoc.rc index 5f3d70bf4..d7aedf548 100644 --- a/src/dbtools/dbtoolsIoc.rc +++ b/src/dbtools/dbtoolsIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/dev/softDev/softDevIoc.rc b/src/dev/softDev/softDevIoc.rc index addbe1708..7e789bb2e 100644 --- a/src/dev/softDev/softDevIoc.rc +++ b/src/dev/softDev/softDevIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/dev/testDev/testDevIoc.rc b/src/dev/testDev/testDevIoc.rc index 04c9dbdae..70ab82d1f 100644 --- a/src/dev/testDev/testDevIoc.rc +++ b/src/dev/testDev/testDevIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/gdd/gdd.rc b/src/gdd/gdd.rc index e5ca7379d..d677c6f7a 100644 --- a/src/gdd/gdd.rc +++ b/src/gdd/gdd.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/libCom/Com.rc b/src/libCom/Com.rc index d0edc440b..d5a5562b7 100644 --- a/src/libCom/Com.rc +++ b/src/libCom/Com.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/misc/misc.rc b/src/misc/misc.rc index 040cf26c8..a24406060 100644 --- a/src/misc/misc.rc +++ b/src/misc/misc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/misc/miscIoc.rc b/src/misc/miscIoc.rc index abff0a137..235c2a746 100644 --- a/src/misc/miscIoc.rc +++ b/src/misc/miscIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/rec/recIoc.rc b/src/rec/recIoc.rc index 7dad57625..a345ef4b9 100644 --- a/src/rec/recIoc.rc +++ b/src/rec/recIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/registry/registryIoc.rc b/src/registry/registryIoc.rc index e2397ba0b..46e7dca2c 100644 --- a/src/registry/registryIoc.rc +++ b/src/registry/registryIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/rsrv/rsrvIoc.rc b/src/rsrv/rsrvIoc.rc index 758096e16..b82b2e5ca 100644 --- a/src/rsrv/rsrvIoc.rc +++ b/src/rsrv/rsrvIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO