Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 673934
Collapse All | Expand All

(-)a/dev-util/strace/files/strace-5.5-static.patch (+178 lines)
Line 0 Link Here
1
--- /Makefile.am
2
+++ /Makefile.am
3
@@ -379,7 +379,6 @@
4
 if USE_LIBDW
5
 strace_SOURCES += unwind-libdw.c
6
 strace_CPPFLAGS += $(libdw_CPPFLAGS)
7
-strace_CFLAGS += $(libdw_CFLAGS)
8
 strace_LDFLAGS += $(libdw_LDFLAGS)
9
 strace_LDADD += $(libdw_LIBS)
10
 endif
11
--- /configure.ac
12
+++ /configure.ac
13
@@ -48,6 +48,15 @@
14
 AC_DEFINE([MANPAGE_DATE], "[manpage_date]", [Date])
15
 AC_SUBST([MANPAGE_DATE], [manpage_date])
16
 
17
+AC_ARG_ENABLE([static],
18
+	      [AS_HELP_STRING([--enable-static],
19
+			      [link strace statically])],
20
+	      [], [enable_static=no])
21
+if test "$enable_static" = "yes"; then
22
+	# Add -pthread since strace wants -lrt for timer_create, and -lrt uses -lpthread.
23
+	LDFLAGS="$LDFLAGS -pthread -static"
24
+fi
25
+
26
 AC_C_BIGENDIAN
27
 
28
 AC_MSG_CHECKING([for supported architecture])
29
--- /m4/st_libdw.m4
30
+++ /m4/st_libdw.m4
31
@@ -8,7 +8,6 @@
32
 AC_DEFUN([st_ARG_LIBDW], [dnl
33
 
34
 : ${libdw_CPPFLAGS=}
35
-: ${libdw_CFLAGS=}
36
 : ${libdw_LDFLAGS=}
37
 : ${libdw_LIBS=}
38
 
39
@@ -34,48 +33,14 @@
40
 have_libdw=
41
 
42
 AS_IF([test "x$with_libdw" != xno && test "x$use_unwinder" = x],
43
-      [saved_CPPFLAGS="$CPPFLAGS"
44
-       saved_CFLAGS="$CFLAGS"
45
-       CPPFLAGS="$CPPFLAGS $libdw_CPPFLAGS"
46
-       CFLAGS="$CFLAGS $libdw_CFLAGS"
47
-
48
-       AC_CHECK_HEADERS([elfutils/libdwfl.h],
49
-			[AC_CHECK_LIB([dw], [dwfl_linux_proc_attach],
50
-				      [libdw_LIBS="-ldw $libdw_LIBS"
51
-				       AC_CACHE_CHECK([for elfutils version],
52
-						      [st_cv_ELFUTILS_VERSION],
53
-						      [[st_cv_ELFUTILS_VERSION="$(echo _ELFUTILS_VERSION |
54
-										  $CPP $CPPFLAGS -P -imacros elfutils/version.h - |
55
-										  grep '^[0-9]')"
56
-							test -n "$st_cv_ELFUTILS_VERSION" ||
57
-								st_cv_ELFUTILS_VERSION=0
58
-						      ]]
59
-						     )
60
-				       AS_IF([test "$st_cv_ELFUTILS_VERSION" -ge 164],
61
-					     [have_libdw=yes],
62
-					     [AS_IF([test "x$with_libdw" = xyes],
63
-						    [AC_MSG_ERROR([elfutils version >= 164 is required for stack tracing support])],
64
-						    [AC_MSG_WARN([elfutils version >= 164 is required for stack tracing support])]
65
-						   )
66
-					     ]
67
-					    )
68
-				      ],
69
-				      [AS_IF([test "x$with_libdw" = xyes],
70
-					     [AC_MSG_FAILURE([failed to find dwfl_linux_proc_attach in libdw])],
71
-					    )
72
-				      ],
73
-				      [$libdw_LDFLAGS $libdw_LIBS]
74
-				     )
75
-			],
76
-			[AS_IF([test "x$with_libdw" = xyes],
77
-			       [AC_MSG_FAILURE([failed to find elfutils/libdwfl.h])]
78
-			      )
79
-			]
80
-		       )
81
-
82
-       CFLAGS="$saved_CFLAGS"
83
-       CPPFLAGS="$saved_CPPFLAGS"
84
-      ]
85
+      [if test "$enable_static" = "yes"; then
86
+           PKG_CHECK_MODULES_STATIC([LIBDW], [libdw >= 0.164])
87
+       else
88
+           PKG_CHECK_MODULES([LIBDW], [libdw >= 0.164])
89
+       fi
90
+       have_libdw=yes
91
+       libdw_CPPFLAGS="$LIBDW_CFLAGS"
92
+       libdw_LIBS="$LIBDW_LIBS"]
93
 )
94
 
95
 AS_IF([test "x$have_libdw" = xyes],
96
@@ -84,7 +49,6 @@
97
 		 [Whether to use libdw for stack tracing]
98
 		)
99
        AC_SUBST(libdw_CPPFLAGS)
100
-       AC_SUBST(libdw_CFLAGS)
101
        AC_SUBST(libdw_LDFLAGS)
102
        AC_SUBST(libdw_LIBS)
103
       ]
