pc: add capi-system-usbhost.pc file
authorTaeyoung Kim <ty317.kim@samsung.com>
Fri, 17 Jul 2015 09:07:53 +0000 (18:07 +0900)
committerStanislaw Wadas <s.wadas@samsung.com>
Wed, 2 Dec 2015 12:50:46 +0000 (13:50 +0100)
- PC file is necessary for other apps to use apis.
  Thus capi-system-usbhost.pc is added.
- The name of the library is changed from "libhusb"
  to "capi-system-usbhost". The name would not be changed
  and the keyword "husb" which is used for header file and
  each api is not related with the library name.

Change-Id: I5ebd6bbc7992dff85b446abd6a4e05bf0a6694fe
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
CMakeLists.txt
capi-system-usbhost.pc.in [new file with mode: 0644]
packaging/capi-system-usbhost.spec

index 36643945d0e3a58137017d82784e87e9460f40ef..3226c9ed39c63fa0ec8673d92a93d58b45cffc01 100644 (file)
@@ -1,5 +1,5 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(libhusb)
+PROJECT(capi-system-usbhost)
 ########################################################
 # Generation options:
 # -DBUILD_DOC_ONLY - only doxygen documentation is build
@@ -20,6 +20,8 @@ ELSE(BUILD_DOC_ONLY)
        SET(BUILD_SHARED_LIBS TRUE)
 ENDIF(BUILD_DOC_ONLY)
 
+SET(LIBNAME ${PROJECT_NAME})
+
 IF(BUILD_SHARED_LIBS)
 
        SET(HOST_CAPI_SRCS
@@ -42,10 +44,15 @@ IF(BUILD_SHARED_LIBS)
        INCLUDE(FindPkgConfig)
        pkg_check_modules(pkgs REQUIRED ${PKG_MODULES})
 
-       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -O0 -Wall -lusb-1.0")
+       FOREACH(flag ${pkgs_CFLAGS})
+               SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+       ENDFOREACH(flag)
+
+       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -O0 -Wall")
 
-       ADD_LIBRARY(husb SHARED ${HOST_CAPI_SRCS})
-       SET_TARGET_PROPERTIES(husb PROPERTIES
+       ADD_LIBRARY(${LIBNAME} SHARED ${HOST_CAPI_SRCS})
+       TARGET_LINK_LIBRARIES(${LIBNAME} ${pkgs_LDFLAGS} "-ldl")
+       SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES
                SOVERSION 0
                VERSION 0.1.0
        )
@@ -53,10 +60,10 @@ IF(BUILD_SHARED_LIBS)
        INSTALL(FILES include/libhusb.h DESTINATION ${INCLUDEDIR}/)
        INSTALL(FILES src/40-usb.rules DESTINATION /usr/lib/udev/rules.d)
 
-       INSTALL(TARGETS husb ARCHIVE
-               DESTINATION ${LIBDIR}
-               LIBRARY DESTINATION ${LIBDIR}
-               COMPONENT husb)
+       INSTALL(TARGETS ${LIBNAME} DESTINATION ${LIBDIR})
+
+       CONFIGURE_FILE(${LIBNAME}.pc.in ${LIBNAME}.pc @ONLY)
+       INSTALL(FILES ${CMAKE_BINARY_DIR}/${LIBNAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
        # uninstall target
        configure_file(
diff --git a/capi-system-usbhost.pc.in b/capi-system-usbhost.pc.in
new file mode 100644 (file)
index 0000000..6233a57
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=@LIB_INSTALL_DIR@
+includedir=${prefix}/include
+
+Name: @LIBNAME@
+Description: apis for usb host devices
+Version: @VERSION@
+Requires: @PKG_MODULES@
+Libs: -L${libdir} -l@LIBNAME@
+Cflags: -I${includedir}/
index c9e584c2268c6053928dfb1c935cc2f8aa70a818..1e08622e2f7e7be015c9a7b8a9b6d47d5bb1113d 100644 (file)
@@ -5,8 +5,8 @@ License:        Apache-2.0
 Summary:        RAW USB host API
 Group:          Base/Device Management
 
-Source0:        libhusb-%{version}.tar.gz
-Source1001:     capi-system-usbhost.manifest
+Source0:        %{name}-%{version}.tar.gz
+Source1001:     %{name}.manifest
 Source1002:     libUSD-client.manifest
 Source1003:     USD.manifest
 BuildRequires:  pkg-config
@@ -31,8 +31,8 @@ Group:      Development/Libraries
 Requires:   %{name} = %{version}-%{release}
 
 %description devel
-Development package for libhusb. Contains headers and binaries required for
-compilation of applications which use libhusb.
+Development package for capi-system-usbhost. Contains headers and binaries required for
+compilation of applications which use capi-system-usbhost.
 
 %prep
 %setup -q
@@ -43,12 +43,9 @@ cp %{SOURCE1003} .
 
 %build
 
-%if 0%{?sec_build_binary_debug_enable}
 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
-%endif
-
 export LDFLAGS="${LDFLAGS} -Wl,--rpath=%{_libdir}"
 
 %cmake . -DVERSION=%{version} \
@@ -85,15 +82,16 @@ rm -rf %{buildroot}
 %manifest %{name}.manifest
 %defattr(-,root,root)
 %license LICENSE
-%{_libdir}/libhusb.so.*
-%{_libdir}/libhusb.so.*.*.*
+%{_libdir}/lib%{name}.so.*
+%{_libdir}/lib%{name}.so.*.*.*
 /usr/lib/udev/rules.d/40-usb.rules
 
 %files devel
 %manifest %{name}.manifest
 %defattr(-,root,root)
 %{_includedir}/libhusb.h
-%{_libdir}/libhusb.so
+%{_libdir}/lib%{name}.so
+%{_libdir}/pkgconfig/%{name}.pc
 
 %package usd
 Summary:    Usb securit daemon and utilities
@@ -180,6 +178,6 @@ fi
 %{_libdir}/libusd-client.so
 %{_libdir}/libusd-commons.so
 %{_includedir}/usd/usb-security-daemon.h
-%{_libdir}/pkgconfig/*.pc
+%{_libdir}/pkgconfig/capi-system-usbhost-usd.pc
 
 %changelog