--- /dev/null
+print_cmdline=true:log_path=/tmp/ubsan.log
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+
+# /usr/lib/rpm/tizen/extract-ubsan-logs
+
+# If using normal root, avoid changing anything.
+if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
+ exit 0
+fi
+
+mkdir -p "$RPM_BUILD_ROOT/usr/share/ubsan"
+find "/tmp/" -name 'ubsan.log*' | xargs -I {} cp {} "$RPM_BUILD_ROOT/usr/share/ubsan/"
+find "$RPM_BUILD_ROOT/usr/share/ubsan/" -name 'ubsan.log*' | xargs -I {} sed -e "s#/.*rpmbuild/##" -i {}
+find "$RPM_BUILD_ROOT/usr/share/ubsan/" -name 'ubsan.log*' -exec rename ubsan ${RPM_PACKAGE_NAME}-ubsan {} \;
+
+# Avoid empty resulting RPMs: create a placeholder if there's no logs in directory.
+(find "$RPM_BUILD_ROOT/usr/share/ubsan/" -mindepth 1 -print -quit | grep -q .) || \
+ touch "$RPM_BUILD_ROOT/usr/share/ubsan/ubsan.log.empty"
Source18: asan_symbolize.py
Source19: LSAN_OPTIONS
Source20: gcc.manifest
+Source21: UBSAN_OPTIONS
+Source22: macros.ubsan
+Source23: extract-ubsan-logs
Group: Development/Building
Summary: The GNU C Compiler and Support Files
License: GPL-3.0+
[ -d /emul/ ] && chmod a-w /emul/usr/bin/ && chmod a-w /emul/home/abuild/rpmbuild/BUILD/gcc-4.9.2/obj/gcc/
/usr/bin/gcc-unforce-options
+%package -n ubsan-build-env
+Summary: UBSan build environment
+Group: System Environment
+Requires: gcc
+Requires: libubsan rpm
+
+%description -n ubsan-build-env
+UBSan build environment support files and scripts
+
+%post -n ubsan-build-env
+cat %{_rpmconfigdir}/macros.ubsan >> %{_rpmconfigdir}/tizen_macros
+
%package -n lsan-force-options
Summary: Scripts to enable automatic package sanitization
Group: System Environment
mkdir -p %{buildroot}/src
mv -v libsanitizer.tar.bz %{buildroot}/src
+mkdir -p %{buildroot}/%{_rpmconfigdir}/tizen/
+install -m 0644 %{SOURCE21} %{buildroot}/
+install -m 0644 %{SOURCE22} %{buildroot}/%{_rpmconfigdir}/
+install -m 0755 %{SOURCE23} %{buildroot}/%{_rpmconfigdir}/tizen/
}
%files
/LSAN_OPTIONS
%endif
+%ifarch %ubsan_arch
+%files -n ubsan-build-env
+%defattr(-,root,root,-)
+/UBSAN_OPTIONS
+%{_rpmconfigdir}/macros.ubsan
+%{_rpmconfigdir}/tizen/extract-ubsan-logs
+%endif
+
%files -n sanitizer-devel
%defattr(-,root,root,-)
%{_prefix}/bin/asan_symbolize.py
Source18: asan_symbolize.py
Source19: LSAN_OPTIONS
Source20: gcc.manifest
+Source21: UBSAN_OPTIONS
+Source22: macros.ubsan
+Source23: extract-ubsan-logs
Group: Development/Building
Summary: The GNU C Compiler and Support Files
License: GPL-3.0+
[ -d /emul/ ] && chmod a-w /emul/usr/bin/ && chmod a-w /emul/home/abuild/rpmbuild/BUILD/gcc-4.9.2/obj/gcc/
/usr/bin/gcc-unforce-options
+%package -n ubsan-build-env
+Summary: UBSan build environment
+Group: System Environment
+Requires: gcc
+Requires: libubsan rpm
+
+%description -n ubsan-build-env
+UBSan build environment support files and scripts
+
+%post -n ubsan-build-env
+cat %{_rpmconfigdir}/macros.ubsan >> %{_rpmconfigdir}/tizen_macros
+
%package -n lsan-force-options
Summary: Scripts to enable automatic package sanitization
Group: System Environment
mkdir -p %{buildroot}/src
mv -v libsanitizer.tar.bz %{buildroot}/src
+mkdir -p %{buildroot}/%{_rpmconfigdir}/tizen/
+install -m 0644 %{SOURCE21} %{buildroot}/
+install -m 0644 %{SOURCE22} %{buildroot}/%{_rpmconfigdir}/
+install -m 0755 %{SOURCE23} %{buildroot}/%{_rpmconfigdir}/tizen/
}
%files
/LSAN_OPTIONS
%endif
+%ifarch %ubsan_arch
+%files -n ubsan-build-env
+%defattr(-,root,root,-)
+/UBSAN_OPTIONS
+%{_rpmconfigdir}/macros.ubsan
+%{_rpmconfigdir}/tizen/extract-ubsan-logs
+%endif
+
%files -n sanitizer-devel
%defattr(-,root,root,-)
%{_prefix}/bin/asan_symbolize.py
Source18: asan_symbolize.py
Source19: LSAN_OPTIONS
Source20: gcc.manifest
+Source21: UBSAN_OPTIONS
+Source22: macros.ubsan
+Source23: extract-ubsan-logs
Group: Development/Building
Summary: The GNU C Compiler and Support Files
License: GPL-3.0+
[ -d /emul/ ] && chmod a-w /emul/usr/bin/ && chmod a-w /emul/home/abuild/rpmbuild/BUILD/gcc-4.9.2/obj/gcc/
/usr/bin/gcc-unforce-options
+%package -n ubsan-build-env
+Summary: UBSan build environment
+Group: System Environment
+Requires: gcc
+Requires: libubsan rpm
+
+%description -n ubsan-build-env
+UBSan build environment support files and scripts
+
+%post -n ubsan-build-env
+cat %{_rpmconfigdir}/macros.ubsan >> %{_rpmconfigdir}/tizen_macros
+
%package -n lsan-force-options
Summary: Scripts to enable automatic package sanitization
Group: System Environment
mkdir -p %{buildroot}/src
mv -v libsanitizer.tar.bz %{buildroot}/src
+mkdir -p %{buildroot}/%{_rpmconfigdir}/tizen/
+install -m 0644 %{SOURCE21} %{buildroot}/
+install -m 0644 %{SOURCE22} %{buildroot}/%{_rpmconfigdir}/
+install -m 0755 %{SOURCE23} %{buildroot}/%{_rpmconfigdir}/tizen/
}
%files
/LSAN_OPTIONS
%endif
+%ifarch %ubsan_arch
+%files -n ubsan-build-env
+%defattr(-,root,root,-)
+/UBSAN_OPTIONS
+%{_rpmconfigdir}/macros.ubsan
+%{_rpmconfigdir}/tizen/extract-ubsan-logs
+%endif
+
%files -n sanitizer-devel
%defattr(-,root,root,-)
%{_prefix}/bin/asan_symbolize.py
--- /dev/null
+# /etc/rpm/macros.ubsan
+
+%_enable_ubsan_packages 1
+
+%__ubsan_install_post /usr/lib/rpm/tizen/extract-ubsan-logs
+
+# See original macro (before expansion) and correct lines after the first one.
+# Mine is from Fedora RPM macros, YMMV.
+%__spec_install_post\
+ %{?__ubsan_package:%{__ubsan_install_post}}\
+ %{?__debug_package:%{__debug_install_post}}\
+ %{__arch_install_post}\
+ %{__os_install_post}\
+%{nil}
+
+# Same goes here, see your original macro.
+%install %{?_enable_ubsan_packages:%{ubsan_package}}\
+%{?_enable_debug_packages:%{debug_package}}\
+%%install\
+LANG=C\
+export LANG\
+unset DISPLAY\
+rm -rf %{?buildroot:%{buildroot}} \
+mkdir -p %{?buildroot:%{buildroot}} \
+%{nil}
+
+# Template for ubsan logs sub-package.
+%ubsan_package \
+%global __ubsan_package 1\
+%package ubsan-logs\
+Summary: UBSan logs for package %{name}\
+Group: Development/UBSan\
+AutoReqProv: 0\
+%description ubsan-logs\
+This package provides UBSan log files for package %{name}.\
+%files ubsan-logs\
+%defattr(-,root,root)\
+/usr/share/ubsan/*ubsan.log*\
+%{nil}