104
--- /m4/st_libunwind.m4
105
+++ /m4/st_libunwind.m4
106
@@ -28,64 +28,14 @@
107
 libunwind_LIBS=
108
 
109
 AS_IF([test "x$with_libunwind" != xno && test "x$use_unwinder" = x],
110
-      [saved_CPPFLAGS="$CPPFLAGS"
111
-       CPPFLAGS="$CPPFLAGS $libunwind_CPPFLAGS"
112
-
113
-       AC_CHECK_HEADERS([libunwind-ptrace.h],
114
-	 [saved_LDFLAGS="$LDFLAGS"
115
-	  LDFLAGS="$LDFLAGS $libunwind_LDFLAGS"
116
-
117
-	  AC_CHECK_LIB([unwind], [backtrace],
118
-	    [libunwind_LIBS="-lunwind $libunwind_LIBS"
119
-
120
-	     AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic])
121
-	     saved_LIBS="$LIBS"
122
-	     LIBS="-lunwind-generic $libunwind_LIBS $LIBS"
123
-
124
-	     AC_LINK_IFELSE(
125
-	       [AC_LANG_PROGRAM([[#include <libunwind-ptrace.h>]],
126
-				[[return !unw_create_addr_space(0, 0)]])
127
-	       ],
128
-	       [AC_MSG_RESULT([yes])
129
-		libunwind_LIBS="-lunwind-generic $libunwind_LIBS"
130
-
131
-		AC_CHECK_LIB([unwind-ptrace], [_UPT_create],
132
-		  [libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"
133
-		   use_unwinder=libunwind
134
-		  ],
135
-		  [if test "x$with_libunwind" != xcheck; then
136
-		     AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace])
137
-		   fi
138
-		  ],
139
-		  [$libunwind_LIBS]
140
-		)
141
-	       ],
142
-	       [AC_MSG_RESULT([no])
143
-		if test "x$with_libunwind" != xcheck; then
144
-		  AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic])
145
-		fi
146
-	       ]
147
-	     )
148
-
149
-	     LIBS="$saved_LIBS"
150
-	    ],
151
-	    [if test "x$with_libunwind" != xcheck; then
152
-	       AC_MSG_FAILURE([failed to find libunwind])
153
-	     fi
154
-	    ],
155
-	    [$libunwind_LIBS]
156
-	  )
157
-
158
-	  LDFLAGS="$saved_LDFLAGS"
159
-	 ],
160
-	 [if test "x$with_libunwind" != xcheck; then
161
-	    AC_MSG_FAILURE([failed to find libunwind-ptrace.h])
162
-	  fi
163
-	 ]
164
-       )
165
-
166
-       CPPFLAGS="$saved_CPPFLAGS"
167
-      ]
168
+      [if test "$enable_static" = "yes"; then
169
+           PKG_CHECK_MODULES_STATIC([LIBUNWIND], [libunwind libunwind-generic libunwind-ptrace])
170
+       else
171
+           PKG_CHECK_MODULES([LIBUNWIND], [libunwind libunwind-generic libunwind-ptrace])
172
+       fi
173
+       use_unwinder="libunwind"
174
+       libunwind_CPPFLAGS="$LIBUNWIND_CFLAGS"
175
+       libunwind_LIBS="$LIBUNWIND_LIBS"]
176
 )
177
 
178
 if test "x$use_unwinder" = xlibunwind; then
(-)a/dev-util/strace/strace-5.5.ebuild (-5 / +9 lines)
Lines 3-9 Link Here
3
3
4
EAPI=7
4
EAPI=7
5
5
6
inherit flag-o-matic toolchain-funcs autotools
6
inherit autotools flag-o-matic toolchain-funcs
7
7
8
if [[ ${PV} == "9999" ]] ; then
8
if [[ ${PV} == "9999" ]] ; then
9
	EGIT_REPO_URI="https://github.com/strace/strace.git"
9
	EGIT_REPO_URI="https://github.com/strace/strace.git"
Lines 22-27 IUSE="aio perl static unwind elfutils" Link Here
22
22
23
REQUIRED_USE="?? ( unwind elfutils )"
23
REQUIRED_USE="?? ( unwind elfutils )"
24
24
25
BDEPEND="
26
	virtual/pkgconfig
27
"
25
LIB_DEPEND="
28
LIB_DEPEND="
26
	unwind? ( sys-libs/libunwind[static-libs(+)] )
29
	unwind? ( sys-libs/libunwind[static-libs(+)] )
27
	elfutils? ( dev-libs/elfutils[static-libs(+)] )
