Linux DTrace development list
 help / color / mirror / Atom feed
* [PATCH v2 1/2] build: install sdt*.h in /usr/lib64/dtrace/include/sys
@ 2024-05-23 21:41 Nick Alcock
  2024-05-23 21:41 ` [PATCH v2 2/2] build: initial pkg-config support Nick Alcock
  2024-05-24 14:52 ` [PATCH v2 1/2] build: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock
  0 siblings, 2 replies; 3+ messages in thread
From: Nick Alcock @ 2024-05-23 21:41 UTC (permalink / raw)
  To: dtrace, dtrace-devel

This moves it out of the way of SystemTap's rather different sdt.h, and lets
us remove the barely-working kludgery in the specfile to work around it.
Right now, the new location is nailed into every user (since sdt.h required
no special cpp flags before now), but this is hardly a good long-term
solution: a better one will be forthcoming soon.

With this change, we no longer confict with any systemtap packages!

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
 GNUmakefile                           |  2 ++
 dtrace.spec                           | 18 ------------------
 runtest.sh                            | 10 +++++-----
 test/unittest/pid/tst.provregex3.sh   |  6 +++---
 test/unittest/pid/tst.provregex4.sh   | 10 +++++-----
 test/unittest/usdt/tst.allargs.sh     |  4 ++--
 test/unittest/usdt/tst.entryreturn.sh |  4 ++--
 test/unittest/usdt/tst.linkpriv.sh    |  4 ++--
 test/unittest/usdt/tst.linkunpriv.sh  |  4 ++--
 test/unittest/usdt/tst.manyprobes.sh  |  4 ++--
 test/unittest/usdt/tst.reeval.sh      |  4 ++--
 test/unittest/usdt/tst.static.sh      |  4 ++--
 test/unittest/usdt/tst.static2.sh     |  4 ++--
 uts/Build                             | 16 ++++++++++++----
 14 files changed, 43 insertions(+), 51 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 7d1af5641f54a..30726332d762d 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -86,6 +86,8 @@ BINDIR = $(prefix)/bin
 INSTBINDIR = $(DESTDIR)$(BINDIR)
 INCLUDEDIR = $(prefix)/include
 INSTINCLUDEDIR = $(DESTDIR)$(INCLUDEDIR)
+SDTINCLUDEDIR = $(LIBDIR)/dtrace/include
+INSTSDTINCLUDEDIR = $(DESTDIR)$(SDTINCLUDEDIR)
 SBINDIR = $(prefix)/sbin
 INSTSBINDIR = $(DESTDIR)$(SBINDIR)
 UDEVDIR = $(prefix)/lib/udev/rules.d
diff --git a/dtrace.spec b/dtrace.spec
index 42ea9bc339586..2f1e489aab7b1 100644
--- a/dtrace.spec
+++ b/dtrace.spec
@@ -86,8 +86,6 @@ BuildRequires: binutils-devel >= 2.30-58.0.8
 Requires:     libdtrace-ctf >= 1.1.0
 BuildRequires: libdtrace-ctf-devel >= 1.1.0
 %endif
-Conflicts:    systemtap-sdt-devel
-Provides:     systemtap-sdt-devel
 Summary:      DTrace user interface.
 Version:      2.0.1
 Release:      0%{?dist}
@@ -194,11 +192,6 @@ make DESTDIR=$RPM_BUILD_ROOT VERSION=%{version} \
 sed -i '/^ProtectSystem=/d; /^ProtectControlGroups=/d; /^RuntimeDirectory/d;' $RPM_BUILD_ROOT/usr/lib/systemd/system/dtprobed.service
 %endif
 
-# Because systemtap creates a sdt.h header file we have to rename
-# ours and then shift theirs out of the way.
-mv $RPM_BUILD_ROOT/usr/include/sys/sdt.h \
-   $RPM_BUILD_ROOT/usr/include/sys/sdt-dtrace.h
-
 %clean
 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
 rm -rf $RPM_BUILD_DIR/%{name}-%{version}
@@ -222,15 +215,6 @@ if [ $1 -ge 2 ] ; then
     %systemd_postun_with_restart dtprobed.service
 fi
 
