[3/3] mingw: Only install the DLL with the major version number

Message ID 1310021290-77683-3-git-send-email-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö July 7, 2011, 6:48 a.m.
The DLL without a version number in the file name, and the one
with the full version, aren't used in practice on windows.
---
 configure  |    5 +++++
 subdir.mak |    7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

Comments

Diego Biurrun July 7, 2011, 8 a.m. | #1
On Thu, Jul 07, 2011 at 09:48:10AM +0300, Martin Storsjö wrote:
> The DLL without a version number in the file name, and the one
> with the full version, aren't used in practice on windows.
> 
> --- a/configure
> +++ b/configure
> @@ -2426,6 +2426,8 @@ case $target_os in
>          SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
> +        slib_major_only=yes
> +        skip_unversioned_slib=yes
>          objformat="win32"
> @@ -3244,6 +3246,9 @@ SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
>  SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
>  SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
> +SLIB_MAJOR_ONLY=$(test "$slib_major_only" = "yes" && echo "" || echo "@\#")
> +SLIB_FULL_VERSION=$(test "$slib_major_only" = "yes" && echo "@\#" || echo "")
> +SLIB_INSTALL_UNVERSIONED=$(test "$skip_unversioned_slib" = "yes" && echo "@\#" || echo "")
>  SAMPLES:=${samples:-\$(FATE_SAMPLES)}

something like

  slib_major_only='#'
  SLIB_MAJOR_ONLY=$slib_major_only

should do the trick as well.

That said, this patch is not exactly a beauty in any case.

Diego
Martin Storsjö July 7, 2011, 8:05 a.m. | #2
On Thu, 7 Jul 2011, Diego Biurrun wrote:

> On Thu, Jul 07, 2011 at 09:48:10AM +0300, Martin Storsjö wrote:
> > The DLL without a version number in the file name, and the one
> > with the full version, aren't used in practice on windows.
> > 
> > --- a/configure
> > +++ b/configure
> > @@ -2426,6 +2426,8 @@ case $target_os in
> >          SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
> > +        slib_major_only=yes
> > +        skip_unversioned_slib=yes
> >          objformat="win32"
> > @@ -3244,6 +3246,9 @@ SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
> >  SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
> >  SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
> > +SLIB_MAJOR_ONLY=$(test "$slib_major_only" = "yes" && echo "" || echo "@\#")
> > +SLIB_FULL_VERSION=$(test "$slib_major_only" = "yes" && echo "@\#" || echo "")
> > +SLIB_INSTALL_UNVERSIONED=$(test "$skip_unversioned_slib" = "yes" && echo "@\#" || echo "")
> >  SAMPLES:=${samples:-\$(FATE_SAMPLES)}
> 
> something like
> 
>   slib_major_only='#'
>   SLIB_MAJOR_ONLY=$slib_major_only
> 
> should do the trick as well.

Perhaps yes, but you still need two variables in config.mak - to exclude 
either of the install commands in the makefile, where one of them is @# 
and the other one is empty (SLIB_MAJOR_ONLY and SLIB_FULL_VERSION in my 
patch).

// Martin
Martin Storsjö July 7, 2011, 7:11 p.m. | #3
On Thu, 7 Jul 2011, Martin Storsjö wrote:

> On Thu, 7 Jul 2011, Diego Biurrun wrote:
> 
> > On Thu, Jul 07, 2011 at 09:48:10AM +0300, Martin Storsjö wrote:
> > > The DLL without a version number in the file name, and the one
> > > with the full version, aren't used in practice on windows.
> > > 
> > > --- a/configure
> > > +++ b/configure
> > > @@ -2426,6 +2426,8 @@ case $target_os in
> > >          SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
> > > +        slib_major_only=yes
> > > +        skip_unversioned_slib=yes
> > >          objformat="win32"
> > > @@ -3244,6 +3246,9 @@ SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
> > >  SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
> > >  SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
> > > +SLIB_MAJOR_ONLY=$(test "$slib_major_only" = "yes" && echo "" || echo "@\#")
> > > +SLIB_FULL_VERSION=$(test "$slib_major_only" = "yes" && echo "@\#" || echo "")
> > > +SLIB_INSTALL_UNVERSIONED=$(test "$skip_unversioned_slib" = "yes" && echo "@\#" || echo "")
> > >  SAMPLES:=${samples:-\$(FATE_SAMPLES)}
> > 
> > something like
> > 
> >   slib_major_only='#'
> >   SLIB_MAJOR_ONLY=$slib_major_only
> > 
> > should do the trick as well.
> 
> Perhaps yes, but you still need two variables in config.mak - to exclude 
> either of the install commands in the makefile, where one of them is @# 
> and the other one is empty (SLIB_MAJOR_ONLY and SLIB_FULL_VERSION in my 
> patch).

These three patches are dropped, thanks to Måns' patch fixing it in a much 
cleaner way.

// Martin

Patch

diff --git a/configure b/configure
index 0fa2db5..1ae2ae9 100755
--- a/configure
+++ b/configure
@@ -2426,6 +2426,8 @@  case $target_os in
             install $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def) "$(LIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)"'
         SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
         SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
+        slib_major_only=yes
+        skip_unversioned_slib=yes
         objformat="win32"
         dlltool="${cross_prefix}dlltool"
         enable dos_paths
@@ -3244,6 +3246,9 @@  SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
 SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
 SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
 SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
+SLIB_MAJOR_ONLY=$(test "$slib_major_only" = "yes" && echo "" || echo "@\#")
+SLIB_FULL_VERSION=$(test "$slib_major_only" = "yes" && echo "@\#" || echo "")
+SLIB_INSTALL_UNVERSIONED=$(test "$skip_unversioned_slib" = "yes" && echo "@\#" || echo "")
 SAMPLES:=${samples:-\$(FATE_SAMPLES)}
 EOF
 
diff --git a/subdir.mak b/subdir.mak
index e7c9eaa..8e840b1 100644
--- a/subdir.mak
+++ b/subdir.mak
@@ -56,10 +56,11 @@  distclean:: clean
 
 install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
 	$(Q)mkdir -p "$(SHLIBDIR)"
-	$$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
-	$(Q)cd "$(SHLIBDIR)" && \
+	$(SLIB_FULL_VERSION)$$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
+	$(SLIB_FULL_VERSION)$(Q)cd "$(SHLIBDIR)" && \
 		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
-	$(Q)cd "$(SHLIBDIR)" && \
+	$(SLIB_MAJOR_ONLY)$$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)"
+	$(SLIB_INSTALL_UNVERSIONED)$(Q)cd "$(SHLIBDIR)" && \
 		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
 	$(SLIB_INSTALL_EXTRA_CMD)