30
	elfutils? ( dev-libs/elfutils[static-libs(+)] )
Lines 37-47 RDEPEND=" Link Here
37
	perl? ( dev-lang/perl )
40
	perl? ( dev-lang/perl )
38
"
41
"
39
42
43
PATCHES=(
44
	"${FILESDIR}/${PN}-5.5-static.patch"
45
)
46
40
src_prepare() {
47
src_prepare() {
41
	default
48
	default
42
49
43
	# Needed for applied patch (#701516). Remove with next version.
44
	# Don't forget about autotools inherit.
45
	eautoreconf
50
	eautoreconf
46
51
47
	if [[ ! -e configure ]] ; then
52
	if [[ ! -e configure ]] ; then
Lines 53-60 src_prepare() { Link Here
53
	fi
58
	fi
54
59
55
	filter-lfs-flags # configure handles this sanely
60
	filter-lfs-flags # configure handles this sanely
56
	# Add -pthread since strace wants -lrt for timer_create, and -lrt uses -lpthread.
57
	use static && append-ldflags -static -pthread
58
61
59
	export ac_cv_header_libaio_h=$(usex aio)
62
	export ac_cv_header_libaio_h=$(usex aio)
60
	use elibc_musl && export ac_cv_header_stdc=no
63
	use elibc_musl && export ac_cv_header_stdc=no
Lines 75-80 src_configure() { Link Here
75
	# Don't require mpers support on non-multilib systems. #649560
78
	# Don't require mpers support on non-multilib systems. #649560
76
	local myeconfargs=(
79
	local myeconfargs=(
77
		--enable-mpers=check
80
		--enable-mpers=check
81
		$(use_enable static)
78
		$(use_with unwind libunwind)
82
		$(use_with unwind libunwind)
79
		$(use_with elfutils libdw)
83
		$(use_with elfutils libdw)
80
	)
84
	)
(-)a/dev-util/strace/strace-9999.ebuild (-4 / +11 lines)
Lines 3-9 Link Here
3
3
4
EAPI=7
4
EAPI=7
5
5
6
inherit flag-o-matic toolchain-funcs
6
inherit autotools flag-o-matic toolchain-funcs
7
7
8
if [[ ${PV} == "9999" ]] ; then
8
if [[ ${PV} == "9999" ]] ; then
9
	EGIT_REPO_URI="https://github.com/strace/strace.git"
9
	EGIT_REPO_URI="https://github.com/strace/strace.git"
Lines 22-27 IUSE="aio perl static unwind elfutils" Link Here
22
22
23
REQUIRED_USE="?? ( unwind elfutils )"
23
REQUIRED_USE="?? ( unwind elfutils )"
24
24
25
BDEPEND="
26
	virtual/pkgconfig
27
"
25
LIB_DEPEND="
28
LIB_DEPEND="
26
	unwind? ( sys-libs/libunwind[static-libs(+)] )
29
	unwind? ( sys-libs/libunwind[static-libs(+)] )
27
	elfutils? ( dev-libs/elfutils[static-libs(+)] )
30
	elfutils? ( dev-libs/elfutils[static-libs(+)] )
Lines 37-45 RDEPEND=" Link Here
37
	perl? ( dev-lang/perl )
40
	perl? ( dev-lang/perl )
38
"
41
"
39
42
43
PATCHES=(
44
	"${FILESDIR}/${PN}-5.5-static.patch"
45
)
46
40
src_prepare() {
47
src_prepare() {
41
	default
48
	default
42
49
50
	eautoreconf
51
43
	if [[ ! -e configure ]] ; then
52
	if [[ ! -e configure ]] ; then
44
		# git generation
53
		# git generation
45
		sed /autoreconf/d -i bootstrap || die
54
		sed /autoreconf/d -i bootstrap || die
Lines 49-56 src_prepare() { Link Here
49
	fi
58
	fi
50
59
51
	filter-lfs-flags # configure handles this sanely
60
	filter-lfs-flags # configure handles this sanely
52
	# Add -pthread since strace wants -lrt for timer_create, and -lrt uses -lpthread.
53
	use static && append-ldflags -static -pthread
54
61
55
	export ac_cv_header_libaio_h=$(usex aio)
62
	export ac_cv_header_libaio_h=$(usex aio)
56
	use elibc_musl && export ac_cv_header_stdc=no
63
	use elibc_musl && export ac_cv_header_stdc=no
Lines 71-76 src_configure() { Link Here
71
	# Don't require mpers support on non-multilib systems. #649560
78
	# Don't require mpers support on non-multilib systems. #649560
72
	local myeconfargs=(
79
	local myeconfargs=(
73
		--enable-mpers=check
80
		--enable-mpers=check
81
		$(use_enable static)
74
		$(use_with unwind libunwind)
82
		$(use_with unwind libunwind)
75
		$(use_with elfutils libdw)
83
		$(use_with elfutils libdw)
76
	)
84
	)
77
- 

Return to bug 673934