bug-gnu-libiconv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnu-libiconv] Re: adding version identification to libiconv and lib


From: Bruno Haible
Subject: [bug-gnu-libiconv] Re: adding version identification to libiconv and libintl
Date: Sun, 27 May 2007 22:29:08 +0200
User-agent: KMail/1.5.4

Hello Perry,

> > > Attaching result of diff -r -u3 --unidirectional-new-file
> Here it is.

Thanks for the preparatory work. Find attached the patch that I'm adding
to GNU libiconv.

The two major simplifications that I did, compared to your code, were:
  - Realize that 'windres' already preprocesses the file, therefore an
    extra preprocessing from .rc.in to .rc is not needed - it can be
    integrated into the 'windres' processing.
  - Use 'sed' instead of 'grep' and 'cut' for extracting the portions of
    the version numbers.

Regarding the "-O coff": I would have been stuck if you hadn't eliminated
this problem for me. Thanks!


2007-05-27  Bruno Haible  <address@hidden>

        * windows/libiconv.rc: New file.
        * windows/iconv.rc: New file.
        * windows/windres-options: New file.
        * configure.ac (WOE32): New variable.
        (WINDRES) [WOE32]: New variable.
        * lib/Makefile.in (WINDRES): New variable.
        (PACKAGE_VERSION): New variable.
        (OBJECTS_EXP_yes): Renamed from OBJECTS_yes.
        (OBJECTS_EXP_no): Renamed from OBJECTS_no.
        (OBJECTS_RES_yes, OBJECTS_RES_no): New variables.
        (OBJECTS): Add one of them.
        (libiconv.res): New rule.
        (clean): Remove also libiconv.res.
        * src/Makefile.in (WINDRES): New variable.
        (PACKAGE_VERSION): New variable.
        (OBJECTS_RES_yes, OBJECTS_RES_no): New variables.
        (all, iconv_no_i18n, install): Use them.
        (iconv.res): New rule.
        (clean): Remove also iconv.res.
        Suggested and inspired by work by Perry Rapp.

*** configure.ac        31 Mar 2007 16:11:20 -0000      1.17
--- configure.ac        27 May 2007 20:05:25 -0000
***************
*** 160,165 ****
--- 160,178 ----
  fi
  AC_SUBST([DLL_VARIABLE])
  
