It turns out that, in gnustep-make the mingw64 support was incomplete,

so when we correctly detect mingw64 rather than mingw32 we actually
broke building of Gorm on mingw64.  Additionally, examination of the
cases where we do differentiate between mingw32 and mingw64, in all but
one of them we do the same thing for both.  That being the case, it
makes more sense to scrap the code to differentiate between the two
systems (except in the one case in target.make where we need to be aware
that the two systems prefix class names differently in the object
files), and adopt the triplet used by the mingw-w64 project (where os is
always mingw32 and we differentaiate 64bit windows using the vendor part
of the triplet) rather than the one returned by autoconf (config.guess).
This commit is contained in:
Richard Frith-Macdonald 2021-03-06 12:50:53 +00:00
parent 04ce555693
commit 2270671e94
6 changed files with 72 additions and 193 deletions

View file

@ -122,8 +122,6 @@ endif
# when linking applications.
ifeq ($(findstring mingw32, $(GNUSTEP_TARGET_OS)), mingw32)
ALL_LDFLAGS += -Wl,-subsystem,windows
else ifeq ($(findstring mingw64, $(GNUSTEP_TARGET_OS)), mingw32)
ALL_LDFLAGS += -Wl,-subsystem,windows
endif
$(APP_FILE): $(OBJ_FILES_TO_LINK)

41
configure vendored
View file

@ -4393,6 +4393,20 @@ $as_echo "$cc_bundle" >&6; }
#--------------------------------------------------------------------
# config.guess returns mingw64 and pc as the os and vendor, but the
# mingw-w64 project chose to use mingw32 and w64 respectively. We
#need to standardise on one.
#--------------------------------------------------------------------
if test "$host_os" = mingw64; then
host_os=mingw32
host_vendor=w64
fi
if test "$target_os" = mingw64; then
target_os=mingw32
target_vendor=w64
fi
#--------------------------------------------------------------------
# specific target_os options
#--------------------------------------------------------------------
@ -4402,15 +4416,6 @@ case "$target_os" in
LIB_DIR="$LIB_DIR -L/usr/local/lib";;
netbsd*) INCLUDES="$INCLUDES -I/usr/pkg/include"
LIB_DIR="$LIB_DIR -Wl,-R/usr/pkg/lib -L/usr/pkg/lib";;
*mingw32* )
# NB. autoconf expects the triplet (cpu-vendor-os) to have mingw32 or
# mingw64 as the os part, but the mingw-w64 project chose a different
# triplet (cpu-w64-mingw32) which looks like mingw32. To handle that
# we convert the triplet back to the standard form.
if test "$target_vendor" = w64; then
target_vendor=pc
target_os=mingw64
fi;;
esac
#--------------------------------------------------------------------
@ -4423,24 +4428,14 @@ case $host_os in
CYGWIN=yes
MSWIND=yes;;
*mingw32* )
if test "$host_vendor" = w64; then
# NB. autoconf expects the triplet (cpu-vendor-os) to have mingw32 or
# mingw64 as the os part, but the mingw-w64 project chose a different
# triplet (cpu-w64-mingw32) which looks like mingw32. To handle that
# we convert the triplet back to the standard form.
host_vendor=pc
host_os=mingw64
MINGW32=no
MINGW64=yes
else
if test $host_vendor = pc
then
MINGW32=yes
MINGW64=no
fi
CYGWIN=no
MSWIND=yes;;
*mingw64* )
else
MINGW32=no
MINGW64=yes
fi
CYGWIN=no
MSWIND=yes;;
* )

View file

@ -108,6 +108,20 @@ AC_MSG_RESULT($cc_bundle)
AC_SUBST(cc_cppprecomp)
AC_SUBST(cc_bundle)
#--------------------------------------------------------------------
# config.guess returns mingw64 and pc as the os and vendor, but the
# mingw-w64 project chose to use mingw32 and w64 respectively. We
#need to standardise on one.
#--------------------------------------------------------------------
if test "$host_os" = mingw64; then
host_os=mingw32
host_vendor=w64
fi
if test "$target_os" = mingw64; then
target_os=mingw32
target_vendor=w64
fi
#--------------------------------------------------------------------
# specific target_os options
#--------------------------------------------------------------------
@ -117,15 +131,6 @@ case "$target_os" in
LIB_DIR="$LIB_DIR -L/usr/local/lib";;
netbsd*) INCLUDES="$INCLUDES -I/usr/pkg/include"
LIB_DIR="$LIB_DIR -Wl,-R/usr/pkg/lib -L/usr/pkg/lib";;
*mingw32* )
# NB. autoconf expects the triplet (cpu-vendor-os) to have mingw32 or
# mingw64 as the os part, but the mingw-w64 project chose a different
# triplet (cpu-w64-mingw32) which looks like mingw32. To handle that
# we convert the triplet back to the standard form.
if test "$target_vendor" = w64; then
target_vendor=pc
target_os=mingw64
fi;;
esac
#--------------------------------------------------------------------
@ -138,24 +143,14 @@ case $host_os in
CYGWIN=yes
MSWIND=yes;;
*mingw32* )
if test "$host_vendor" = w64; then
# NB. autoconf expects the triplet (cpu-vendor-os) to have mingw32 or
# mingw64 as the os part, but the mingw-w64 project chose a different
# triplet (cpu-w64-mingw32) which looks like mingw32. To handle that
# we convert the triplet back to the standard form.
host_vendor=pc
host_os=mingw64
MINGW32=no
MINGW64=yes
else
if test $host_vendor = pc
then
MINGW32=yes
MINGW64=no
fi
CYGWIN=no
MSWIND=yes;;
*mingw64* )
else
MINGW32=no
MINGW64=yes
fi
CYGWIN=no
MSWIND=yes;;
* )

