1 |
Just wondering, we have get_libname, get_modname, shouldn't we just |
2 |
introduce get_linklibname or something instead of trying to overload |
3 |
get_libname? |
4 |
|
5 |
The implementation of get_linklibname could be to just call get_libname |
6 |
for anything but mingw of course. |
7 |
|
8 |
Fabian |
9 |
|
10 |
On 03-08-2018 00:09:41 -0500, Marty E. Plummer wrote: |
11 |
> Signed-off-by: Marty E. Plummer <hanetzer@×××××××××.com> |
12 |
> --- |
13 |
> |
14 |
> On mingw-w64 (and perhaps cygwin and mingw.org), there are two forms of |
15 |
> non-static libraries. Standard *.dll libraries are for runtime and are |
16 |
> loaded from %PATH% on windows systems, and are typically stored in |
17 |
> either /bin or /usr/bin on mingw-w64 cross-toolchain filesystems. Import |
18 |
> libraries, *.dll.a, are used when linking and live in the ''normal'' |
19 |
> libdirs, eg, /lib, /usr/lib and so on. |
20 |
> |
21 |
> A number of ebuilds which otherwise work on mingw-w64 crossdev |
22 |
> toolchains exhibit failure due to usage of get_libname not being able to |
23 |
> specify which of the two types are required. |
24 |
> |
25 |
> For example, sys-libs/ncurses, uses the following snippet of code: |
26 |
> ln -sf libncurses$(get_libname) "${ED}"/usr/$(get_libdir)/libcurses$(get_libname) || die |
27 |
> in order to create a 'libcurses.so -> libncurses.so' symlink. |
28 |
> |
29 |
> However, on a crossdev-built mingw-w64 toolchain, one will end up with a |
30 |
> broken 'libcurses.dll -> libncurses.dll' symlink, which should properly |
31 |
> be a 'libcurses.dll.a -> libncurses.dll.a' symlink, as the symlink here |
32 |
> is provided to allow linking with -lcurses instead of -lncurses. |
33 |
> |
34 |
> eclass/multilib.eclass | 52 ++++++++++++++++++++++++++++++++++++++---- |
35 |
> 1 file changed, 48 insertions(+), 4 deletions(-) |
36 |
> |
37 |
> diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass |
38 |
> index 350b6f949d1..6a99f5977ec 100644 |
39 |
> --- a/eclass/multilib.eclass |
40 |
> +++ b/eclass/multilib.eclass |
41 |
> @@ -239,26 +239,70 @@ get_exeext() { |
42 |
> } |
43 |
> |
44 |
> # @FUNCTION: get_libname |
45 |
> -# @USAGE: [version] |
46 |
> +# @USAGE: --link|--run [version] |
47 |
> # @DESCRIPTION: |
48 |
> # Returns libname with proper suffix {.so,.dylib,.dll,etc} and optionally |
49 |
> # supplied version for the current platform identified by CHOST. |
50 |
> # |
51 |
> +# If '--link' argument is passed, the linktime library's suffix is returned, |
52 |
> +# as in the file that must exist to let `gcc -lfoo foo.c -o foo` to work. |
53 |
> +# If '--run' argument is passed, the runtime library's suffix is returned. |
54 |
> +# |
55 |
> +# In most unix-like platforms the two are identical, however on mingw-w64 the |
56 |
> +# linktime library has the suffix of '.dll.a' and the runtime library '.dll'. |
57 |
> +# |
58 |
> # Example: |
59 |
> # get_libname ${PV} |
60 |
> # Returns: .so.${PV} (ELF) || .${PV}.dylib (MACH) || ... |
61 |
> +# get_libname --link |
62 |
> +# Returns: .so (ELF) || .dylib (MACH) || .dll.a (PE32) || ... |
63 |
> get_libname() { |
64 |
> - local libname |
65 |
> - local ver=$1 |
66 |
> + local libtype="undefined" |
67 |
> + local libname opt ver |
68 |
> + for opt; do |
69 |
> + case "${opt}" in |
70 |
> + --link) |
71 |
> + libtype="link" |
72 |
> + shift |
73 |
> + ;; |
74 |
> + --run) |
75 |
> + libtype="run" |
76 |
> + shift |
77 |
> + ;; |
78 |
> + *) |
79 |
> + ;; |
80 |
> + esac |
81 |
> + done |
82 |
> + ver="$1" |
83 |
> + # general unixy types |
84 |
> case ${CHOST} in |
85 |
> *-cygwin*) libname="dll.a";; # import lib |
86 |
> - mingw*|*-mingw*) libname="dll";; |
87 |
> *-darwin*) libname="dylib";; |
88 |
> *-mint*) libname="irrelevant";; |
89 |
> hppa*-hpux*) libname="sl";; |
90 |
> *) libname="so";; |
91 |
> esac |
92 |
> |
93 |
> + # wierd mingw-w64 stuff, maybe even cygwin |
94 |
> + case ${CHOST} in |
95 |
> + mingw*|*-mingw*) |
96 |
> + case ${libtype} in |
97 |
> + link) |
98 |
> + libname="dll.a" # import library |
99 |
> + ;; |
100 |
> + run) |
101 |
> + libname="dll" # runtime library |
102 |
> + ;; |
103 |
> + undefined) |
104 |
> + eerror "please specify either --link or --run to get_libname" |
105 |
> + eerror "for mingw builds, as there are two types of libraries" |
106 |
> + eerror "on this platform" |
107 |
> + die |
108 |
> + ;; |
109 |
> + esac |
110 |
> + ;; |
111 |
> + esac |
112 |
> + |
113 |
> if [[ -z $* ]] ; then |
114 |
> echo ".${libname}" |
115 |
> else |
116 |
> -- |
117 |
> 2.18.0 |
118 |
> |
119 |
> |
120 |
|
121 |
-- |
122 |
Fabian Groffen |
123 |
Gentoo on a different level |