[PATCH, take 4][cygwin|mingw] Control where win32 DLLs get installed.
So, here I hope is the final respin. Built and tested on i686-pc-cygwin and i686-pc-linux-gnu with no regressions and all new tests passing (see below sig separator for details). libtool/ChangeLog: * Makefile.am (TESTSUITE_AT): Add bindir.at. * libltdl/config/general.m4sh (func_normal_abspath): New function. (func_relative_path): Likewise. * libltdl/config/ltmain.m4sh (func_mode_link): Accept new -bindir option and use it, if supplied, to place Windows DLLs. * tests/bindir.at: New file for DLL install tests. * doc/libtool.texi (Link Mode): Update documentation. Unless I've missed anything? cheers, DaveK -- $ ./libltdl/config/config.guess i686-pc-cygwin $ uname -a CYGWIN_NT-5.0 ubik 1.7.0(0.212/5/3) 2009-08-12 20:18 i686 Cygwin == All 122 tests passed (2 tests were not run) == ## - ## ## Test results. ## ## - ## 85 tests behaved as expected. 6 tests were skipped. -- $ uname -a Linux ubique.localdomain 2.6.27.21-170.2.56.fc10.i686 #1 SMP Mon Mar 23 23:37:54 EDT 2009 i686 athlon i386 GNU/Linux $ ./libltdl/config/config.guess i686-pc-linux-gnu All 124 tests passed ## - ## ## Test results. ## ## - ## 89 tests behaved as expected. 2 tests were skipped. diff --git a/Makefile.am b/Makefile.am index a18955e..d68ed33 100644 --- a/Makefile.am +++ b/Makefile.am @@ -468,6 +468,7 @@ TESTSUITE_AT = tests/testsuite.at \ tests/indirect_deps.at \ tests/archive-in-archive.at \ tests/execute-mode.at \ + tests/bindir.at \ tests/cwrapper.at \ tests/infer-tag.at \ tests/localization.at \ diff --git a/doc/libtool.texi b/doc/libtool.texi index a7872c6..f862217 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -1376,6 +1376,18 @@ Tries to avoid versioning (@pxref{Versioning}) for libraries and modules, i.e.@: no version information is stored and no symbolic links are created. If the platform requires versioning, this option has no effect. +...@item -bindir +Pass the absolute name of the directory for installing executable +programs (@pxref{Directory Variables, , Directory Variables, standards, +The GNU Coding Standards}). @command{libtool} may use this value to +install shared libraries there on systems that do not provide for any +library hardcoding and use the directory of a program and the @env{PATH} +variable as library search path. This is typically used for DLLs on +Windows or other systems using the PE (Portable Executable) format. +On other systems, @option{-bindir} is ignored. The default value used +is @fi...@var{libdir}/../bin} for libraries installed to +...@file{@var{libdir}}. You should not use @option{-bindir} for modules. + @item -dlopen @var{file} Same as @option{-dlpreopen @var{file}}, if native dlopening is not supported on the host platform (@pxref{Dlopened modules}) or if @@ -1460,7 +1472,12 @@ the @option{-version-info} flag instead (@pxref{Versioning}). @item -rpath @var{libdir} If @var{output-file} is a library, it will eventually be installed in @var{libdir}. If @var{output-file} is a program, add @var{libdir} to -the run-time path of the program. +the run-time path of the program. On platforms that don't support +hardcoding library paths into executables and only search PATH for +shared libraries, such as when @var{output-file} is a Windows (or +other PE platform) DLL, the @samp{.la} control file will be installed in +...@var{libdir}, but see @option{-bindir} above for the eventual destination +of the @samp{.dll} or other library file itself. @item -R @var{libdir} If @var{output-file} is a program, add @var{libdir} to its run-time diff --git a/libltdl/config/general.m4sh b/libltdl/config/general.m4sh index 4bc304c..9954057 100644 --- a/libltdl/config/general.m4sh +++ b/libltdl/config/general.m4sh @@ -100,6 +100,149 @@ func_dirname_and_basename () # Generated shell functions inserted here. +pathcar="s,^/\([^/]*\).*$,\1," +pathcdr="s,^/[^/]*,," +removedotparts="s,/\(\.\(/\|$\)\)\+,/,g" +collapseslashes="s,/\+,/,g" + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in +"") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return +;; +# The next three entries are used to spot a run of precisely +# two leading slashes without using negated character classes; +# we take advantage of case's first-match behaviour. +///*) +
Re: [PATCH, take 3][cygwin|mingw] Control where win32 DLLs get installed.
Ralf Wildenhues wrote: > in addition to what Eric already documented: > > * Dave Korn wrote on Fri, Aug 14, 2009 at 01:34:18PM CEST: >> Still finishing it off and getting it tested, but while that's going, >> here's >> a preview of the path canonicalisation function as I've got it so far; let me >> know if I've done any major no-nos please! > > Do you cope with paths starting with // (these can be special on Cygwin, > you may not remove the second / in that case)? (If anything, this is > only a rather minor no-no however, and I have no idea whether we treat > it consistently elsewhere in libtool.) Hah. I collapse them of course. Doh. I'll see how I can preserve them. The other possible problem is DOS-style paths. I don't know if libtool is supposed to handle them or not. It certainly looks like func_dirname_and_basename would fall down badly on them, but I don't know if that's just a happenstance of the way it got autogenerated on my platform where they aren't used? I couldn't find anything in the manual referring to drive letters. >> # func_normal_abspath path > > Capitalize PATH here, please. Maybe also s/PATH/FILE/ throughout the > comment, to avoid mistaking it with the $PATH environment variable? Will take the latter option. >> # Remove doubled-up and trailing slashes, "." path components, >> # and cancel out any ".." path components in PATH. >> # value returned in "$func_normal_abspath_result" > > Missing a statement that an absolute path is returned, that would be > nice. Will add. (The name of the function is supposed to be a hint, but it can't hurt to be explicit!) > One would hope for a followup patch that factorizes all the forks > in this function for SUSv3 shells that provide ${var##...} etc. > Otherwise, if this function is used more than once per libtool > invocation, it will be a major speed bump in a typical build. > (IOW, you don't need to address this, but it ought to be looked at; > I might do it sometime.) Thanks, I still haven't learned all the internal structure of libtool and wouldn't know how to do that without a bunch more research. Respin is nearly complete now, just these minor tweaks to get through and give it some testing. More later. cheers, DaveK
Re: [PATCH, take 3][cygwin|mingw] Control where win32 DLLs get installed.
Ralf Wildenhues wrote: > , and the info Autoconf "Portable Shell" Yes, thanks, I've been thoroughly through that since someone metioned it upthread and it does in fact document all these rules, under the individual categories like "assignments", "case statements", rather than in one big section called "quoting", but it's all there. > Paul Jarc's lintsh That's a new one on me, I'll go googling. Ta! cheers, DaveK
Re: [PATCH, take 3][cygwin|mingw] Control where win32 DLLs get installed.
in addition to what Eric already documented: * Dave Korn wrote on Fri, Aug 14, 2009 at 01:34:18PM CEST: > > Still finishing it off and getting it tested, but while that's going, here's > a preview of the path canonicalisation function as I've got it so far; let me > know if I've done any major no-nos please! Do you cope with paths starting with // (these can be special on Cygwin, you may not remove the second / in that case)? (If anything, this is only a rather minor no-no however, and I have no idea whether we treat it consistently elsewhere in libtool.) > pathcar="s,^/\([^/]*\).*$,\1," > pathcdr="s,^/[^/]*,," > removedotparts="s,/\(\.\(/\|$\)\)\+,/,g" > collapseslashes="s,/\+,/,g" > > # func_normal_abspath path Capitalize PATH here, please. Maybe also s/PATH/FILE/ throughout the comment, to avoid mistaking it with the $PATH environment variable? > # Remove doubled-up and trailing slashes, "." path components, > # and cancel out any ".." path components in PATH. > # value returned in "$func_normal_abspath_result" Missing a statement that an absolute path is returned, that would be nice. One would hope for a followup patch that factorizes all the forks in this function for SUSv3 shells that provide ${var##...} etc. Otherwise, if this function is used more than once per libtool invocation, it will be a major speed bump in a typical build. (IOW, you don't need to address this, but it ought to be looked at; I might do it sometime.) Cheers, Ralf
Re: [PATCH, take 3][cygwin|mingw] Control where win32 DLLs get installed.
* Dave Korn wrote on Fri, Aug 14, 2009 at 03:21:33PM CEST: > Eric Blake wrote: > > And beyond that, it's just lots of practice. I agree that it often feels > > like you have to memorize loads of information to write portable shell, > > but at least these public reviews catch a lot of the pitfalls. > > Your cheat sheet will come in very handy :) Thanks! Forget the bash manual. Read the SUSv3 man pages for sh etc., and the info Autoconf "Portable Shell" chapter, plus maybe Paul Jarc's lintsh, and you're mostly set. We try hard to document the deviations from Posix in autoconf.texi. Cheers, Ralf