Build a static library, instead of a shared object 21/64621/1
authorMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 4 Apr 2016 08:25:29 +0000 (17:25 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 4 Apr 2016 08:25:29 +0000 (17:25 +0900)
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 <muwoong.lee@samsung.com>
CMakeLists.txt
packaging/context-provider.spec

index ff1cbd9277dea95a243ad8236435b1610032ff7a..42e2659fb808eb0299099e47531e18a0c128d301 100644 (file)
@@ -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}")
index cb86c926d9f70775ecf1be183e9a317e10afc027..3ddb5eb08a9170ef6298506b4f587e38ca5f6374 100644 (file)
@@ -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