From: Mu-Woong Lee Date: Mon, 4 Apr 2016 08:25:29 +0000 (+0900) Subject: Build a static library, instead of a shared object X-Git-Tag: submit/tizen/20160408.073002^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=644deafe405a7b068c9c9709e22ce50e579b8acc;p=platform%2Fcore%2Fcontext%2Fcontext-provider.git Build a static library, instead of a shared object The library is only being used by contextd, thus it does not need to be a shared object. Change-Id: I0dd3acd582070b946053f87b54f924288c75b8a9 Signed-off-by: Mu-Woong Lee --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ff1cbd9..42e2659 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,8 @@ SET(compile_defs "LOG_TAG=\"CONTEXT\"") INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/include ) -ADD_DEFINITIONS(-O2 -Wall -fPIC -fvisibility=hidden -Wl,--as-needed) +ADD_DEFINITIONS(-O2 -Wall -fPIC -fdata-sections -ffunction-sections -fvisibility=hidden) +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIC -Wl,--as-needed -Wl,--gc-section -Wl,--print-gc-section") # Base Dependency SET(dependencies libcontext-shared libcontext-server) @@ -38,7 +39,7 @@ FOREACH(flag ${DEPS_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -ADD_LIBRARY(${target} SHARED ${sources}) +ADD_LIBRARY(${target} STATIC ${sources}) TARGET_LINK_LIBRARIES(${target} ${DEPS_LDFLAGS}) SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS}) SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITIONS "${compile_defs}") diff --git a/packaging/context-provider.spec b/packaging/context-provider.spec index cb86c92..3ddb5eb 100644 --- a/packaging/context-provider.spec +++ b/packaging/context-provider.spec @@ -7,6 +7,7 @@ License: Apache-2.0 Source0: %{name}-%{version}.tar.gz %define BUILD_PROFILE %{?profile}%{!?profile:%{?tizen_profile_name}} +%define keepstatic 1 BuildRequires: cmake @@ -64,8 +65,8 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` export CFLAGS+=" -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-parameter" export CXXFLAGS+=" -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wswitch-default -Wno-unused-parameter" -export CFLAGS+=" -Wno-empty-body -fno-omit-frame-pointer -fno-optimize-sibling-calls" -export CXXFLAGS+=" -Wno-empty-body -fno-omit-frame-pointer -fno-optimize-sibling-calls" +export CFLAGS+=" -Wno-empty-body -fomit-frame-pointer -fno-optimize-sibling-calls" +export CXXFLAGS+=" -Wno-empty-body -fomit-frame-pointer -fno-optimize-sibling-calls" export CFLAGS+=" -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow" export CXXFLAGS+=" -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow" @@ -100,7 +101,6 @@ cp LICENSE %{buildroot}/usr/share/license/%{name} %files %manifest packaging/%{name}.manifest %defattr(-,root,root,-) -%{_libdir}/*.so* /usr/share/license/%{name} %package devel @@ -115,3 +115,4 @@ Context Provider (Development) %defattr(-,root,root,-) %{_includedir}/context-service/internal/*.h %{_libdir}/pkgconfig/%{name}.pc +%{_libdir}/*.a