Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/ta-lib/, sci-libs/ta-lib/files/
Date: Fri, 13 May 2022 22:46:18
Message-Id: 1652481956.e1e1fa5ad82974f69f122a7663bd18a1f947e53e.sam@gentoo
1 commit: e1e1fa5ad82974f69f122a7663bd18a1f947e53e
2 Author: orbea <orbea <AT> riseup <DOT> net>
3 AuthorDate: Thu May 12 19:41:43 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Fri May 13 22:45:56 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1e1fa5a
7
8 sci-libs/ta-lib: Fix build with slibtool
9
10 This fixes several issues with the build:
11
12 * Renames configure.in to configure.ac as is standard.
13
14 * Adds detection to configure.ac for libm to replaced the hardcoded
15 instances of -lm.
16
17 * Links internal dependencies with .la files rather than -l linker
18 flags. The -l linker flags are for external dependencies
19 exclusively and this can break with slibtool.
20
21 * With slibtool there is a parellel make issue where gen_code binary is
22 copied to ../../../bin before it is created and the Makefile.am needs
23 to explicitly list gen_code as a prerequisite for the 'all-local'
24 target. This probably happens because slibtool is significantly faster
25 than GNU libtool.
26
27 * Additionally slibtool will output the gen_code binary to the .libs
28 directory while slibtool will do so in the Makefile directory. The
29 command needs to be invoked with $(LIBTOOL) --mode=execute to
30 correctly copy the binary and not the slibtool wrapper script for the
31 binary.
32
33 * Lastly there is a workaround for a slibtool bug where the cp(1)
34 command is wrapped in a shell script. Invoking the command directly
35 with --mode=execute will result in slibtool dropping the destination
36 argument which obviously does not work. While this workaround is far
37 from ideal, it will be portable for GNU libtool, slibtool now and
38 slibtool when the bug is fixed.
39
40 Bug: https://bugs.gentoo.org/790770
41 Upstream-PR: https://sourceforge.net/p/ta-lib/patches/6/
42 Signed-off-by: orbea <orbea <AT> riseup.net>
43 Closes: https://github.com/gentoo/gentoo/pull/25457
44 Signed-off-by: Sam James <sam <AT> gentoo.org>
45
46 sci-libs/ta-lib/files/ta-lib-0.4.0-slibtool.patch | 92 +++++++++++++++++++++++
47 sci-libs/ta-lib/ta-lib-0.4.0-r1.ebuild | 41 ++++++++++
48 2 files changed, 133 insertions(+)
49
50 diff --git a/sci-libs/ta-lib/files/ta-lib-0.4.0-slibtool.patch b/sci-libs/ta-lib/files/ta-lib-0.4.0-slibtool.patch
51 new file mode 100644
52 index 000000000000..7aa9c96159eb
53 --- /dev/null
54 +++ b/sci-libs/ta-lib/files/ta-lib-0.4.0-slibtool.patch
55 @@ -0,0 +1,92 @@
56 +Upstream-PR: https://sourceforge.net/p/ta-lib/patches/6/
57 +From 05375dd96c3bdec814214f37a6c49d4a27079960 Mon Sep 17 00:00:00 2001
58 +From: orbea <orbea@××××××.net>
59 +Date: Thu, 12 May 2022 11:13:59 -0700
60 +Subject: [PATCH] Fix parallel Make issue with slibtool
61 +
62 +---
63 + configure.in => configure.ac | 4 ++++
64 + src/tools/gen_code/Makefile.am | 13 ++++++++-----
65 + src/tools/gen_code/gen_code_bin.sh | 16 ++++++++++++++++
66 + src/tools/ta_regtest/Makefile.am | 4 ++--
67 + 4 files changed, 30 insertions(+), 7 deletions(-)
68 + rename configure.in => configure.ac (96%)
69 + create mode 100755 src/tools/gen_code/gen_code_bin.sh
70 +
71 +diff --git a/configure.in b/configure.ac
72 +similarity index 96%
73 +rename from configure.in
74 +rename to configure.ac
75 +index d2e5784..359d400 100644
76 +--- a/configure.in
77 ++++ b/configure.ac
78 +@@ -35,6 +35,10 @@ AC_FUNC_STRTOD
79 + AC_FUNC_VPRINTF
80 + AC_CHECK_FUNCS([floor isascii localeconv mblen memmove memset modf pow sqrt strcasecmp strchr strerror strncasecmp strrchr strstr strtol strtoul])
81 +
82 ++# Checks for libm
83 ++AC_CHECK_LIBM
84 ++AC_SUBST([LIBM])
85 ++
86 + # Versioning:
87 + # Only change this if library is no longer
88 + # ABI compatible with previous version
89 +diff --git a/src/tools/gen_code/Makefile.am b/src/tools/gen_code/Makefile.am
90 +index cb839c2..2ec2360 100644
91 +--- a/src/tools/gen_code/Makefile.am
92 ++++ b/src/tools/gen_code/Makefile.am
93 +@@ -6,9 +6,12 @@ noinst_PROGRAMS = gen_code
94 + gen_code_SOURCES = gen_code.c
95 +
96 + gen_code_CPPFLAGS = -I../../ta_common
97 +-gen_code_LDFLAGS = -L../../ta_common -L../../ta_abstract -L../../ta_func
98 +-gen_code_LDADD = -lta_common -lta_abstract_gc -lta_func -lm
99 ++gen_code_LDFLAGS = -no-undefined
100 ++gen_code_LDADD = \
101 ++ ../../ta_common/libta_common.la \
102 ++ ../../ta_abstract/libta_abstract_gc.la \
103 ++ ../../ta_func/libta_func.la \
104 ++ $(LIBM)
105 +
106 +-all-local:
107 +- $(MAKE) $(AM_MAKEFLAGS) gen_code
108 +- cp gen_code ../../../bin
109 ++all-local: gen_code
110 ++ $(LIBTOOL) --mode=execute ./gen_code_bin.sh gen_code
111 +diff --git a/src/tools/gen_code/gen_code_bin.sh b/src/tools/gen_code/gen_code_bin.sh
112 +new file mode 100755
113 +index 0000000..b19fd09
114 +--- /dev/null
115 ++++ b/src/tools/gen_code/gen_code_bin.sh
116 +@@ -0,0 +1,16 @@
117 ++#!/bin/sh
118 ++
119 ++# This is a work around for a slibtool bug with --mode=execute
120 ++#
121 ++# With slibtool the gen_code binary is created in the .libs directory while GNU
122 ++# libtool outputs in the same directory as the Makefile. This means that cp(1)
123 ++# needs to be invoked with $(LIBTOOL) --mode=execute.
124 ++#
125 ++# However slibtool currently has a bug where the destination argument is dropped
126 ++# which will result in the command failing.
127 ++#
128 ++# See https://bugs.gentoo.org/790770
129 ++
130 ++set -eu
131 ++
132 ++cp "${1}" ../../../bin
133 +diff --git a/src/tools/ta_regtest/Makefile.am b/src/tools/ta_regtest/Makefile.am
134 +index 64229e2..255a87e 100644
135 +--- a/src/tools/ta_regtest/Makefile.am
136 ++++ b/src/tools/ta_regtest/Makefile.am
137 +@@ -34,5 +34,5 @@ ta_regtest_CPPFLAGS = -I../../ta_func \
138 + -I../../ta_common/mt \
139 + -I../../ta_common \
140 + -I../../ta_abstract
141 +-ta_regtest_LDFLAGS = -L../.. -lta_lib \
142 +- -lm
143 ++ta_regtest_LDFLAGS = -no-undefined
144 ++ta_regtest_LDADD = ../../libta_lib.la $(LIBM)
145 +--
146 +2.35.1
147 +
148
149 diff --git a/sci-libs/ta-lib/ta-lib-0.4.0-r1.ebuild b/sci-libs/ta-lib/ta-lib-0.4.0-r1.ebuild
150 new file mode 100644
151 index 000000000000..1b9203041c43
152 --- /dev/null
153 +++ b/sci-libs/ta-lib/ta-lib-0.4.0-r1.ebuild
154 @@ -0,0 +1,41 @@
155 +# Copyright 1999-2020 Gentoo Authors
156 +# Distributed under the terms of the GNU General Public License v2
157 +
158 +EAPI=8
159 +
160 +inherit autotools
161 +
162 +DESCRIPTION="Technical Analysis Library for analyzing financial markets trends"
163 +HOMEPAGE="https://www.ta-lib.org/"
164 +SRC_URI="mirror://sourceforge/ta-lib/${P}-src.tar.gz"
165 +
166 +LICENSE="BSD"
167 +SLOT="0"
168 +KEYWORDS="~amd64 ~x86"
169 +
170 +S="${WORKDIR}/${PN}"
171 +
172 +PATCHES=(
173 + "${FILESDIR}"/${P}-asneeded.patch
174 + "${FILESDIR}"/${P}-slibtool.patch # 790770
175 +)
176 +
177 +src_prepare() {
178 + default
179 +
180 + eautoreconf
181 +}
182 +
183 +src_configure() {
184 + econf --disable-static
185 +}
186 +
187 +src_test() {
188 + src/tools/ta_regtest/ta_regtest || die
189 +}
190 +
191 +src_install() {
192 + default
193 +
194 + find "${D}" -name '*.la' -delete || die
195 +}