On Fri, Aug 03, 2018 at 08:25:28AM +0200, Michał Górny wrote:
> W dniu pią, 03.08.2018 o godzinie 00∶09 -0500, użytkownik Marty E.
> Plummer napisał:
> > Signed-off-by: Marty E. Plummer <hanet...@startmail.com>
> > ---
> > 
> > On mingw-w64 (and perhaps cygwin and mingw.org), there are two forms of
> > non-static libraries. Standard *.dll libraries are for runtime and are
> > loaded from %PATH% on windows systems, and are typically stored in
> > either /bin or /usr/bin on mingw-w64 cross-toolchain filesystems. Import
> > libraries, *.dll.a, are used when linking and live in the ''normal''
> > libdirs, eg, /lib, /usr/lib and so on.
> > 
> > A number of ebuilds which otherwise work on mingw-w64 crossdev
> > toolchains exhibit failure due to usage of get_libname not being able to
> > specify which of the two types are required.
> > 
> > For example, sys-libs/ncurses, uses the following snippet of code:
> > ln -sf libncurses$(get_libname) 
> > "${ED}"/usr/$(get_libdir)/libcurses$(get_libname) || die
> > in order to create a 'libcurses.so -> libncurses.so' symlink.
> > 
> > However, on a crossdev-built mingw-w64 toolchain, one will end up with a
> > broken 'libcurses.dll -> libncurses.dll' symlink, which should properly
> > be a 'libcurses.dll.a -> libncurses.dll.a' symlink, as the symlink here
> > is provided to allow linking with -lcurses instead of -lncurses.
> > 
> >  eclass/multilib.eclass | 52 ++++++++++++++++++++++++++++++++++++++----
> >  1 file changed, 48 insertions(+), 4 deletions(-)
> > 
> > diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass
> > index 350b6f949d1..6a99f5977ec 100644
> > --- a/eclass/multilib.eclass
> > +++ b/eclass/multilib.eclass
> > @@ -239,26 +239,70 @@ get_exeext() {
> >  }
> >  
> >  # @FUNCTION: get_libname
> > -# @USAGE: [version]
> > +# @USAGE: --link|--run [version]
> 
> It's optional, so it should go into square brackets.
> 
True, it's optional for most platforms, but should be explicit on
ebuilds which are relevant to the 'wierd' ones.
> >  # @DESCRIPTION:
> >  # Returns libname with proper suffix {.so,.dylib,.dll,etc} and optionally
> >  # supplied version for the current platform identified by CHOST.
> >  #
> > +# If '--link' argument is passed, the linktime library's suffix is 
> > returned,
> > +# as in the file that must exist to let `gcc -lfoo foo.c -o foo` to work.
> > +# If '--run' argument is passed, the runtime library's suffix is returned.
> 
> '...as the first argument'.  If order matters, make sure to explicitly
> specify that.
> 
Yeah, that will need to go first because of the arg parse code I used.
Will add that.
> > +#
> > +# In most unix-like platforms the two are identical, however on mingw-w64 
> > the
> > +# linktime library has the suffix of '.dll.a' and the runtime library 
> > '.dll'.
> 
> Also, you want to explicitly specify what happens if neither is passed.
> 
The intent is that for every ebuild which makes sense for
windows/cygwin/etc it has to be passed, and in which case it errors out
for the weirdos like me to file a bug/patch/pr to get the correct
behavior. For instance, I'm highly doubting anyone is going to be able
to use sys-cluster/gasnet on windows or the like, so it can stay as is,
but other libraries are going to have hella issue based on the
difference between a dll and dll.a, and should be specified.
> > +#
> >  # Example:
> >  #     get_libname ${PV}
> >  #     Returns: .so.${PV} (ELF) || .${PV}.dylib (MACH) || ...
> > +#     get_libname --link
> > +#     Returns: .so (ELF) || .dylib (MACH) || .dll.a (PE32) || ...
> >  get_libname() {
> > -   local libname
> > -   local ver=$1
> > +   local libtype="undefined"
> > +   local libname opt ver
> > +   for opt; do
> > +           case "${opt}" in
> > +                   --link)
> > +                           libtype="link"
> > +                           shift
> > +                           ;;
> > +                   --run)
> > +                           libtype="run"
> > +                           shift
> > +                           ;;
> > +                   *)
> > +                           ;;
> > +           esac
> > +   done
> > +   ver="$1"
> 
> +     # general unixy types
> >     case ${CHOST} in
> >             *-cygwin*)       libname="dll.a";; # import lib
> > -           mingw*|*-mingw*) libname="dll";;
> >             *-darwin*)       libname="dylib";;
> >             *-mint*)         libname="irrelevant";;
> >             hppa*-hpux*)     libname="sl";;
> >             *)               libname="so";;
> >     esac
> >  
> > +   # wierd mingw-w64 stuff, maybe even cygwin
> > +   case ${CHOST} in
> > +           mingw*|*-mingw*)
> > +                   case ${libtype} in
> > +                           link)
> > +                                   libname="dll.a" # import library
> > +                                   ;;
> > +                           run)
> > +                                   libname="dll" # runtime library
> > +                                   ;;
> > +                           undefined)
> > +                                   eerror "please specify either --link or 
> > --run to get_libname"
> > +                                   eerror "for mingw builds, as there are 
> > two types of libraries"
> > +                                   eerror "on this platform"
> > +                                   die
> > +                                   ;;
> > +                   esac
> > +                   ;;
> > +   esac
> > +
> >     if [[ -z $* ]] ; then
> >             echo ".${libname}"
> >     else
> 
> -- 
> Best regards,
> Michał Górny



Reply via email to