-# if sdt-systemtap.h doesn't exist then we can move the existing dtrace sdt.h
-SYSINCDIR=/usr/include/sys
-if [ -e $SYSINCDIR/sdt.h -a ! -e $SYSINCDIR/sdt-systemtap.h ]; then
-    mv $SYSINCDIR/sdt.h $SYSINCDIR/sdt-systemtap.h
-    ln -s $SYSINCDIR/sdt-dtrace.h $SYSINCDIR/sdt.h
-elif [ ! -e $SYSINCDIR/sdt.h ]; then
-    ln -s $SYSINCDIR/sdt-dtrace.h $SYSINCDIR/sdt.h
-fi
-
 %preun
 %systemd_preun dtprobed.service
 
@@ -253,8 +237,6 @@ systemctl start dtprobed || :
 %{_sbindir}/dtrace
 %{_sbindir}/dtprobed
 %{_mandir}/man8/dtrace.8.gz
-%{_includedir}/sys/sdt-dtrace.h
-%{_includedir}/sys/sdt_internal.h
 %doc %{_docdir}/dtrace-%{version}/*
 %{_unitdir}/dtprobed.service
 %{_unitdir}/dtrace-usdt.target
diff --git a/runtest.sh b/runtest.sh
index 35d5006978469..3bcd676ea788d 100755
--- a/runtest.sh
+++ b/runtest.sh
@@ -559,7 +559,7 @@ if [[ -z $USE_INSTALLED ]]; then
     dtrace="$(pwd)/build*/dtrace"
     test_libdir="$(pwd)/build/dlibs"
     test_ldflags="-L$(pwd)/build"
-    test_incflags="-Iinclude -Iuts/common -Ibuild -Ilibdtrace -DARCH_$arch"
+    test_cppflags="-Iinclude -Iuts/common -Ibuild -Ilibdtrace -DARCH_$arch"
     helper_device="dtrace/test-$$"
     # Pre-existing directories from earlier tests are just fine!
     # dtprobed will clean things up.
@@ -579,7 +579,7 @@ else
     dtrace="/usr/sbin/dtrace"
     test_libdir="installed"
     test_ldflags=""
-    test_incflags="-DARCH_$arch"
+    test_cppflags="-DARCH_$arch -I/usr/lib64/dtrace/include"
 
     if [[ ! -x $dtrace ]]; then
         echo "$dtrace not available." >&2
@@ -587,6 +587,7 @@ else
     fi
 fi
 export dtrace
+export test_cppflags
 
 # Figure out if the preprocessor supports -fno-diagnostics-show-option: if it
 # does, add a bunch of options designed to make GCC output look like it used
@@ -594,7 +595,6 @@ export dtrace
 # Regardless, turn off display of column numbers, if possible: they vary
 # between GCC releases.
 
-test_cppflags=
 if ! /usr/bin/cpp -x c -fno-diagnostics-show-caret - /dev/null < /dev/null 2>&1 | \
 	grep -q 'unrecognized command line option'; then
     export DTRACE_OPT_CPPARGS="-fno-diagnostics-show-caret -fdiagnostics-color=never -fno-diagnostics-show-option -fno-show-column"
@@ -1129,7 +1129,7 @@ for dt in $dtrace; do
         # Default and substitute in flags.  The raw_dt_flags apply even to a
         # sh invocation.
 
-        raw_dt_flags="$test_incflags"
+        raw_dt_flags="$test_cppflags"
 
         expected_tag=
         if [[ $testonly =~ ^err\.D_ ]]; then
@@ -1204,7 +1204,7 @@ for dt in $dtrace; do
 
             CC="${CC:-gcc}"
             CCline="$CC -std=gnu99 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
-            CCline="$CCline $test_incflags $CFLAGS $test_ldflags $LDFLAGS"
+            CCline="$CCline $test_cppflags $CFLAGS $test_ldflags $LDFLAGS"
             CCline="$CCline -o $tmpdir/$(basename $base) $_test $link"
             log "Compiling $CCline\n"
             if ! $CCline >/dev/null 2>$tmpdir/cc.err; then
diff --git a/test/unittest/pid/tst.provregex3.sh b/test/unittest/pid/tst.provregex3.sh
index 6e1afd3e493ee..7ebfb28eecaac 100755
--- a/test/unittest/pid/tst.provregex3.sh
+++ b/test/unittest/pid/tst.provregex3.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
@@ -23,10 +23,10 @@ cat > $DIR/Makefile <<EOF
 all: main
 
 main: main.o prov.o
