diff --git a/0001-feat-enable-debuginfo.patch b/0001-feat-enable-debuginfo.patch new file mode 100644 index 0000000000000000000000000000000000000000..f3a2ea704c9f9d61e0768e3b7b22639824ce4088 --- /dev/null +++ b/0001-feat-enable-debuginfo.patch @@ -0,0 +1,50 @@ +From e72e2420e9aeeb3aaa8216dfb533770bee59e0ed Mon Sep 17 00:00:00 2001 +From: leeffo +Date: Tue, 14 Mar 2023 13:52:27 +0800 +Subject: [PATCH] feat: enable debuginfo + +--- + CMakeLists.txt | 6 +++--- + tests/UnitTest/CMakeLists.txt | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6b0e943..7df476b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.9.5) + set(EXE_NAME compressor) + project(${EXE_NAME}) + +-#SET(CMAKE_BUILD_TYPE "Debug") +-#SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb") ++SET(CMAKE_BUILD_TYPE "Debug") ++SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb") + + + # 添加c++ 11标准支持 +@@ -15,7 +15,7 @@ set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -std=c++11" ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--as-needed -fPIE -fPIC") #-Wl,--as-needed 减少无效的库链接,用不到的库需要清理 + + if(${CMAKE_BUILD_TYPE} MATCHES "Debug") +- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -Wall -g -ggdb -Wl,-rpath=../lib:/usr/lib/deepin-compressor/plugins") ++ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -Wall -g -ggdb") + else() + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wl,-O1,-rpath=/usr/lib/deepin-compressor/plugins") + endif() +diff --git a/tests/UnitTest/CMakeLists.txt b/tests/UnitTest/CMakeLists.txt +index d6fa523..bff647b 100644 +--- a/tests/UnitTest/CMakeLists.txt ++++ b/tests/UnitTest/CMakeLists.txt +@@ -8,7 +8,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -fno-acce + set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/test_output/) + + if(${CMAKE_BUILD_TYPE} MATCHES "Debug") +- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -Wall -g -ggdb -Wl,-rpath=\"${LIBRARY_OUTPUT_PATH}\":/usr/lib/deepin-compressor/plugins") ++ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -Wall -g -ggdb") + else() + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wl,-O1,-rpath=\"${LIBRARY_OUTPUT_PATH}\":/usr/lib/deepin-compressor/plugins") + endif() +-- +2.20.1 + diff --git a/deepin-compressor.spec b/deepin-compressor.spec index 93881c213e3933c884a9c9c51ae8940ea162236f..756c5c1acab80119521cf14c814c70aa3eb2c2d0 100644 --- a/deepin-compressor.spec +++ b/deepin-compressor.spec @@ -1,7 +1,4 @@ -%define specrelease 1%{?dist} -%if 0%{?openeuler} -%define specrelease 2 -%endif +%define specrelease 3 Name: deepin-compressor Version: 5.10.5 @@ -10,6 +7,7 @@ Summary: A fast and lightweight application for creating and extracting a License: GPLv3+ URL: https://github.com/linuxdeepin/deepin-devicemanager Source0: %{name}-%{version}.tar.gz +Patch0: 0001-feat-enable-debuginfo.patch BuildRequires: gcc-c++ BuildRequires: cmake @@ -30,6 +28,7 @@ BuildRequires: libarchive-devel BuildRequires: minizip-devel BuildRequires: poppler-cpp-devel BuildRequires: gtest-devel gmock +BuildRequires: chrpath Requires: p7zip Requires: lz4-libs @@ -41,7 +40,7 @@ Recommends: unrar p7zip-plugins %{summary}. %prep -%autosetup +%autosetup -p1 %build export PATH=%{_qt5_bindir}:$PATH @@ -56,6 +55,21 @@ popd %install %make_install -C build INSTALL_ROOT="%buildroot" +# remove rpath info +for file in $(find %{buildroot}/ -executable -type f -exec file {} ';' | grep "\" | awk -F ':' '{print $1}') +do + if [ ! -u "$file" ]; then + if [ -w $file ]; then + chrpath -d $file + fi + fi +done + +# add rpath path in ld.so.conf.d +mkdir -p %{buildroot}/%{_sysconfdir}/ld.so.conf.d +echo "%{_bindir}/%{name}" > %{buildroot}/%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf +echo "%{_libdir}/%{name}/plugins/" > %{buildroot}/%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf + %files %doc README.md %license LICENSE @@ -68,8 +82,18 @@ popd %{_datadir}/mime/packages/%{name}.xml %{_datadir}/deepin-manual/manual-assets/application/deepin-compressor/archive-manager/* %{_datadir}/applications/context-menus/*.conf +%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig %changelog +* Tue Mar 14 2023 liweigang - 5.10.5-3 +- feat: remove rpath + * Fri Aug 05 2022 liweigang - 5.10.5-2 - fix nothing install requires