>From 0890a33ae04d2ada3d4a81b8570e81c9c715fa9d Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Fri, 24 Jan 2014 23:24:29 +0100 Subject: [PATCH 2/3] Fix SONAME handling on Windows This removes unnecessarily duplicated rules for chicken-defaults.h from Cygwin Makefile and fixes MingW makefile to set the new USES_SONAME definition. The only actual difference between Makefile.cygwin and defaults.make was that it set TARGET_RUN_LIB_HOME to TARGET_PREFIX/bin - now make this dependent on DLLSINPATH, which also controls where the library is copied during install. --- Makefile.cygwin | 138 ------------------------------------------------------- Makefile.mingw | 12 +++-- csc.scm | 11 ++--- defaults.make | 8 ++++ 4 files changed, 20 insertions(+), 149 deletions(-) diff --git a/Makefile.cygwin b/Makefile.cygwin index 6989ab8..abe7fa0 100644 --- a/Makefile.cygwin +++ b/Makefile.cygwin @@ -80,7 +80,6 @@ APPLY_HACK_OBJECT = apply-hack.$(ARCH)$(O) # select default and internal settings -CUSTOM_CHICKEN_DEFAULTS=1 include $(SRCDIR)/defaults.make LIBCHICKEN_SO_LIBRARIES = $(LIBRARIES) @@ -127,141 +126,4 @@ ifdef HACKED_APPLY endif cat chicken-defaults.h >>$@ -chicken-defaults.h: - echo "/* generated */" >$@ - echo "#define C_CHICKEN_PROGRAM \"$(CHICKEN_PROGRAM)$(EXE)\"" >>$@ - echo "#ifndef C_INSTALL_CC" >>$@ - echo "# define C_INSTALL_CC \"$(C_COMPILER)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_CXX" >>$@ - echo "# define C_INSTALL_CXX \"$(CXX_COMPILER)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_POSTINSTALL_PROGRAM" >>$@ - echo "# define C_INSTALL_POSTINSTALL_PROGRAM \"$(POSTINSTALL_PROGRAM)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_CFLAGS" >>$@ - echo "# define C_INSTALL_CFLAGS \"$(C_COMPILER_OPTIONS) $(C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_LDFLAGS" >>$@ - echo "# define C_INSTALL_LDFLAGS \"$(LINKER_OPTIONS) $(LINKER_OPTIMIZATION_OPTIONS)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_PREFIX" >>$@ - echo "# define C_INSTALL_PREFIX \"$(PREFIX)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_SHARE_HOME" >>$@ - echo "# define C_INSTALL_SHARE_HOME \"$(DATADIR)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_BIN_HOME" >>$@ - echo "# define C_INSTALL_BIN_HOME \"$(BINDIR)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_EGG_HOME" >>$@ - echo "# define C_INSTALL_EGG_HOME \"$(EGGDIR)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_LIB_HOME" >>$@ - echo "# define C_INSTALL_LIB_HOME \"$(LIBDIR)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_LIB_NAME" >>$@ - echo "# define C_INSTALL_LIB_NAME \"$(INSTALL_LIB_NAME)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_STATIC_LIB_HOME" >>$@ - echo "# define C_INSTALL_STATIC_LIB_HOME \"$(LIBDIR)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_INCLUDE_HOME" >>$@ - echo "# define C_INSTALL_INCLUDE_HOME \"$(INCDIR)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_MORE_LIBS" >>$@ - echo "# define C_INSTALL_MORE_LIBS \"$(LIBRARIES)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_INSTALL_MORE_STATIC_LIBS" >>$@ - echo "# define C_INSTALL_MORE_STATIC_LIBS \"$(LIBRARIES)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_DEFAULT_TARGET_STACK_SIZE" >>$@ - echo "# define C_DEFAULT_TARGET_STACK_SIZE $(NURSERY)" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_DEFAULT_TARGET_HEAP_SIZE" >>$@ - echo "# define C_DEFAULT_TARGET_HEAP_SIZE 0" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_STACK_GROWS_DOWNWARD" >>$@ - echo "# define C_STACK_GROWS_DOWNWARD $(STACKDIRECTION)" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_MORE_LIBS" >>$@ - echo "# define C_TARGET_MORE_LIBS \"$(TARGET_LIBRARIES)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_MORE_LIBS" >>$@ - echo "# define C_TARGET_MORE_LIBS \"$(TARGET_LIBRARIES)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_MORE_STATIC_LIBS" >>$@ - echo "# define C_TARGET_MORE_STATIC_LIBS \"$(TARGET_LIBRARIES)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_CC" >>$@ - echo "# define C_TARGET_CC \"$(TARGET_C_COMPILER)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_CXX" >>$@ - echo "# define C_TARGET_CXX \"$(TARGET_CXX_COMPILER)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_CFLAGS" >>$@ - echo "# define C_TARGET_CFLAGS \"$(TARGET_C_COMPILER_OPTIONS) $(TARGET_C_COMPILER_OPTIMIZATION_OPTIONS)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_LDFLAGS" >>$@ - echo "# define C_TARGET_LDFLAGS \"$(TARGET_LINKER_OPTIONS) $(TARGET_LINKER_OPTIMIZATION_OPTIONS)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_FEATURES" >>$@ - echo "# define C_TARGET_FEATURES \"$(TARGET_FEATURES)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_CROSS_CHICKEN" >>$@ - echo "# define C_CROSS_CHICKEN $(CROSS_CHICKEN)" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_PREFIX" >>$@ - echo "# define C_TARGET_PREFIX \"$(TARGET_PREFIX)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_BIN_HOME" >>$@ - echo "# define C_TARGET_BIN_HOME \"$(TARGET_PREFIX)/bin\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_LIB_HOME" >>$@ - echo "# define C_TARGET_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_LIB_NAME" >>$@ - echo "# define C_TARGET_LIB_NAME \"$(TARGET_LIB_NAME)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_RUN_LIB_HOME" >>$@ - echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)/bin\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_SHARE_HOME" >>$@ - echo "# define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)/share\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_INCLUDE_HOME" >>$@ - echo "# define C_TARGET_INCLUDE_HOME \"$(TARGET_PREFIX)/include/chicken\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_TARGET_STATIC_LIB_HOME" >>$@ - echo "# define C_TARGET_STATIC_LIB_HOME \"$(TARGET_PREFIX)/lib\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_CHICKEN_PROGRAM" >>$@ - echo "# define C_CHICKEN_PROGRAM \"$(CHICKEN_PROGRAM)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_CSC_PROGRAM" >>$@ - echo "# define C_CSC_PROGRAM \"$(CSC_PROGRAM)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_CSI_PROGRAM" >>$@ - echo "# define C_CSI_PROGRAM \"$(CSI_PROGRAM)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_CHICKEN_BUG_PROGRAM" >>$@ - echo "# define C_CHICKEN_BUG_PROGRAM \"$(CHICKEN_BUG_PROGRAM)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_CHICKEN_INSTALL_PROGRAM" >>$@ - echo "# define C_CHICKEN_INSTALL_PROGRAM \"$(CHICKEN_INSTALL_PROGRAM)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_CHICKEN_UNINSTALL_PROGRAM" >>$@ - echo "# define C_CHICKEN_UNINSTALL_PROGRAM \"$(CHICKEN_UNINSTALL_PROGRAM)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_CHICKEN_STATUS_PROGRAM" >>$@ - echo "# define C_CHICKEN_STATUS_PROGRAM \"$(CHICKEN_STATUS_PROGRAM)\"" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_WINDOWS_SHELL" >>$@ - echo "# define C_WINDOWS_SHELL 0" >>$@ - echo "#endif" >>$@ - echo "#ifndef C_BINARY_VERSION" >>$@ - echo "# define C_BINARY_VERSION $(BINARYVERSION)" >>$@ - echo "#endif" >>$@ - echo "/* END OF FILE */" >>$@ - include $(SRCDIR)/rules.make diff --git a/Makefile.mingw b/Makefile.mingw index 4027171..9f803e7 100644 --- a/Makefile.mingw +++ b/Makefile.mingw @@ -134,9 +134,6 @@ endif echo #ifndef C_INSTALL_CXX >>$@ echo # define C_INSTALL_CXX "$(CXX_COMPILER)" >>$@ echo #endif >>$@ - echo #ifndef C_INSTALL_POSTINSTALL_PROGRAM >>$@ - echo # define C_INSTALL_POSTINSTALL_PROGRAM "$(POSTINSTALL_PROGRAM)" >>$@ - echo #endif" >>$@ echo #ifndef C_INSTALL_RC_COMPILER >>$@ echo # define C_INSTALL_RC_COMPILER "$(RC_COMPILER)" >>$@ echo #endif >>$@ @@ -222,7 +219,7 @@ endif echo # define C_TARGET_LIB_NAME "$(TARGET_LIB_NAME)" >>$@ echo #endif >>$@ echo #ifndef C_TARGET_RUN_LIB_HOME >>$@ - echo # define C_TARGET_RUN_LIB_HOME "$(TARGET_PREFIX)/lib" >>$@ + echo # define C_TARGET_RUN_LIB_HOME "$(TARGET_PREFIX)/bin" >>$@ echo #endif >>$@ echo #ifndef C_TARGET_SHARE_HOME >>$@ echo # define C_TARGET_SHARE_HOME "$(TARGET_PREFIX)/share" >>$@ @@ -254,6 +251,13 @@ endif echo #ifndef C_BINARY_VERSION >>$@ echo # define C_BINARY_VERSION $(BINARYVERSION) >>$@ echo #endif >>$@ + echo #ifndef C_USES_SONAME >>$@ +ifdef USES_SONAME + echo # define C_USES_SONAME 1 >>$@ +else + echo # define C_USES_SONAME 0 >>$@ +endif + echo #endif >>$@ echo /* END OF FILE */ >>$@ chicken-install.rc: diff --git a/csc.scm b/csc.scm index 5b3c8df..a39c3f5 100644 --- a/csc.scm +++ b/csc.scm @@ -68,7 +68,6 @@ (define mingw (eq? (build-platform) 'mingw32)) (define osx (eq? (software-version) 'macosx)) -(define win mingw) (define cygwin (eq? (build-platform) 'cygwin)) (define aix (eq? (build-platform) 'aix)) @@ -962,11 +961,9 @@ EOF (define (lib-path) (prefix "" "lib" - (if win - INSTALL_BIN_HOME - (if host-mode - INSTALL_LIB_HOME - TARGET_RUN_LIB_HOME)))) + (if host-mode + INSTALL_LIB_HOME + TARGET_RUN_LIB_HOME))) (define (target-lib-path) (let ((tdir TARGET_LIB_HOME)) @@ -981,7 +978,7 @@ EOF (target-lib-path) libchicken (cond (osx "dylib") - ((or win cygwin) "dll") + ((or mingw cygwin) "dll") (else (string-append "so." (number->string BINARY_VERSION))))))) diff --git a/defaults.make b/defaults.make index a32dfbd..8cf5dff 100644 --- a/defaults.make +++ b/defaults.make @@ -340,6 +340,9 @@ all: $(TARGETS) # generic part of chicken-config.h +# IMPORTANT: If you change anything here, remember to make a +# corresponding change in the makefiles which have +# CUSTOM_CHICKEN_DEFAULTS (currently only mingw) ifndef CUSTOM_CHICKEN_DEFAULTS chicken-defaults.h: ifdef OPTIMIZE_FOR_SPEED @@ -443,7 +446,11 @@ endif echo "# define C_TARGET_LIB_NAME \"$(TARGET_LIB_NAME)\"" >>$@ echo "#endif" >>$@ echo "#ifndef C_TARGET_RUN_LIB_HOME" >>$@ +ifdef DLLSINPATH + echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)/bin\"" >>$@ +else echo "# define C_TARGET_RUN_LIB_HOME \"$(TARGET_RUN_PREFIX)/lib\"" >>$@ +endif echo "#endif" >>$@ echo "#ifndef C_TARGET_SHARE_HOME" >>$@ echo "# define C_TARGET_SHARE_HOME \"$(TARGET_PREFIX)/share\"" >>$@ @@ -494,6 +501,7 @@ endif echo "#endif" >>$@ echo "/* END OF FILE */" >>$@ endif +# IMPORTANT: Did you read the note at the start of this Make rule? ifndef CUSTOM_RC_FILE chicken-install.rc: -- 1.7.10.4