-	cc -o main main.o prov.o
+	cc $test_cppflags -o main main.o prov.o
 
 main.o: main.c prov.h
-	cc -c main.c
+	cc $test_cppflags -c main.c
 
 prov.h: prov.d
 	$dtrace -h -s prov.d
diff --git a/test/unittest/pid/tst.provregex4.sh b/test/unittest/pid/tst.provregex4.sh
index a9ff323828372..e4248e15a7aff 100755
--- a/test/unittest/pid/tst.provregex4.sh
+++ b/test/unittest/pid/tst.provregex4.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
@@ -25,10 +25,10 @@ cat > $DIR/Makefile <<EOF
 all: main altlib.so
 
 main: main.o provmain.o
-	cc -o main main.o provmain.o -ldl
+	cc $test_cppflags -o main main.o provmain.o -ldl
 
 main.o: main.c prov.h
-	cc -c main.c
+	cc $test_cppflags -c main.c
 
 prov.h: prov.d
 	$dtrace -h -s prov.d
@@ -37,10 +37,10 @@ provmain.o: prov.d main.o
 	$dtrace -G -o provmain.o -s prov.d main.o
 
 altlib.so: altlib.o provalt.o
-	cc -z defs --shared -o altlib.so altlib.o provalt.o
+	cc $test_cppflags -z defs --shared -o altlib.so altlib.o provalt.o
 
 altlib.o: altlib.c prov.h
-	cc -c altlib.c
+	cc $test_cppflags -c altlib.c
 
 provalt.o: prov.d altlib.o
 	$dtrace -G -o provalt.o -s prov.d altlib.o
diff --git a/test/unittest/usdt/tst.allargs.sh b/test/unittest/usdt/tst.allargs.sh
index 20f9de900b5ad..d233615f6aefc 100755
--- a/test/unittest/usdt/tst.allargs.sh
+++ b/test/unittest/usdt/tst.allargs.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 
@@ -16,7 +16,7 @@ fi
 
 dtrace=$1
 CC=/usr/bin/gcc
-CFLAGS="-std=gnu89 -I${PWD}/uts/common"
+CFLAGS="-std=gnu89 $test_cppflags"
 
 DIRNAME="$tmpdir/usdt-allargs.$$.$RANDOM"
 mkdir -p $DIRNAME
diff --git a/test/unittest/usdt/tst.entryreturn.sh b/test/unittest/usdt/tst.entryreturn.sh
index 6c14ece211c8c..d777c1acdf412 100755
--- a/test/unittest/usdt/tst.entryreturn.sh
+++ b/test/unittest/usdt/tst.entryreturn.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
@@ -14,7 +14,7 @@ fi
 
 dtrace=$1
 CC=/usr/bin/gcc
-CFLAGS="-I${PWD}/uts/common"
+CFLAGS="$test_cppflags"
 
 DIRNAME="$tmpdir/usdt-entryreturn.$$.$RANDOM"
 mkdir -p $DIRNAME
diff --git a/test/unittest/usdt/tst.linkpriv.sh b/test/unittest/usdt/tst.linkpriv.sh
index 1a088f8235bf4..c008e66df8381 100755
--- a/test/unittest/usdt/tst.linkpriv.sh
+++ b/test/unittest/usdt/tst.linkpriv.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
@@ -12,7 +12,7 @@ fi
 
 dtrace=$1
 CC=/usr/bin/gcc
-CFLAGS="-std=gnu99 -I${PWD}/uts/common"
+CFLAGS="-std=gnu99 $test_cppflags"
 
 DIRNAME="$tmpdir/usdt-linkpriv.$$.$RANDOM"
 mkdir -p $DIRNAME
diff --git a/test/unittest/usdt/tst.linkunpriv.sh b/test/unittest/usdt/tst.linkunpriv.sh
index 71d42ae417215..bf52bc6ad0150 100755
--- a/test/unittest/usdt/tst.linkunpriv.sh
+++ b/test/unittest/usdt/tst.linkunpriv.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
@@ -14,7 +14,7 @@ fi
 
 dtrace=$1
 CC=/usr/bin/gcc
