2 # Copyright (c) 2008 ~ 2010 Samsung Electronics Co., Ltd.
6 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
7 SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
9 PROJECT(package-manager C)
14 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
15 SET(EXEC_PREFIX "\${prefix}")
16 SET(LIBDIR ${LIB_INSTALL_DIR})
17 SET(INCLUDEDIR "\${prefix}/include")
20 set(CMAKE_SKIP_BUILD_RPATH true)
23 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/comm )
25 INCLUDE(FindPkgConfig)
26 pkg_check_modules(pkgs REQUIRED security-server dlog elementary evas ecore appcore-efl ecore-x ail ecore-file pkgmgr-info iniparser)
28 FOREACH(flag ${pkgs_CFLAGS})
29 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
32 pkg_check_modules(libpkgs REQUIRED dbus-glib-1 dlog ail pkgmgr-info iniparser)
34 FOREACH(flag ${libpkgs_CFLAGS})
35 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
38 SET(pm_dir "${CMAKE_SOURCE_DIR}")
39 SET(pm_inc_dir "${pm_dir}/include")
40 SET(pm_c_src_dir "${pm_dir}/client/src")
41 SET(pm_c_inc_dir "${pm_dir}/client/include")
42 SET(pm_s_src_dir "${pm_dir}/server/src")
43 SET(pm_s_inc_dir "${pm_dir}/server/include")
44 SET(pm_t_inc_dir "${pm_dir}/types/include")
47 SET(debug_type "-DPM_CONSOLE_USE") # for debug - use console window
50 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
51 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -Wall")
52 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
55 ## build comm libraries
56 add_subdirectory(comm)
57 add_subdirectory(tool)
58 add_subdirectory(types)
60 ###################################################################################################
61 ## for libpkgmgr-client.so (library)
62 SET(PKGMGR_CLIENT "pkgmgr-client")
63 SET(libpkgmgr-client_SOURCES ${pm_c_src_dir}/pkgmgr-internal.c ${pm_c_src_dir}/pkgmgr.c ${pm_c_src_dir}/pkgmgr-dbinfo.c)
64 SET(libpkgmgr-client_LDFLAGS " -module -avoid-version ")
65 SET(libpkgmgr-client_CFLAGS " ${CFLAGS} -fPIC -I${pm_c_inc_dir} -I${pm_inc_dir} -I${pm_t_inc_dir} ${debug_type}")
67 ADD_LIBRARY(${PKGMGR_CLIENT} SHARED ${libpkgmgr-client_SOURCES})
68 SET_TARGET_PROPERTIES(${PKGMGR_CLIENT} PROPERTIES SOVERSION ${VERSION_MAJOR})
69 SET_TARGET_PROPERTIES(${PKGMGR_CLIENT} PROPERTIES VERSION ${VERSION})
70 SET_TARGET_PROPERTIES(${PKGMGR_CLIENT} PROPERTIES COMPILE_FLAGS "${libpkgmgr-client_CFLAGS}")
71 TARGET_LINK_LIBRARIES(${PKGMGR_CLIENT} pkgmgr_installer_client pkgmgr_installer_status_broadcast_server pkgmgr-info ${libpkgs_LDFLAGS})
72 ###################################################################################################
74 ###################################################################################################
75 ## for pkgmgr-server (binary)
76 SET(pkgmgr-server_SOURCES ${pm_s_src_dir}/pkgmgr-server.c ${pm_s_src_dir}/pm-queue.c)
77 SET(pkgmgr-server_CFLAGS " -I. -I${pm_inc_dir} -I${pm_s_inc_dir} -I${pm_dir}/comm ${debug_type} -D_GNU_SOURCE ")
78 SET(pkgmgr-server_LDFLAGS ${pkgs_LDFLAGS})
80 ADD_EXECUTABLE(pkgmgr-server ${pkgmgr-server_SOURCES})
81 TARGET_LINK_LIBRARIES(pkgmgr-server pkgmgr_installer pkgmgr_installer_pkg_mgr_server)
82 TARGET_LINK_LIBRARIES(pkgmgr-server ${pkgs_LDFLAGS})
83 SET_TARGET_PROPERTIES(pkgmgr-server PROPERTIES COMPILE_FLAGS "${pkgmgr-server_CFLAGS}")
84 ####################################################################################################
86 CONFIGURE_FILE(pkgmgr.pc.in pkgmgr.pc @ONLY)
87 configure_file(org.tizen.slp.pkgmgr.service.in org.tizen.slp.pkgmgr.service @ONLY)
88 configure_file(pkg_path.conf.in pkg_path.conf @ONLY)
89 configure_file(pkgmgr.patch.sh.in pkgmgr.patch.sh @ONLY)
91 #INSTALL(FILES ${CMAKE_BINARY_DIR}/libpkgmgr-client.so DESTINATION ${LIB_INSTALL_DIR})
92 INSTALL(TARGETS ${PKGMGR_CLIENT} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
93 INSTALL(FILES ${CMAKE_BINARY_DIR}/pkgmgr-server DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE)
94 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
95 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/client/include/package-manager.h DESTINATION include)
96 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/client/include/pkgmgr-dbinfo.h DESTINATION include)
97 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.slp.pkgmgr.service DESTINATION ${PREFIX}/share/dbus-1/services/)
98 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkg_path.conf DESTINATION ${PREFIX}/etc/package-manager/)
99 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/queue_status DESTINATION etc/package-manager/server/)
100 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgmgr.patch.sh DESTINATION /etc/opt/upgrade/)
102 ####################################################################################################
103 add_subdirectory(installers)