1 |
On Fri, Aug 03, 2018 at 08:25:28AM +0200, Michał Górny wrote: |
2 |
> W dniu pią, 03.08.2018 o godzinie 00∶09 -0500, użytkownik Marty E. |
3 |
> Plummer napisał: |
4 |
> > Signed-off-by: Marty E. Plummer <hanetzer@×××××××××.com> |
5 |
> > --- |
6 |
> > |
7 |
> > On mingw-w64 (and perhaps cygwin and mingw.org), there are two forms of |
8 |
> > non-static libraries. Standard *.dll libraries are for runtime and are |
9 |
> > loaded from %PATH% on windows systems, and are typically stored in |
10 |
> > either /bin or /usr/bin on mingw-w64 cross-toolchain filesystems. Import |
11 |
> > libraries, *.dll.a, are used when linking and live in the ''normal'' |
12 |
> > libdirs, eg, /lib, /usr/lib and so on. |
13 |
> > |
14 |
> > A number of ebuilds which otherwise work on mingw-w64 crossdev |
15 |
> > toolchains exhibit failure due to usage of get_libname not being able to |
16 |
> > specify which of the two types are required. |
17 |
> > |
18 |
> > For example, sys-libs/ncurses, uses the following snippet of code: |
19 |
> > ln -sf libncurses$(get_libname) "${ED}"/usr/$(get_libdir)/libcurses$(get_libname) || die |
20 |
> > in order to create a 'libcurses.so -> libncurses.so' symlink. |
21 |
> > |
22 |
> > However, on a crossdev-built mingw-w64 toolchain, one will end up with a |
23 |
> > broken 'libcurses.dll -> libncurses.dll' symlink, which should properly |
24 |
> > be a 'libcurses.dll.a -> libncurses.dll.a' symlink, as the symlink here |
25 |
> > is provided to allow linking with -lcurses instead of -lncurses. |
26 |
> > |
27 |
> > eclass/multilib.eclass | 52 ++++++++++++++++++++++++++++++++++++++---- |
28 |
> > 1 file changed, 48 insertions(+), 4 deletions(-) |
29 |
> > |
30 |
> > diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass |
31 |
> > index 350b6f949d1..6a99f5977ec 100644 |
32 |
> > --- a/eclass/multilib.eclass |
33 |
> > +++ b/eclass/multilib.eclass |
34 |
> > @@ -239,26 +239,70 @@ get_exeext() { |
35 |
> > } |
36 |
> > |
37 |
> > # @FUNCTION: get_libname |
38 |
> > -# @USAGE: [version] |
39 |
> > +# @USAGE: --link|--run [version] |
40 |
> |
41 |
> It's optional, so it should go into square brackets. |
42 |
> |
43 |
True, it's optional for most platforms, but should be explicit on |
44 |
ebuilds which are relevant to the 'wierd' ones. |
45 |
> > # @DESCRIPTION: |
46 |
> > # Returns libname with proper suffix {.so,.dylib,.dll,etc} and optionally |
47 |
> > # supplied version for the current platform identified by CHOST. |
48 |
> > # |
49 |
> > +# If '--link' argument is passed, the linktime library's suffix is returned, |
50 |
> > +# as in the file that must exist to let `gcc -lfoo foo.c -o foo` to work. |
51 |
> > +# If '--run' argument is passed, the runtime library's suffix is returned. |
52 |
> |
53 |
> '...as the first argument'. If order matters, make sure to explicitly |
54 |
> specify that. |
55 |
> |
56 |
Yeah, that will need to go first because of the arg parse code I used. |
57 |
Will add that. |
58 |
> > +# |
59 |
> > +# In most unix-like platforms the two are identical, however on mingw-w64 the |
60 |
> > +# linktime library has the suffix of '.dll.a' and the runtime library '.dll'. |
61 |
> |
62 |
> Also, you want to explicitly specify what happens if neither is passed. |
63 |
> |
64 |
The intent is that for every ebuild which makes sense for |
65 |
windows/cygwin/etc it has to be passed, and in which case it errors out |
66 |
for the weirdos like me to file a bug/patch/pr to get the correct |
67 |
behavior. For instance, I'm highly doubting anyone is going to be able |
68 |
to use sys-cluster/gasnet on windows or the like, so it can stay as is, |
69 |
but other libraries are going to have hella issue based on the |
70 |
difference between a dll and dll.a, and should be specified. |
71 |
> > +# |
72 |
> > # Example: |
73 |
> > # get_libname ${PV} |
74 |
> > # Returns: .so.${PV} (ELF) || .${PV}.dylib (MACH) || ... |
75 |
> > +# get_libname --link |
76 |
> > +# Returns: .so (ELF) || .dylib (MACH) || .dll.a (PE32) || ... |
77 |
> > get_libname() { |
78 |
> > - local libname |
79 |
> > - local ver=$1 |
80 |
> > + local libtype="undefined" |
81 |
> > + local libname opt ver |
82 |
> > + for opt; do |
83 |
> > + case "${opt}" in |
84 |
> > + --link) |
85 |
> > + libtype="link" |
86 |
> > + shift |
87 |
> > + ;; |
88 |
> > + --run) |
89 |
> > + libtype="run" |
90 |
> > + shift |
91 |
> > + ;; |
92 |
> > + *) |
93 |
> > + ;; |
94 |
> > + esac |
95 |
> > + done |
96 |
> > + ver="$1" |
97 |
> |
98 |
> + # general unixy types |
99 |
> > case ${CHOST} in |
100 |
> > *-cygwin*) libname="dll.a";; # import lib |
101 |
> > - mingw*|*-mingw*) libname="dll";; |
102 |
> > *-darwin*) libname="dylib";; |
103 |
> > *-mint*) libname="irrelevant";; |
104 |
> > hppa*-hpux*) libname="sl";; |
105 |
> > *) libname="so";; |
106 |
> > esac |
107 |
> > |
108 |
> > + # wierd mingw-w64 stuff, maybe even cygwin |
109 |
> > + case ${CHOST} in |
110 |
> > + mingw*|*-mingw*) |
111 |
> > + case ${libtype} in |
112 |
> > + link) |
113 |
> > + libname="dll.a" # import library |
114 |
> > + ;; |
115 |
> > + run) |
116 |
> > + libname="dll" # runtime library |
117 |
> > + ;; |
118 |
> > + undefined) |
119 |
> > + eerror "please specify either --link or --run to get_libname" |
120 |
> > + eerror "for mingw builds, as there are two types of libraries" |
121 |
> > + eerror "on this platform" |
122 |
> > + die |
123 |
> > + ;; |
124 |
> > + esac |
125 |
> > + ;; |
126 |
> > + esac |
127 |
> > + |
128 |
> > if [[ -z $* ]] ; then |
129 |
> > echo ".${libname}" |
130 |
> > else |
131 |
> |
132 |
> -- |
133 |
> Best regards, |
134 |
> Michał Górny |