-CFLAGS="-I${PWD}/uts/common"
+CFLAGS="$test_cppflags"
 
 DIRNAME="$tmpdir/usdt-linkunpriv.$$.$RANDOM"
 mkdir -p $DIRNAME
diff --git a/test/unittest/usdt/tst.manyprobes.sh b/test/unittest/usdt/tst.manyprobes.sh
index dd97250e5d8a3..a3b238745acd1 100755
--- a/test/unittest/usdt/tst.manyprobes.sh
+++ b/test/unittest/usdt/tst.manyprobes.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
@@ -12,7 +12,7 @@ fi
 
 dtrace=$1
 CC=/usr/bin/gcc
-CFLAGS="-I${PWD}/uts/common"
+CFLAGS="$test_cppflags"
 DIRNAME="$tmpdir/usdt-manyprobes.$$.$RANDOM"
 mkdir -p $DIRNAME
 cd $DIRNAME
diff --git a/test/unittest/usdt/tst.reeval.sh b/test/unittest/usdt/tst.reeval.sh
index 3b32a280f7575..56011a4fbe527 100755
--- a/test/unittest/usdt/tst.reeval.sh
+++ b/test/unittest/usdt/tst.reeval.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
@@ -13,7 +13,7 @@ fi
 
 dtrace=$1
 CC=/usr/bin/gcc
-CFLAGS="-I${PWD}/uts/common"
+CFLAGS="$test_cppflags"
 
 DIRNAME="$tmpdir/usdt-reeval.$$.$RANDOM"
 mkdir -p $DIRNAME
diff --git a/test/unittest/usdt/tst.static.sh b/test/unittest/usdt/tst.static.sh
index a016f1c6c174a..bd71c2e46e1fb 100755
--- a/test/unittest/usdt/tst.static.sh
+++ b/test/unittest/usdt/tst.static.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
@@ -12,7 +12,7 @@ fi
 
 dtrace=$1
 CC=/usr/bin/gcc
-CFLAGS="-I${PWD}/uts/common"
+CFLAGS="$test_cppflags"
 
 DIRNAME="$tmpdir/usdt-static.$$.$RANDOM"
 mkdir -p $DIRNAME
diff --git a/test/unittest/usdt/tst.static2.sh b/test/unittest/usdt/tst.static2.sh
index ec6118730283d..29fd35979395f 100755
--- a/test/unittest/usdt/tst.static2.sh
+++ b/test/unittest/usdt/tst.static2.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved.
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
@@ -16,7 +16,7 @@ fi
 
 dtrace=$1
 CC=/usr/bin/gcc
-CFLAGS="-I${PWD}/uts/common"
+CFLAGS="$test_cppflags"
 
 DIRNAME="$tmpdir/usdt-static2.$$.$RANDOM"
 mkdir -p $DIRNAME
diff --git a/uts/Build b/uts/Build
index f445115d683db..864b2dfdacbf4 100644
--- a/uts/Build
+++ b/uts/Build
@@ -1,6 +1,6 @@
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 
@@ -10,11 +10,19 @@ uts_DIR := $(current-dir)
 # provide the userspace versions of types defined distincty by the kernel.
 
 SYS_HEADERS_INSTALL := common/sys/dtrace.h \
-                       common/sys/dtrace_types.h \
-                       common/sys/sdt.h \
-                       common/sys/sdt_internal.h
+                       common/sys/dtrace_types.h
+
+# sdt*.h are used by programs that contain USDT probes that want to define
+# probes by hand rather than using dtrace -h.  SystemTap has another header
+# with the same name, so we install these out of the way.
+
+PROBE_HEADERS_INSTALL := common/sys/sdt.h \
+                         common/sys/sdt_internal.h
 
 install::
 	mkdir -p $(INSTINCLUDEDIR)/sys
 	$(call describe-install-target,$(INSTINCLUDEDIR)/sys,$(notdir $(SYS_HEADERS_INSTALL)))
 	cd $(uts_DIR) && install -m 644 $(SYS_HEADERS_INSTALL) $(INSTINCLUDEDIR)/sys