+ dnl On mingw and Cygwin, we can activate special Makefile rules which add
+ dnl version information to the shared libraries and executables.
+ case "$host_os" in
+   mingw* | cygwin*) is_woe32=yes ;;
+   *) is_woe32=no ;;
+ esac
+ WOE32=$is_woe32
+ AC_SUBST([WOE32])
+ if test $WOE32 = yes; then
+   dnl Check for a program that compiles Windows resource files.
+   AC_CHECK_TOOL([WINDRES], [windres])
+ fi
+ 
  AH_BOTTOM([
  /* On Windows, variables that may be in a DLL must be marked specially.  */
  #if defined _MSC_VER && defined _DLL
*** lib/Makefile.in     20 Mar 2007 01:55:33 -0000      1.34
--- lib/Makefile.in     27 May 2007 20:05:25 -0000
***************
*** 30,35 ****
--- 30,36 ----
  LIBTOOL_LINK = $(LIBTOOL) --mode=link
  LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
  LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
+ WINDRES = @WINDRES@
  CP = cp
  MV = mv
  LN = @LN@
***************
*** 50,63 ****
  # section "Library interface versions".
  LIBICONV_VERSION_INFO = 6:0:4
  
  # Needed by $(LIBTOOL).
  top_builddir = ..
  
  SOURCES = $(srcdir)/iconv.c $(srcdir)/../libcharset/lib/localcharset.c 
$(srcdir)/relocatable.c
  
! OBJECTS = iconv.lo localcharset.lo relocatable.lo $(address@hidden@)
! OBJECTS_yes = iconv-exports.lo
! OBJECTS_no =
  
  all : @PLUGLIB@ libiconv.la
  
--- 51,68 ----
  # section "Library interface versions".
  LIBICONV_VERSION_INFO = 6:0:4
  
+ PACKAGE_VERSION = @VERSION@
+ 
  # Needed by $(LIBTOOL).
  top_builddir = ..
  
  SOURCES = $(srcdir)/iconv.c $(srcdir)/../libcharset/lib/localcharset.c 
$(srcdir)/relocatable.c
  
! OBJECTS = iconv.lo localcharset.lo relocatable.lo $(address@hidden@) 
$(address@hidden@)
! OBJECTS_EXP_yes = iconv-exports.lo
! OBJECTS_EXP_no =
! OBJECTS_RES_yes = libiconv.res
! OBJECTS_RES_no =
  
  all : @PLUGLIB@ libiconv.la
  
***************
*** 106,111 ****
--- 111,119 ----
  iconv-exports.lo : $(srcdir)/../woe32dll/iconv-exports.c
        $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(DEFS) -c 
$(srcdir)/../woe32dll/iconv-exports.c
  
+ libiconv.res : $(srcdir)/../windows/libiconv.rc
+       $(WINDRES) `$(SHELL) $(srcdir)/../windows/windres-options --escape 
$(PACKAGE_VERSION)` -i $< -o $@ --output-format=coff
+ 
  # Installs the library and include files only. Typically called with only
  # $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here.
  install-lib : all force
***************
*** 140,146 ****
  mostlyclean : clean
  
  clean : force
!       $(RM) *.o *.lo *.a *.la preloadable_libiconv* core *.stackdump 
so_locations
        $(RM) -r .libs _libs
  
  distclean : clean
--- 148,154 ----
  mostlyclean : clean
  
  clean : force
!       $(RM) *.o *.lo libiconv.res *.a *.la preloadable_libiconv* core 
*.stackdump so_locations
        $(RM) -r .libs _libs
  
  distclean : clean
*** src/Makefile.in     20 Mar 2007 01:55:33 -0000      1.36
--- src/Makefile.in     27 May 2007 20:05:30 -0000
***************
*** 27,32 ****
--- 27,33 ----
  LIBTOOL_LINK = $(LIBTOOL) --mode=link
  LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
  LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
+ WINDRES = @WINDRES@
  RM = rm -f
  @SET_MAKE@
  
***************
*** 40,51 ****
--- 41,57 ----
  
  SHELL = /bin/sh
  
+ PACKAGE_VERSION = @VERSION@
+ 
  # Needed by $(LIBTOOL).
  top_builddir = ..
  
  # Needed by SET_RELOCATABLE.
  EXEEXT = @EXEEXT@
  
+ OBJECTS_RES_yes = iconv.res
+ OBJECTS_RES_no =
+ 
  # We cannot link with libintl until libiconv is installed. (When we call
  # libtool with arguments "../lib/libiconv.la -lintl", libtool will call ld
  # with "../lib/.libs/libiconv.so $libdir/libintl.so $libdir/libiconv.so",
***************
*** 56,67 ****
  # i.e. during "make install". The intermediate 'iconv' executable is built
  # without internationalization and not linked with libintl.
  
! all : iconv_no_i18n address@hidden@
        test `ls -ld . | sed -e 's/^d\(.........\).*/\1/'` = rwxrwxrwx || chmod 
777 .
  
  # This is the temporary iconv executable, without internationalization.
! iconv_no_i18n : address@hidden@ ../lib/libiconv.la
!       $(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(CFLAGS) address@hidden@ 
../srclib/libicrt.a ../lib/libiconv.la -o $@
  
  address@hidden@ : $(srcdir)/iconv_no_i18n.c $(srcdir)/iconv.c
        $(CC) -c $(INCLUDES) -I../lib $(CFLAGS) $(CPPFLAGS) 
-DINSTALLDIR=\"$(bindir)\" -DLOCALEDIR=\"$(localedir)\" 
$(srcdir)/iconv_no_i18n.c
--- 62,73 ----
  # i.e. during "make install". The intermediate 'iconv' executable is built
  # without internationalization and not linked with libintl.
  
! all : iconv_no_i18n address@hidden@ $(address@hidden@)
        test `ls -ld . | sed -e 's/^d\(.........\).*/\1/'` = rwxrwxrwx || chmod 
777 .
  
  # This is the temporary iconv executable, without internationalization.
! iconv_no_i18n : address@hidden@ ../lib/libiconv.la $(address@hidden@)
!       $(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(CFLAGS) address@hidden@ 
../srclib/libicrt.a ../lib/libiconv.la $(address@hidden@) -o $@
  
  address@hidden@ : $(srcdir)/iconv_no_i18n.c $(srcdir)/iconv.c
        $(CC) -c $(INCLUDES) -I../lib $(CFLAGS) $(CPPFLAGS) 
-DINSTALLDIR=\"$(bindir)\" -DLOCALEDIR=\"$(localedir)\" 
$(srcdir)/iconv_no_i18n.c
***************
*** 69,74 ****
--- 75,83 ----
  address@hidden@ : $(srcdir)/iconv.c
        $(CC) -c $(INCLUDES) -I../lib $(CFLAGS) $(CPPFLAGS) 
-DINSTALLDIR=\"$(bindir)\" -DLOCALEDIR=\"$(localedir)\" $(srcdir)/iconv.c
  
+ iconv.res : $(srcdir)/../windows/iconv.rc
+       $(WINDRES) `$(SHELL) $(srcdir)/../windows/windres-options --escape 
$(PACKAGE_VERSION)` -i $< -o $@ --output-format=coff
+ 
  # The following rule is necessary to avoid a toplevel "make -n check" failure.
  ../lib/libiconv.la :
        cd ../lib && $(MAKE) libiconv.la
***************
*** 94,101 ****
  install : all force
        if [ ! -d $(DESTDIR)$(bindir) ] ; then $(mkinstalldirs) 
$(DESTDIR)$(bindir) ; fi
        case "@host_os@" in \
!         hpux*) $(CC) $(LDFLAGS) $(CFLAGS) $(iconv_LDFLAGS) address@hidden@ 
../srclib/libicrt.a -L$(DESTDIR)$(libdir) -liconv @LIBINTL@ `if test -n 
'$(DESTDIR)'; then echo " -Wl,+b -Wl,$(libdir)"; fi` -o iconv;; \
!         *) $(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(CFLAGS) $(iconv_LDFLAGS) 
address@hidden@ ../srclib/libicrt.a $(DESTDIR)$(libdir)/libiconv.la @LTLIBINTL@ 
-o iconv;; \
        esac
        $(INSTALL_PROGRAM_ENV) $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) iconv 
$(DESTDIR)$(bindir)/iconv
  
--- 103,110 ----
  install : all force
        if [ ! -d $(DESTDIR)$(bindir) ] ; then $(mkinstalldirs) 
$(DESTDIR)$(bindir) ; fi
        case "@host_os@" in \
!         hpux*) $(CC) $(LDFLAGS) $(CFLAGS) $(iconv_LDFLAGS) address@hidden@ 
../srclib/libicrt.a -L$(DESTDIR)$(libdir) -liconv @LIBINTL@ $(address@hidden@) 
`if test -n '$(DESTDIR)'; then echo " -Wl,+b -Wl,$(libdir)"; fi` -o iconv;; \
!         *) $(LIBTOOL_LINK) $(CC) $(LDFLAGS) $(CFLAGS) $(iconv_LDFLAGS) 
address@hidden@ ../srclib/libicrt.a $(DESTDIR)$(libdir)/libiconv.la @LTLIBINTL@ 
$(address@hidden@) -o iconv;; \
        esac
        $(INSTALL_PROGRAM_ENV) $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) iconv 
$(DESTDIR)$(bindir)/iconv
  
***************
*** 110,116 ****
  mostlyclean : clean
  
  clean : force
!       $(RM) address@hidden@ *.lo iconv_no_i18n iconv_no_i18n$(EXEEXT) 
iconv$(EXEEXT) core *.stackdump
        $(RM) -r .libs _libs
  
  distclean : clean
--- 119,125 ----
  mostlyclean : clean
  
  clean : force
!       $(RM) address@hidden@ *.lo iconv.res iconv_no_i18n 
iconv_no_i18n$(EXEEXT) iconv$(EXEEXT) core *.stackdump
        $(RM) -r .libs _libs
  
  distclean : clean





reply via email to

[Prev in Thread] Current Thread [Next in Thread]