View file

@ -48,8 +48,6 @@ endif
# Windows
ifeq ($(findstring mingw32, $(GNUSTEP_TARGET_OS)), mingw32)
JAVA_OS = win32
else ifeq ($(findstring mingw64, $(GNUSTEP_TARGET_OS)), mingw64)
JAVA_OS = win32
endif
# Add more platforms here

View file

@ -572,14 +572,6 @@ ifeq ($(findstring mingw32, $(GNUSTEP_TARGET_OS)), mingw32)
# Add the .rc suffix on Windows.
.SUFFIXES: .rc
# A rule to generate a .o file from the .rc file.
$(GNUSTEP_OBJ_INSTANCE_DIR)/%.rc$(OEXT): %.rc
$(ECHO_COMPILING)windres $< $@$(END_ECHO)
else ifeq ($(findstring mingw64, $(GNUSTEP_TARGET_OS)), mingw64)
# Add the .rc suffix on Windows.
.SUFFIXES: .rc
# A rule to generate a .o file from the .rc file.
$(GNUSTEP_OBJ_INSTANCE_DIR)/%.rc$(OEXT): %.rc
$(ECHO_COMPILING)windres $< $@$(END_ECHO)

View file

@ -59,10 +59,6 @@ ifeq ($(findstring mingw32, $(GNUSTEP_TARGET_OS)), mingw32)
TARGET_SYSTEM_LIBS = $(CONFIG_SYSTEM_LIBS) \
-lws2_32 -ladvapi32 -lcomctl32 -luser32 -lcomdlg32 \
-lmpr -lnetapi32 -lm -I. # the -I is a dummy to avoid -lm^M
else ifeq ($(findstring mingw64, $(GNUSTEP_TARGET_OS)), mingw64)
TARGET_SYSTEM_LIBS = $(CONFIG_SYSTEM_LIBS) \
-lws2_32 -ladvapi32 -lcomctl32 -luser32 -lcomdlg32 \
-lmpr -lnetapi32 -lm -I. # the -I is a dummy to avoid -lm^M
else ifeq ($(GNUSTEP_TARGET_OS), windows)
TARGET_SYSTEM_LIBS = $(CONFIG_SYSTEM_LIBS) \
-lws2_32 -ladvapi32 -lcomctl32 -luser32 -lcomdlg32 \
@ -881,10 +877,14 @@ endif
ADDITIONAL_LDFLAGS += -Wl,--enable-auto-import
ADDITIONAL_FLAGS += -fno-omit-frame-pointer
# On Mingw32, it looks like the class name symbols start with '___' rather
# than '__'
# On 32bit Mingw32, it looks like the class name symbols start with an extra
# underscore.
ifeq ($(findstring pc, $(GNUSTEP_TARGET_VENDOR)), pc)
EXTRACT_CLASS_NAMES_COMMAND = $(NM) -Pg $$object_file | sed -n -e '/^.__OBJC_CLASS_[A-Za-z0-9_.]* [^U]/ {s/^.__OBJC_CLASS_\([A-Za-z0-9_.]*\) [^U].*/\1/p;}' -e '/^___objc_class_name_[A-Za-z0-9_.]* [^U]/ {s/^___objc_class_name_\([A-Za-z0-9_.]*\) [^U].*/\1/p;}'
else
EXTRACT_CLASS_NAMES_COMMAND = $(NM) -Pg $$object_file | sed -n -e '/^._OBJC_CLASS_[A-Za-z0-9_.]* [^U]/ {s/^._OBJC_CLASS_\([A-Za-z0-9_.]*\) [^U].*/\1/p;}' -e '/^__objc_class_name_[A-Za-z0-9_.]* [^U]/ {s/^__objc_class_name_\([A-Za-z0-9_.]*\) [^U].*/\1/p;}'
endif
endif
@ -892,105 +892,6 @@ endif
#
####################################################
####################################################
#
# Mingw64
#
ifeq ($(findstring mingw64, $(GNUSTEP_TARGET_OS)), mingw64)
shared = yes
HAVE_SHARED_LIBS = yes
# There's some sort of gcc bug that -pthread doesn't work on windows
# so we need to reset the variables which use it.
INTERNAL_CFLAGS =
INTERNAL_OBJCFLAGS =
INTERNAL_LDFLAGS =
SHARED_CFLAGS =
# This command links the library, generates automatically the list of
# symbols to export, creates the DLL (eg, obj/gnustep-base-1_13.dll)
# and the import library (eg, obj/libgnustep-base.dll.a). We pass
# --export-all-symbols to make sure it is always used. Otherwise,
# while it is the default, it might silently get disabled if a symbol
# gets manually exported (eg, because a header of a library we include
# exports a symbol by mistake).
ifneq ($(CLANG_CC), yes)
SHARED_LIB_LINK_CMD = \
$(LD) $(SHARED_LD_PREFLAGS) -shared \
-Wl,--enable-auto-image-base \
-Wl,--export-all-symbols \
-Wl,--out-implib,$(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) \
$(ALL_LDFLAGS) -o $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_DLL_FILE) $^ \
$(INTERNAL_LIBRARIES_DEPEND_UPON) \
$(SHARED_LD_POSTFLAGS)
else
SHARED_LIB_LINK_CMD = \
$(LD) $(SHARED_LD_PREFLAGS) -shared \
-Wl,--enable-auto-image-base \
-Wl,--export-all-symbols \
-Wl,--out-implib,$(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) \
-o $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_DLL_FILE) \
-Wl,--whole-archive $^ $(ALL_LDFLAGS) -Wl,--no-whole-archive \
$(INTERNAL_LIBRARIES_DEPEND_UPON) \
$(SHARED_LD_POSTFLAGS)
endif
AFTER_INSTALL_SHARED_LIB_CMD =
AFTER_INSTALL_SHARED_LIB_CHOWN =
BUILD_DLL = yes
LIBEXT = .a
# Technically, in this Unix-inspired building system, a DLL is
# composed of a .dll file which goes in the executable path and is the
# one which is loaded at runtime, and a .dll.a file which goes in the
# library path and which is linked into the application in order to
# enable it use the .dll. Anything in gnustep-make which is looking
# for shared libs should detect / look for the .dll.a as that's what
# we link applications against.
SHARED_LIBEXT = .dll.a
DLL_LIBEXT = .dll
#SHARED_CFLAGS +=
ifneq ($(CLANG_CC), yes)
OBJ_MERGE_CMD = \
$(LD) -nostdlib $(OBJ_MERGE_CMD_FLAG) $(CORE_LDFLAGS) -o $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
else
OBJ_MERGE_CMD = \
ar cr $(GNUSTEP_OBJ_DIR)/$(SUBPROJECT_PRODUCT) $^ ;
endif
HAVE_BUNDLES = yes
BUNDLE_LD = $(LD)
ifeq ($(CLANG_CC), yes)
BUNDLE_LDFLAGS += -shared -Wl,--export-all-symbols \
-Wl,--enable-auto-import \
-Wl,--enable-auto-image-base \
-Wl,--whole-archive
BUNDLE_LIBFLAGS += -Wl,--no-whole-archive
BUNDLE_LINK_CMD = \
$(BUNDLE_LD) $(BUNDLE_LDFLAGS) $(ALL_LDFLAGS) \
-o $(LDOUT)$(BUNDLE_FILE) \
$(OBJ_FILES_TO_LINK) \
$(BUNDLE_LIBFLAGS) $(ALL_LIB_DIRS) $(BUNDLE_LIBS)
else
BUNDLE_LDFLAGS += -shared -Wl,--enable-auto-image-base
endif
ADDITIONAL_LDFLAGS += -Wl,--enable-auto-import
ADDITIONAL_FLAGS += -fno-omit-frame-pointer
# On Mingw64, it looks like the class name symbols start with '__' rather
# than '___' like Mingw32
EXTRACT_CLASS_NAMES_COMMAND = $(NM) -Pg $$object_file | sed -n -e '/^._OBJC_CLASS_[A-Za-z0-9_.]* [^U]/ {s/^._OBJC_CLASS_\([A-Za-z0-9_.]*\) [^U].*/\1/p;}' -e '/^__objc_class_name_[A-Za-z0-9_.]* [^U]/ {s/^__objc_class_name_\([A-Za-z0-9_.]*\) [^U].*/\1/p;}'
endif
# end Mingw64
#
####################################################
####################################################
#
# Cygwin