Source: systemtap
Version: 4.3-2
Severity: important
Tags: patch
Usertags: hurd-i386, kfreebsd-any
User: debian-h...@lists.debian.org, debian-k...@lists.debian.org

Hello,

Currently systemtap FTBFS on GNU/Hurd and GNU/kFreeBSD-any due to
several linux-specific includes in some .cxx-files and usage of
PATH_MAX, which does not exist on GNU/Hurd. Additionally, for non-linux 
architectures only systemtap-common, systemtap-doc, and systemtap-sdt-
dev packages are built, according to the debian/control file. Note that
systemtap-sdt-dev is now needed for several programs, like gcc-x to
build, and has a dependency on python3, compared to 4.0 versions which
depended on python i.e. python2.

The attached patches modifies Makefile.am and configure.ac to build
only these packages. Makefile.am is also modified to install dtrace,
needed in systemtap-sdt-dev even if the translator is not built.
Additionally, doc_SystemTap_Tapset_Reference_docproc.c.diff fixes a
PATH_MAX issue, and doc_SystemTap_Tapset_Reference_Makefile.am.diff
excludes tapsets.pdf from the CLEANFILES target in order to build the
package more than once.

Attached is the patch debian_rules.diff to separate out the builds for
linux systems and non-linux systems.

Below are the changes summarized in changelog format:
  * debian/rules: Disable builds of systemtap, s-client, s-server
    and s-runtime packages for non-linux systems.
  * Makefile.am.diff:
    Add options BUILD_STAPRUN, BUILD_STAP.
    Move bin_SCRIPTS=dtrace outside BUILD_TRANSLATOR.
  * configure.ac.diff: Add options BUILD_STAPRUN, BUILD_STAP.
  * doc_SystemTap_Tapset_Reference_docproc.c.diff: Fix PATH_MAX issue
  * doc_SystemTap_Tapset_Reference_Makefile.am.diff:
    Don't remove tapsets.pdf in CLEANFILES target to enable rebuilds.

The patches have been applied and packages built for the following
systems: hurd-i386, kfreebsd-amd64, linux-amd64.
For the build on kfreebsd-amd64 and hurd-i386 the following additional
package was needed for a successful build: python3-setuptools.

Other patches are available to build more packages, but they might not
be necessary as long as only the above mentioned packages are built for
non-linux systems.


Thanks!
Index: systemtap-4.3/configure.ac
===================================================================
--- systemtap-4.3.orig/configure.ac
+++ systemtap-4.3/configure.ac
@@ -475,6 +475,12 @@ AS_IF([test "x$with_dracutbindir" != "x"
 AC_MSG_NOTICE([using dracut binary $dracutbindir])
 AC_SUBST(dracutbindir)
 
+dnl Handle the option to build staprun.
+AM_CONDITIONAL([BUILD_STAPRUN], [test "$with_staprun" == "yes"])
+
+dnl Handle the option to build stap.
+AM_CONDITIONAL([BUILD_STAP], [test "$with_stap" == "yes"])
+
 dnl Handle the option to build the compile server.
 AC_ARG_ENABLE([server],
   AS_HELP_STRING([--enable-server],
Index: systemtap-4.3/Makefile.am
===================================================================
--- systemtap-4.3.orig/Makefile.am
+++ systemtap-4.3/Makefile.am
@@ -20,7 +20,7 @@ AM_CPPFLAGS = -DBINDIR='"$(bindir)"' \
 AM_CFLAGS = -D_GNU_SOURCE -fexceptions -Wall -Wextra -Werror -Wunused -Wformat=2 -W
 AM_CXXFLAGS = -Wall -Wextra -Werror
 
-bin_SCRIPTS = stap-report
+bin_SCRIPTS = stap-report dtrace
 pkglibexec_SCRIPTS = stap-env
 oldinclude_HEADERS = includes/sys/sdt.h includes/sys/sdt-config.h
 
@@ -28,7 +28,6 @@ bin_PROGRAMS =
 
 if BUILD_TRANSLATOR
 bin_PROGRAMS += stap
-bin_SCRIPTS += dtrace
 
 pkglibexec_PROGRAMS =
 
@@ -324,7 +323,18 @@ if BUILD_SERVER
 	rm -f $(DESTDIR)$(localstatedir)/log/stap-server/log
 endif
 
-SUBDIRS = . java python stapdyn staprun stapbpf doc man po httpd stap-exporter
+if BUILD_STAPRUN
+   STAPRUN=staprun
+else
+   STAPRUN=
+endif
+
+if BUILD_STAP
+else
+   stap_SOURCES=
+endif
+
+SUBDIRS = . java python stapdyn $(STAPRUN) stapbpf doc man po httpd stap-exporter
 # NB: the gcov target above uses this to enumarate linked binaries' build directories
 DIST_SUBDIRS = testsuite $(SUBDIRS)
 EXTRA_DIST = m4/ChangeLog
Index: systemtap-4.3/doc/SystemTap_Tapset_Reference/docproc.c
===================================================================
--- systemtap-4.3.orig/doc/SystemTap_Tapset_Reference/docproc.c
+++ systemtap-4.3/doc/SystemTap_Tapset_Reference/docproc.c
@@ -42,6 +42,9 @@
 #include <sys/wait.h>
 #include <sys/types.h>
 #include <stdlib.h>
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
 
 /* exitstatus is used to keep track of any failing calls to kernel-doc,
  * but execution continues. */
Index: systemtap-4.3/doc/SystemTap_Tapset_Reference/Makefile.am
===================================================================
--- systemtap-4.3.orig/doc/SystemTap_Tapset_Reference/Makefile.am
+++ systemtap-4.3/doc/SystemTap_Tapset_Reference/Makefile.am
@@ -66,6 +66,6 @@ install-data-hook:
 endif
 endif
 
-CLEANFILES=stamp-* tapsets.pdf tapsets.xml
+CLEANFILES=stamp-* tapsets.xml
 clean-local:
 	rm -rf tapsets
--- a/debian/rules	2020-09-07 19:22:26.000000000 +0200
+++ b/debian/rules	2020-09-07 19:25:18.000000000 +0200
@@ -5,10 +5,24 @@
 
 EMACS_ADIR = $(CURDIR)/debian/tmp/usr/share/emacs/site-lisp/systemtap-common
 
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
+ifeq (linux,$(DEB_HOST_ARCH_OS))
+	ENABLE_SERVER =--enable-server
+	BUILD_STAPRUN=--with-staprun
+	BUILD_STAP=--with-stap
+	ENABLE_TRANSLATOR =--enable-translator
+else
+	ENABLE_SERVER =--disable-server
+	BUILD_STAPRUN=--without-staprun
+	BUILD_STAP=--without-stap
+	ENABLE_TRANSLATOR =--disable-translator
+endif
+
 CONF_FLAGS = --enable-sqlite --disable-crash --disable-pie \
 	     --enable-docs --enable-htmldocs --enable-refdocs \
-	     --enable-server --without-rpm --disable-silent-rules \
-	     --enable-translator --disable-publican --with-python3 \
+	     $(ENABLE_SERVER) $(BUILD_STAPRUN) $(BUILD_STAP) \
+	     --without-rpm --disable-silent-rules \
+	     $(ENABLE_TRANSLATOR) --disable-publican --with-python3 \
 	     --libexecdir=/usr/lib $(shell dpkg-buildflags --export=configure)
 
 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

Reply via email to