+	mkdir -p $(INSTSDTINCLUDEDIR)/sys
+	$(call describe-install-target,$(INSTSDTINCLUDEDIR)/sys,$(notdir $(PROBE_HEADERS_INSTALL)))
+	cd $(uts_DIR) && install -m 644 $(PROBE_HEADERS_INSTALL) $(INSTSDTINCLUDEDIR)/sys

base-commit: 0f499300c150a3a8878361e31f3ba167f7d5b851
-- 
2.45.1.275.g567cb0950c


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] build: initial pkg-config support
  2024-05-23 21:41 [PATCH v2 1/2] build: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock
@ 2024-05-23 21:41 ` Nick Alcock
  2024-05-24 14:52 ` [PATCH v2 1/2] build: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Alcock @ 2024-05-23 21:41 UTC (permalink / raw)
  To: dtrace, dtrace-devel

This initial pkg-config file, dtrace_sdt.pc, points at the location
of the sdt.h include file.  We immediately use it in make check in the
installed testsuite, compensating for any install-time changes in the
location of the dtrace libdir.

Further changes will be forthcoming to properly support relocatable
installation.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
 GNUmakefile          |  2 ++
 configure            |  2 ++
 dtrace.spec          |  1 +
 runtest.sh           |  2 +-
 uts/Build            | 14 +++++++++++++-
 uts/dtrace_sdt.pc.in |  6 ++++++
 6 files changed, 25 insertions(+), 2 deletions(-)
 create mode 100644 uts/dtrace_sdt.pc.in

diff --git a/GNUmakefile b/GNUmakefile
index 30726332d762d..0390db77b4780 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -100,6 +100,8 @@ DOCDIR = $(prefix)/share/doc/dtrace-$(VERSION)
 INSTDOCDIR = $(DESTDIR)$(DOCDIR)
 MANDIR = $(prefix)/share/man/man8
 INSTMANDIR = $(DESTDIR)$(MANDIR)
+PKGCONFIGDIR = $(prefix)/share/pkgconfig
+INSTPKGCONFIGDIR = $(DESTDIR)$(PKGCONFIGDIR)
 TESTDIR = $(prefix)/lib$(BITNESS)/dtrace/testsuite
 INSTTESTDIR = $(DESTDIR)$(TESTDIR)
 TARGETS =
diff --git a/configure b/configure
index 40b870f81d6ff..4b235fb1fd766 100755
--- a/configure
+++ b/configure
@@ -60,6 +60,7 @@ Installation paths:
 --sbindir=PREFIX/sbin				Alias for --bindir
 --includedir=PREFIX/include			#include directory
 --mandir=PREFIX/share/man/man8			Manpage directory
+--pkg-config-dir=PREFIX/share/pkgconfig		Pkg-config directory
 --udevdir=PREFIX/lib/udev/rules.d		udev rules directory
 --systemd-unit-dir=PREFIX/lib/systemd/system	systemd unit directory
 --docdir=PREFIX/share/doc/dtrace		Documentation directory
@@ -130,6 +131,7 @@ for option in "$@"; do
         --systemd-unit-dir=*) write_make_var SYSTEMDUNITDIR "$option";;
         --docdir=*) write_make_var DOCDIR "$option";;
         --mandir=*) write_make_var MANDIR "$option";;
+        --pkg-config-dir=*) write_make_var PKGCONFIGDIR "$option";;
         --testdir=*) write_make_var TESTDIR "$option";;
         CC=*) write_make_var CC "$option";;
         CPP=*) write_make_var PREPROCESS "$option";;
diff --git a/dtrace.spec b/dtrace.spec
index 2f1e489aab7b1..7823b13d981cf 100644
--- a/dtrace.spec
+++ b/dtrace.spec
@@ -236,6 +236,7 @@ systemctl start dtprobed || :
 %{_libdir}/libdtrace.so.*
 %{_sbindir}/dtrace
 %{_sbindir}/dtprobed
