Make the main version of the library a shared object (.so) 07/145307/2
authorJaemin Ryu <jm77.ryu@samsung.com>
Tue, 22 Aug 2017 05:06:42 +0000 (14:06 +0900)
committerJaemin Ryu <jm77.ryu@samsung.com>
Tue, 22 Aug 2017 05:12:54 +0000 (14:12 +0900)
This applies reverted commit 7a861dd40cc6661d2085d44d402c801c79feaaf9

>> Author: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
>> Date:   Fri May 5 16:06:17 2017 +0200
>>
>>    Make the main version of the library a shared object (.so)
>>
>>    Additionally split into 2 packages:
>>    - klay        - shared library
>>    - klay-devel  - headers, pkg-config file and library for linking

Change-Id: I6e4bca44bd07f38db86a4071077ab9097d072792

klay.pc.in
packaging/klay.spec
src/CMakeLists.txt

index 939e7128a5651adbdc9f7a5e16ffa5ea2ef6c60c..ff6dd98bc32072a04850fcd7933740b89a4be4cc 100644 (file)
@@ -6,8 +6,7 @@ libdir=@LIB_INSTALL_DIR@
 includedir=@INCLUDE_INSTALL_DIR@
 
 Name: klay
-Description: Tizen Klay static library and header files
-Requires : dlog glib-2.0 sqlite3 libxml-2.0 libtzplatform-config
+Description: Tizen Klay library and header files
 Version: @VERSION@
 Libs: -L${libdir} -lklay
 Cflags: -I${includedir}/klay
index 64cbf890ea0d007538e7fad0f81e7a886b5ce828..5ead7f0f80076ffb8f9b3ef8e97bfee71893c976 100755 (executable)
@@ -1,10 +1,9 @@
-%define keepstatic 1
 Name:    klay
 Version: 0.0.1
 Release: 0
 License: Apache-2.0
 Source0: file://%{name}-%{version}.tar.gz
-Summary: Tizen Klay static library and header files
+Summary: Tizen Klay library
 Group:   Development/Libraries
 BuildRequires: gcc
 BuildRequires: cmake
@@ -13,16 +12,17 @@ BuildRequires: pkgconfig(sqlite3)
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(libxml-2.0)
 BuildRequires: pkgconfig(libtzplatform-config)
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
 
 %description
-The klay package provides a static library and header files
-which can be used for many servers and clients
+The klay package provides a library which can be used for many servers
+and clients.
 
 %files
 %defattr(644,root,root,755)
-%{_libdir}/*.a
-%{_libdir}/pkgconfig/*.pc
-%{_includedir}/klay
+%attr(755,root,root) %{_libdir}/libklay.so.%{version}
+%{_libdir}/libklay.so.0
 
 %prep
 %setup -q
@@ -47,21 +47,37 @@ make %{?jobs:-j%jobs}
 %clean
 rm -rf %{buildroot}
 
-%preun
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+## Devel Package ##############################################################
+%package devel
+Summary: Tizen Klay development package
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+The klay-devel package provides libraries and header files necessary for
+developing with the Klay library.
 
-%postun
+%files devel
+%defattr(644,root,root,755)
+%{_libdir}/libklay.so
+%{_libdir}/pkgconfig/*.pc
+%{_includedir}/klay
 
 ## Test Package ##############################################################
-%package -n klay-test
+%package test
 Summary: Klay test
 Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
 
-%description -n klay-test
-Testcases for klay library
+%description test
+Testcases for klay library.
 
-%files -n klay-test
-%defattr(755,root,root,755)
-%{_bindir}/klay-test
-%{TZ_SYS_DATA}/klay-test/test-proc.sh
-%defattr(-,root,root,-)
+%files test
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/klay-test
+%attr(755,root,root) %{TZ_SYS_DATA}/klay-test/test-proc.sh
 %{TZ_SYS_DATA}/klay-test/sample-policy.xml
index 2c23264d2b84882e52d42b3fae9590ea23a737f8..b43848e6fa635db1aa79e9763693e502ba651a3c 100755 (executable)
@@ -13,6 +13,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+SET(LIB_VERSION "${VERSION}")
+SET(LIB_SOVERSION "0")
+
 SET (KLAY_SOURCES              ${KLAY_SRC}/error.cpp
                                                ${KLAY_SRC}/cgroup.cpp
                                                ${KLAY_SRC}/process.cpp
@@ -56,7 +59,9 @@ SET (KLAY_SOURCES             ${KLAY_SRC}/error.cpp
 
 SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,noexecstack")
 
-ADD_LIBRARY(${PROJECT_NAME} STATIC ${KLAY_SOURCES})
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${KLAY_SOURCES})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${LIB_SOVERSION})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION   ${LIB_VERSION})
 
 PKG_CHECK_MODULES(KLAY_DEPS REQUIRED   gio-2.0
                                                                                libxml-2.0
@@ -70,5 +75,5 @@ INCLUDE_DIRECTORIES(SYSTEM    ${KLAY_INCLUDE}
 
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${KLAY_DEPS_LIBRARIES} ${LFS_LDFLAGS} ${LFS_LIBS})
 
-INSTALL(TARGETS        ${PROJECT_NAME} DESTINATION     ${LIB_INSTALL_DIR}      COMPONENT DevelopmentLibraries)
-INSTALL(DIRECTORY ${KLAY_INCLUDE}/ DESTINATION ${INCLUDE_INSTALL_DIR})
+INSTALL(TARGETS        ${PROJECT_NAME}                 DESTINATION     ${LIB_INSTALL_DIR}      COMPONENT DevelopmentLibraries)
+INSTALL(DIRECTORY ${KLAY_INCLUDE}/             DESTINATION ${INCLUDE_INSTALL_DIR})