I have the vague feeling that I should be sending these to the patch tracker
on savannah, but here we are:
Thanks for the windows changes in CVS, I have a few more things that I
changed to make things go: This patch is relative to CVS as of about 20
minutes ago.
* configure: Need to use install -p instead of install, so that make doesn't
rebuild frameworks everytime due to header copies.
* configure.ac: Same change
* rules.make: Don't create the obj symlink (we have no symlinks and it
leaves a useless empty dir)
* target.make: add -Wl,--export-all-symbols to SHARED_LIB_LINK_CMD, so that
ld will export all symbols even if the code uses __declspec(dllexport)
extern. See
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gnu-linker/win32.html
for more info. Also add -Wl,--enable-auto-import to ADDITIONAL_LDFLAGS to
shut up a linker warning.
* which_lib.c: when searching for _d _p stuff, on windows look for
FOO_d.dll, then libFOO_d.dll.a, then libFOO_d.a, since that is the same
sequence that ld will use when linking.
* Instance/framework.make: I changed the build-headers code to be faster,
because I have
209 public headers in my framework, and the old makefile was doing 209*209
copies. Changed the $(FRAMEWORK_FILE) target to NOT $(LN_S) the files to
the framework dir unless the link actually succeeded.
* Instance/subproject.make: Make build-headers faster.
* Master/rules.make: Changed subproject to reflect changes to framework.make
wrt Versions dir.
----- Original Message -----
From: "Nicola Pero" <[EMAIL PROTECTED]>
To: "Jeremy Bettis" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Friday, July 15, 2005 6:06 AM
Subject: Re: GNUStep make patch take 1
Thanks Jeremy!
I spent quite some time on this, and I committed the results.
I need to restart yet a last time Windows to check that all is actually
OK, but pseudo-frameworks are supposed to be working for me on Mingw ...
... I also moved them to use the new building system used by libraries.
A few things are done differently, please have a look at the gnustep-make
CVS and see if they work for you! ;-)
I didn't test subprojects though (need to test those too!).
A last thing is maybe we want to remove the top-level xxx.framework/xxx
file, which currently is just a copy of the .dll.
Thanks
PS: I must say the fact that there are no symlinks means we are
effectively copying the framework .dll, .dll.a and headers in the standard
install locations for libraries. This doubles the framework installation
size with no actual benefit (compared to a library or a bundle, whatever
the framework is used as).
So I sort of consider this as a help in porting quickly, for an 'advanced'
port to Windows I would still recommend using libraries and bundles only
which are much more efficient in disk space usage (if you want to build a
standalone Windows application, this might be quite important).
Problem is, I can't really think of a workaround that works well. We
can't delete the .dll from the xxx.framework else you wouldn't be able to
load it as a bundle. We can't delete the .dll from the tool path else you
wouldn't be able to link to it as a library. So we end up with having
both, but that doubles the size. :-(
Anyway, it's good we have this
Thanks for your contribution! :-)
Relative to GNUStep make 1.10.0
I will try to explain what I have done:
HIGH LEVEL:
Some little mingw tweaks, dlls etc.
Don't do anything that requires symlinks on mingw. I.e. Framework
Versions and Current folders, and framework headers in derived_sources.
Mingw will link directly against dlls before using an import library.
I had to change target.make and which_lib.c to be aware of this.
cvs diff -u --binary (in directory C:\Users\jeremy\gnustep-cvs\make\)
Index: configure
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/make/configure,v
retrieving revision 1.178
diff -u --binary -r1.178 configure
--- configure 10 Mar 2005 04:21:17 -0000 1.178
+++ configure 15 Jul 2005 17:37:01 -0000
@@ -2702,7 +2702,7 @@
if test "$MINGW32" = yes; then
echo "hosted on mingw32 .."
- export INSTALL=install
+ export INSTALL="install -p"
export SHELL=sh
export CC=${CC:-gcc}
export AR=${AR:-ar}
Index: configure.ac
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/make/configure.ac,v
retrieving revision 1.38
diff -u --binary -r1.38 configure.ac
--- configure.ac 22 May 2005 03:20:14 -0000 1.38
+++ configure.ac 15 Jul 2005 17:37:07 -0000
@@ -109,7 +109,7 @@
AC_OBJEXT
if test "$MINGW32" = yes; then
echo "hosted on mingw32 .."
- export INSTALL=install
+ export INSTALL="install -p"
export SHELL=sh
export CC=${CC:-gcc}
export AR=${AR:-ar}
Index: rules.make
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/make/rules.make,v
retrieving revision 1.167
diff -u --binary -r1.167 rules.make
--- rules.make 14 Jul 2005 16:20:07 -0000 1.167
+++ rules.make 15 Jul 2005 16:51:40 -0000
@@ -521,10 +521,15 @@
# The rule to create the objects file directory.
$(GNUSTEP_OBJ_DIR):
+ifeq ($(HAS_LN_S),no)
+ $(ECHO_NOTHING)cd $(GNUSTEP_BUILD_DIR); \
+ $(MKDIRS) ./$(GNUSTEP_OBJ_DIR_NAME)$(END_ECHO)
+else
$(ECHO_NOTHING)cd $(GNUSTEP_BUILD_DIR); \
$(MKDIRS) ./$(GNUSTEP_OBJ_DIR_NAME); \
$(RM_LN_S) obj; \
$(LN_S) ./$(GNUSTEP_OBJ_DIR_NAME) obj$(END_ECHO)
+endif
endif
# rules.make loaded
Index: target.make
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/make/target.make,v
retrieving revision 1.170
diff -u --binary -r1.170 target.make
--- target.make 13 Jul 2005 14:56:18 -0000 1.170
+++ target.make 15 Jul 2005 19:22:45 -0000
@@ -879,6 +879,7 @@
# the import library (eg, obj/libgnustep-base.dll.a).
SHARED_LIB_LINK_CMD = \
$(CC) $(SHARED_LD_PREFLAGS) -shared
-Wl,--out-implib,$(LIB_LINK_OBJ_DIR)/$(LIB_LINK_VERSION_FILE) \
+ -Wl,--export-all-symbols \
$(ALL_LDFLAGS) -o $(LIB_LINK_OBJ_DIR)/$(LIB_LINK_DLL_FILE) $^ \
$(INTERNAL_LIBRARIES_DEPEND_UPON) \
$(SHARED_LD_POSTFLAGS)
@@ -905,6 +906,7 @@
HAVE_BUNDLES = yes
BUNDLE_LD = $(CC)
BUNDLE_LDFLAGS += -shared
+ADDITIONAL_LDFLAGS += -Wl,--enable-auto-import
# On Mingw32, it looks like the class name symbols start with '___' rather
# than '__'
Index: which_lib.c
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/make/which_lib.c,v
retrieving revision 1.20
diff -u --binary -r1.20 which_lib.c
--- which_lib.c 22 May 2005 03:20:14 -0000 1.20
+++ which_lib.c 15 Jul 2005 20:41:33 -0000
@@ -282,10 +282,19 @@
struct stat statbuf;
strcpy (full_filename, library_paths[i]);
+#ifdef __MINGW32__
+ /* Mingw can link against dlls directly, so we should look for
library_name.dll then liblibrary_name.dll.a then liblibrary_name.a */
+ strcat (full_filename, "/");
+#else
strcat (full_filename, "/lib");
+#endif
strcat (full_filename, library_name);
strcat (full_filename, suffix);
+#ifdef __MINGW32__
+ strcat (full_filename, ".dll");
+#else
strcat (full_filename, ext);
+#endif
if (show_all)
{
@@ -295,7 +304,39 @@
if (stat (full_filename, &statbuf) < 0)
/* Error - likely that file doesn't exist. */
{
+#ifdef __MINGW32__
+ // On windows a shared library probably has a static "import" library
+ // called liblibrary_name.dll.a
+ strcpy (full_filename, library_paths[i]);
+ strcat (full_filename, "/lib");
+ strcat (full_filename, library_name);
+ strcat (full_filename, suffix);
+ strcat (full_filename, ".dll");
+ strcat (full_filename, ext);
+
+ if (show_all)
+ {
+ fprintf (stderr, " %s\n", full_filename);
+ }
+ if (stat (full_filename, &statbuf) < 0) {
+ // then look for liblibrary_name.a
+ strcpy (full_filename, library_paths[i]);
+ strcat (full_filename, "/lib");
+ strcat (full_filename, library_name);
+ strcat (full_filename, suffix);
+ strcat (full_filename, ext);
+
+ if (show_all)
+ {
+ fprintf (stderr, " %s\n", full_filename);
+ }
+ if (stat (full_filename, &statbuf) < 0)
+ continue;
+ }
+#else
+ if (stat (full_filename, &statbuf) < 0)
continue;
+#endif
}
if ((statbuf.st_mode & S_IFMT) == S_IFREG)
Index: Instance/framework.make
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/make/Instance/framework.make,v
retrieving revision 1.68
diff -u --binary -r1.68 framework.make
--- Instance/framework.make 14 Jul 2005 16:00:52 -0000 1.68
+++ Instance/framework.make 15 Jul 2005 20:22:37 -0000
@@ -366,20 +366,25 @@
$(FRAMEWORK_VERSION_DIR)/Headers:
$(ECHO_CREATING)$(MKDIRS) [EMAIL PROTECTED](END_ECHO)
-$(DERIVED_SOURCES_DIR):
- $(ECHO_CREATING)$(MKDIRS) [EMAIL PROTECTED](END_ECHO)
+$(DERIVED_SOURCES_DIR): $(DERIVED_SOURCES_DIR)/.stamp
+$(DERIVED_SOURCES_DIR)/.stamp:
+ $(ECHO_CREATING)$(MKDIRS) $(DERIVED_SOURCES_DIR); \
+ touch [EMAIL PROTECTED](END_ECHO)
# Need to share this code with the headers code ... but how.
-$(FRAMEWORK_HEADER_FILES): $(addprefix $(HEADER_FILES_DIR)/,$(HEADER_FILES)) \
- $(FRAMEWORK_VERSION_DIR)/Headers
-ifneq ($(HEADER_FILES),)
- $(ECHO_NOTHING)for file in $(HEADER_FILES) __done; do \
- if [ $$file != __done ]; then \
- $(INSTALL_DATA) $(HEADER_FILES_DIR)/$$file \
- $(FRAMEWORK_VERSION_DIR)/Headers/$$file ; \
- fi; \
- done$(END_ECHO)
-endif
+$(FRAMEWORK_VERSION_DIR)/Headers/%.h: $(HEADER_FILES_DIR)/%.h
$(FRAMEWORK_VERSION_DIR)/Headers
+ $(ECHO_NOTHING)$(INSTALL_DATA) $< [EMAIL PROTECTED](END_ECHO)
+
+### $(FRAMEWORK_HEADER_FILES): $(addprefix
$(HEADER_FILES_DIR)/,$(HEADER_FILES)) \
+### $(FRAMEWORK_VERSION_DIR)/Headers
+### ifneq ($(HEADER_FILES),)
+### $(ECHO_NOTHING)for file in $(HEADER_FILES) __done; do \
+### if [ $$file != __done ]; then \
+### $(INSTALL_DATA) $(HEADER_FILES_DIR)/$$file \
+### $(FRAMEWORK_VERSION_DIR)/Headers/$$file ; \
+### fi; \
+### done$(END_ECHO)
+### endif
OBJC_OBJ_FILES_TO_INSPECT = $(OBJC_OBJ_FILES) $(SUBPROJECT_OBJ_FILES)
@@ -396,7 +401,7 @@
# The following rule will also build the DUMMY_FRAMEWORK_CLASS_LIST
# file. This file is always created/deleted at the same time as the
# DUMMY_FRAMEWORK_FILE.
-$(DUMMY_FRAMEWORK_FILE): $(DERIVED_SOURCES_DIR) $(OBJ_FILES_TO_LINK)
GNUmakefile
+$(DUMMY_FRAMEWORK_FILE): $(DERIVED_SOURCES_DIR)/.stamp $(OBJ_FILES_TO_LINK)
GNUmakefile
$(ECHO_CREATING) classes=""; \
for object_file in $(OBJC_OBJ_FILES_TO_INSPECT) __dummy__; do \
if [ "$$object_file" != "__dummy__" ]; then \
@@ -513,7 +518,7 @@
$(FRAMEWORK_FILE): $(DUMMY_FRAMEWORK_OBJ_FILE) $(OBJ_FILES_TO_LINK)
$(ECHO_LINKING) \
- $(LIB_LINK_CMD); \
+ $(LIB_LINK_CMD) && \
(cd $(LIB_LINK_OBJ_DIR); \
$(RM_LN_S) $(GNUSTEP_INSTANCE); \
$(LN_S) $(LIB_LINK_FRAMEWORK_FILE) $(GNUSTEP_INSTANCE)) \
Index: Instance/subproject.make
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/make/Instance/subproject.make,v
retrieving revision 1.25
diff -u --binary -r1.25 subproject.make
--- Instance/subproject.make 6 Jul 2005 16:14:15 -0000 1.25
+++ Instance/subproject.make 15 Jul 2005 17:45:30 -0000
@@ -83,14 +83,17 @@
# We need to build the OWNING_PROJECT_HEADER_DIR directory here
# because this rule could be executed before the top-level framework
# has built his dirs
-$(OWNING_PROJECT_HEADER_FILES): $(HEADER_FILES) $(OWNING_PROJECT_HEADER_DIR)
-ifneq ($(HEADER_FILES),)
- $(ECHO_NOTHING)for file in $(HEADER_FILES) __done; do \
- if [ $$file != __done ]; then \
- $(INSTALL_DATA) ./$$file $(OWNING_PROJECT_HEADER_DIR)/$$file ; \
- fi; \
- done$(END_ECHO)
-endif # we got HEADER_FILES
+$(OWNING_PROJECT_HEADER_DIR)/%.h: %.h $(OWNING_PROJECT_HEADER_DIR)
+ $(ECHO_NOTHING)$(INSTALL_DATA) $< [EMAIL PROTECTED](END_ECHO)
+
+### $(OWNING_PROJECT_HEADER_FILES): $(HEADER_FILES)
$(OWNING_PROJECT_HEADER_DIR)
+### ifneq ($(HEADER_FILES),)
+### $(ECHO_NOTHING)for file in $(HEADER_FILES) __done; do \
+### if [ $$file != __done ]; then \
+### $(INSTALL_DATA) ./$$file $(OWNING_PROJECT_HEADER_DIR)/$$file ; \
+### fi; \
+### done$(END_ECHO)
+### endif # we got HEADER_FILES
$(OWNING_PROJECT_HEADER_DIR):
$(ECHO_CREATING)$(MKDIRS) [EMAIL PROTECTED](END_ECHO)
cvs server: Diffing Instance/Documentation
cvs server: Diffing Instance/Shared
cvs server: Diffing Master
Index: Master/rules.make
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/make/Master/rules.make,v
retrieving revision 1.33
diff -u --binary -r1.33 rules.make
--- Master/rules.make 22 May 2005 03:20:14 -0000 1.33
+++ Master/rules.make 15 Jul 2005 16:28:18 -0000
@@ -297,7 +297,11 @@
if [ "$$type" = "framework" ]; then \
framework_version="$($(basename $(basename
$*))_CURRENT_VERSION_NAME)"; \
if [ "$$framework_version" = "" ]; then framework_version="A"; fi; \
-
owning_project_header_dir="../$${instance}.framework/Versions/$${framework_version}/Headers";
\
+ if [ "$(FRAMEWORK_VERSION_SUPPORT)" = "yes" ] ; then \
+
owning_project_header_dir="../$${instance}.framework/Versions/$${framework_version}/Headers";
\
+ else \
+
owning_project_header_dir="../$${instance}.framework/Headers"; \
+ fi ; \
else owning_project_header_dir=""; \
fi; \
else \
@@ -362,7 +366,11 @@
if [ "$$type" = "framework" ]; then \
framework_version="$($(basename $(basename
$*))_CURRENT_VERSION_NAME)"; \
if [ "$$framework_version" = "" ]; then framework_version="A"; fi; \
+ if [ "$(FRAMEWORK_VERSION_SUPPORT)" = "yes" ] ; then \
owning_project_header_dir="../$${instance}.framework/Versions/$${framework_version}/Headers";
\
+ else \
+
owning_project_header_dir="../$${instance}.framework/Headers"; \
+ fi ; \
else owning_project_header_dir=""; \
fi; \
else \
_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev