Add spec for tizen rpm packaging accepted/tizen_unified_riscv accepted/tizen/unified/20231215.165151 accepted/tizen/unified/riscv/20230816.131521
authorAnas Nashif <anas.nashif@intel.com>
Wed, 16 Aug 2023 00:48:06 +0000 (09:48 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 16 Aug 2023 08:31:45 +0000 (17:31 +0900)
Add tizen rpm spec.

gdb could be tested by adding --define 'run_tests 1' just like
the rest of toolchain.

Requires dependency to python3, libpython3 and libgmp.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Jacek Bukarewicz <j.bukarewicz@samsung.com>
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Signed-off-by: Vyacheslav Barinov <v.barinov@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
Signed-off-by: Sungguk Na <sungguk.na@samsung.com>
Signed-off-by: Sungguk Na <sungguk.na@samsung.com>
Signed-off-by: Seungha Son <seungha.son@samsung.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Signed-by-off: wchang kim <wchang.kim@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
gdbserver/Makefile.in
packaging/gdb.changes [new file with mode: 0644]
packaging/gdb.manifest [new file with mode: 0644]
packaging/gdb.spec [new file with mode: 0644]

index 040f0b6..9681239 100644 (file)
@@ -162,6 +162,7 @@ INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER
 # when running make.
 LDFLAGS = @LDFLAGS@
 INTERNAL_LDFLAGS = $(LDFLAGS) @RDYNAMIC@
+IPA_INTERNAL_LDFLAGS = $(IPA_LDFLAGS) @RDYNAMIC@
 
 # All source files that go into linking GDB remote server.
 
@@ -387,7 +388,7 @@ IPA_LIB = libinproctrace.so
 $(IPA_LIB): $(sort $(IPA_OBJS)) ${CDEPS}
        $(SILENCE) rm -f $(IPA_LIB)
        $(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \
-               -Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
+               -Wl,--no-undefined $(INTERNAL_CFLAGS) $(IPA_INTERNAL_LDFLAGS) \
                 $(CXXFLAGS) \
                -o $(IPA_LIB) ${IPA_OBJS} $(LIBIBERTY_FOR_SHLIB) -ldl -pthread
 
@@ -486,7 +487,7 @@ IPAGENT_CFLAGS = $(INTERNAL_CFLAGS) $(UST_CFLAGS) \
 
 # CXXFLAGS is at the very end on purpose, so that user-supplied flags can
 # override internal flags.
-IPAGENT_COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(IPAGENT_CFLAGS) $(CXXFLAGS) $(COMPILE.post)
+IPAGENT_COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(IPAGENT_CFLAGS) $(LIB_CXXFLAGS) $(COMPILE.post)
 
 # Rules for special cases.
 
diff --git a/packaging/gdb.changes b/packaging/gdb.changes
new file mode 100644 (file)
index 0000000..6c2df49
--- /dev/null
@@ -0,0 +1,11 @@
+* Tue Nov 04 2014 Chanho Park <chanho61.park@samsung.com> upstream/7.8.1-7-g71c34aa
+- Imported Upstream version 7.8.1
+
+* Thu Jul 31 2014 Chanho Park <chanho61.park@samsung.com> upstream/7.8-6-g345d6cc
+- Imported Upstream version 7.8
+
+* Tue Sep 24 2013 Anas Nashif <anas.nashif@intel.com> upstream/7.5.1@47cabd6
+- Update to 7.5.1
+- Set license using %license
+- resetting manifest requested domain to floor
+
diff --git a/packaging/gdb.manifest b/packaging/gdb.manifest
new file mode 100644 (file)
index 0000000..017d22d
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+    <domain name="_"/>
+ </request>
+</manifest>
diff --git a/packaging/gdb.spec b/packaging/gdb.spec
new file mode 100644 (file)
index 0000000..e63a5a6
--- /dev/null
@@ -0,0 +1,178 @@
+%if 0%{?run_tests}
+%define gdb_run_tests 1
+%endif
+
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('gdb_run_tests 1')
+# 2. Skip configure and make commands and go directly to 'make check'
+%if 0%{?run_tests_on_device}
+%define gdb_run_tests 1
+%define gdb_skip_configure 1
+%define gdb_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by gdb build
+%if 0%{?exit_on_make_finish}
+%define gdb_exit_on_make_finish 1
+%endif
+
+Name:           gdb
+Version:        13.2
+Release:        0
+License:        GPL-3.0+
+Summary:        A GNU source-level debugger for C, C++, Java and other languages
+Url:            http://gnu.org/software/gdb/
+Group:          Development/Toolchain
+Source:         ftp://ftp.gnu.org/gnu/gdb/gdb-%{version}.tar.gz
+Source1001:     gdb.manifest
+%define gdb_src gdb-%{version}
+%define gdb_build build-%{_target_platform}
+Requires:       python3
+Requires:       libgmp
+BuildRequires:  bison
+BuildRequires:  expat-devel
+BuildRequires:  flex
+BuildRequires:  gettext-tools
+BuildRequires:  python3-devel
+BuildRequires:  gcc-c++
+BuildRequires:  ncurses-devel
+BuildRequires:  makeinfo
+BuildRequires:  gmp-devel
+%if 0%{?gdb_run_tests}
+BuildRequires:  dejagnu
+BuildRequires:  glibc-devel-static
+%endif
+
+%description
+GDB, the GNU debugger, allows you to debug programs written in C, C++,
+Java, and other languages, by executing them in a controlled fashion
+and printing their data.
+
+%package devel
+Summary:        Development files for gdb
+
+%description devel
+Development files for gdb.
+
+%ifnarch riscv64
+%package server
+Summary:        A standalone server for GDB (the GNU source-level debugger)
+
+%description server
+GDB, the GNU debugger, allows you to debug programs written in C, C++,
+Java, and other languages, by executing them in a controlled fashion
+and printing their data.
+
+This package provides a program that allows you to run GDB on a different machine than the one which is running the program being debugged.
+%endif
+
+%{?gdb_run_tests:
+%package testresults
+Summary:       Testsuite results
+License:       Public Domain
+Group:         Development/Building
+%description testresults
+Results from running the gdb tests.
+}
+
+%prep
+%setup -q
+cp %{SOURCE1001} .
+
+# Remove the info and other generated files added by the FSF release
+# process.
+rm -f libdecnumber/gstdint.h
+rm -f bfd/doc/*.info
+rm -f bfd/doc/*.info-*
+rm -f gdb/doc/*.info
+rm -f gdb/doc/*.info-*
+
+%build
+export CFLAGS+=" -fPIE"
+#If you want to add a new LDFLAGS to IPA, add it to `IPA_LDFLAGS` rather than` LDFLAGS`.
+export LIB_CXXFLAGS=$CXXFLAGS
+export IPA_LDFLAGS=$LDFLAGS
+export CXXFLAGS+=" -fPIE"
+export LDFLAGS+=" -pie"
+
+%{!?gdb_skip_configure:
+%configure                                             \
+       --with-gdb-datadir=%{_datadir}/gdb              \
+       --enable-gdb-build-warnings=,-Wno-unused        \
+       --disable-werror                                \
+       --with-separate-debug-dir=/usr/lib/debug        \
+       %{!?gdb_run_tests:--disable-sim}                \
+       --disable-rpath                                 \
+       --with-expat                                    \
+       --enable-64-bit-bfd                             \
+       --enable-debug                                  \
+       %{!?gdb_run_tests: --enable-static --disable-shared}
+}
+
+%{!?gdb_skip_make:
+make %{?_smp_mflags}
+}
+
+%{?gdb_exit_on_make_finish:
+exit 1
+}
+
+%{?gdb_run_tests:
+echo "Run testsuite"
+# asan needs a whole shadow address space
+ulimit -v unlimited || true
+make -k check %{?_smp_mflags} || true
+mkdir ./testresults
+for tool in $(find -name '*.sum' -exec basename {} \; | sort -u | sed -e 's/.sum//'); do
+./contrib/dg-extract-results.sh -t $tool $(find -name '*.sum') | tee -a ./testresults/test_summary.txt
+done
+}
+
+
+%install
+%make_install
+
+%{?gdb_run_tests:
+  find . \( -name "*.sum" -o -name "*.log" -a \! -name "config.log" \) -exec tar -rf testresults.tar {} \;
+  mkdir -p ./testresults && tar -xf testresults.tar -C ./testresults
+  find ./testresults/ -type f -exec chmod 644 {} \;
+}
+
+%find_lang opcodes
+%find_lang bfd
+mv opcodes.lang %{name}.lang
+cat bfd.lang >> %{name}.lang
+
+%docs_package
+
+%lang_package
+
+%files
+%defattr(-,root,root)
+%manifest %{name}.manifest
+%license COPYING COPYING.LIB
+%{_bindir}/*
+%{_datadir}/gdb
+
+%ifnarch riscv64
+%files server
+%manifest %{name}.manifest
+%defattr(-,root,root)
+%{_bindir}/gdbserver
+%{_mandir}/*/gdbserver.1*
+%ifarch %{ix86} x86_64 aarch64
+%{_libdir}/libinproctrace.so
+%endif
+%endif
+
+%files devel
+%manifest %{name}.manifest
+%{_includedir}/*.h
+%{_includedir}/gdb/*.h
+
+%{?gdb_run_tests:
+%files testresults
+%defattr(-,root,root)
+%doc testresults/test_summary.txt
+%doc testresults/*
+}