+%{_datadir}/pkgconfig/dtrace_sdt.pc
 %{_mandir}/man8/dtrace.8.gz
 %doc %{_docdir}/dtrace-%{version}/*
 %{_unitdir}/dtprobed.service
diff --git a/runtest.sh b/runtest.sh
index 3bcd676ea788d..cc9703e12c161 100755
--- a/runtest.sh
+++ b/runtest.sh
@@ -579,7 +579,7 @@ else
     dtrace="/usr/sbin/dtrace"
     test_libdir="installed"
     test_ldflags=""
-    test_cppflags="-DARCH_$arch -I/usr/lib64/dtrace/include"
+    test_cppflags="-DARCH_$arch $(pkg-config --cflags dtrace_sdt)"
 
     if [[ ! -x $dtrace ]]; then
         echo "$dtrace not available." >&2
diff --git a/uts/Build b/uts/Build
index 864b2dfdacbf4..feafa21369f2e 100644
--- a/uts/Build
+++ b/uts/Build
@@ -14,11 +14,16 @@ SYS_HEADERS_INSTALL := common/sys/dtrace.h \
 
 # sdt*.h are used by programs that contain USDT probes that want to define
 # probes by hand rather than using dtrace -h.  SystemTap has another header
-# with the same name, so we install these out of the way.
+# with the same name, so we install these out of the way and provide a
+# pkg-config file to pull them in.
 
 PROBE_HEADERS_INSTALL := common/sys/sdt.h \
                          common/sys/sdt_internal.h
 
+# The pkg-config files undergo a few translations with sed before installation.
+
+SHARE_PKG_CONFIG_INSTALL := dtrace_sdt.pc
+
 install::
 	mkdir -p $(INSTINCLUDEDIR)/sys
 	$(call describe-install-target,$(INSTINCLUDEDIR)/sys,$(notdir $(SYS_HEADERS_INSTALL)))
@@ -26,3 +31,10 @@ install::
 	mkdir -p $(INSTSDTINCLUDEDIR)/sys
 	$(call describe-install-target,$(INSTSDTINCLUDEDIR)/sys,$(notdir $(PROBE_HEADERS_INSTALL)))
 	cd $(uts_DIR) && install -m 644 $(PROBE_HEADERS_INSTALL) $(INSTSDTINCLUDEDIR)/sys
+	mkdir -p $(INSTPKGCONFIGDIR)
+	$(call describe-install-target,$(INSTPKGCONFIGDIR),$(SHARE_PKG_CONFIG_INSTALL))
+	for name in $(SHARE_PKG_CONFIG_INSTALL); do \
+		cd $(uts_DIR) && \
+		    sed 's,@SDTINCLUDEDIR@,$(SDTINCLUDEDIR),g; s,@VERSION@,$(VERSION),g' < \
+			$${name}.in > $(INSTPKGCONFIGDIR)/$$name; \
+	done
diff --git a/uts/dtrace_sdt.pc.in b/uts/dtrace_sdt.pc.in
new file mode 100644
index 0000000000000..c5506f9355d92
--- /dev/null
+++ b/uts/dtrace_sdt.pc.in
@@ -0,0 +1,6 @@
+sdtincludedir = @SDTINCLUDEDIR@
+
+Name: DTrace SDT
+Description: DTrace raw SDT headers
+Version: @VERSION@
+Cflags: -I${sdtincludedir}
-- 
2.45.1.275.g567cb0950c


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/2] build: install sdt*.h in /usr/lib64/dtrace/include/sys
  2024-05-23 21:41 [PATCH v2 1/2] build: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock
  2024-05-23 21:41 ` [PATCH v2 2/2] build: initial pkg-config support Nick Alcock
@ 2024-05-24 14:52 ` Nick Alcock
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Alcock @ 2024-05-24 14:52 UTC (permalink / raw)
  To: Kris Van Hees; +Cc: dtrace, dtrace-devel

On 23 May 2024, Nick Alcock told this:

> This moves it out of the way of SystemTap's rather different sdt.h, and lets
> us remove the barely-working kludgery in the specfile to work around it.
> Right now, the new location is nailed into every user (since sdt.h required
> no special cpp flags before now), but this is hardly a good long-term
> solution: a better one will be forthcoming soon.

Tests of this now completed: no new fails anywhere I've tried: RPMs,
"make install test-install" and direct source tree testing all works,
with no sign of inability to find sdt.h anywhere in the logs.

-- 
NULL && (void)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-24 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-23 21:41 [PATCH v2 1/2] build: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock
2024-05-23 21:41 ` [PATCH v2 2/2] build: initial pkg-config support Nick Alcock
2024-05-24 14:52 ` [PATCH v2 1/2] build: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox