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)
15 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
16 SET(EXEC_PREFIX "\${prefix}")
17 SET(LIBDIR ${LIB_INSTALL_DIR})
18 SET(INCLUDEDIR "\${prefix}/include")
21 set(CMAKE_SKIP_BUILD_RPATH true)
24 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/comm )
26 INCLUDE(FindPkgConfig)
28 OPTION(X11_SUPPORT "Enable X support" ON)
30 ADD_DEFINITIONS("-DHAVE_X11")
31 pkg_check_modules(pkgs REQUIRED security-server dlog elementary evas ecore appcore-efl ecore-x ail ecore-file pkgmgr-parser pkgmgr-info iniparser libtzplatform-config notification)
33 pkg_check_modules(pkgs REQUIRED security-server dlog elementary evas ecore appcore-efl ecore-wayland ail ecore-file pkgmgr-parser pkgmgr-info iniparser libtzplatform-config notification)
36 FOREACH(flag ${pkgs_CFLAGS})
37 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
40 pkg_check_modules(libpkgs REQUIRED dbus-glib-1 dlog ail pkgmgr-parser pkgmgr-info iniparser libtzplatform-config notification)
42 FOREACH(flag ${libpkgs_CFLAGS})
43 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
46 SET(pm_dir "${CMAKE_SOURCE_DIR}")
47 SET(pm_inc_dir "${pm_dir}/include")
48 SET(pm_c_src_dir "${pm_dir}/client/src")
49 SET(pm_c_inc_dir "${pm_dir}/client/include")
50 SET(pm_s_src_dir "${pm_dir}/server/src")
51 SET(pm_s_inc_dir "${pm_dir}/server/include")
52 SET(pm_t_inc_dir "${pm_dir}/types/include")
55 SET(debug_type "-DPM_CONSOLE_USE") # for debug - use console window
58 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
59 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -Wall")
60 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
63 ## build comm libraries
64 add_subdirectory(comm)
65 add_subdirectory(tool)
66 add_subdirectory(types)
68 ###################################################################################################
69 ## for libpkgmgr-client.so (library)
70 SET(PKGMGR_CLIENT "pkgmgr-client")
71 SET(libpkgmgr-client_SOURCES ${pm_c_src_dir}/pkgmgr-internal.c ${pm_c_src_dir}/pkgmgr.c ${pm_c_src_dir}/pkgmgr-dbinfo.c)
72 SET(libpkgmgr-client_LDFLAGS " -module -avoid-version ")
73 SET(libpkgmgr-client_CFLAGS " ${CFLAGS} -fPIC -I${pm_c_inc_dir} -I${pm_inc_dir} -I${pm_t_inc_dir} ${debug_type}")
75 ADD_LIBRARY(${PKGMGR_CLIENT} SHARED ${libpkgmgr-client_SOURCES})
76 SET_TARGET_PROPERTIES(${PKGMGR_CLIENT} PROPERTIES SOVERSION ${VERSION_MAJOR})
77 SET_TARGET_PROPERTIES(${PKGMGR_CLIENT} PROPERTIES VERSION ${VERSION})
78 SET_TARGET_PROPERTIES(${PKGMGR_CLIENT} PROPERTIES COMPILE_FLAGS "${libpkgmgr-client_CFLAGS}")
79 TARGET_LINK_LIBRARIES(${PKGMGR_CLIENT} pkgmgr_installer_client pkgmgr_installer_status_broadcast_server pkgmgr-info ${libpkgs_LDFLAGS})
80 ###################################################################################################
82 ###################################################################################################
83 ## for pkgmgr-server (binary)
84 SET(pkgmgr-server_SOURCES ${pm_s_src_dir}/pkgmgr-server.c ${pm_s_src_dir}/pm-queue.c)
85 SET(pkgmgr-server_CFLAGS " -I. -I${pm_inc_dir} -I${pm_s_inc_dir} -I${pm_dir}/comm ${debug_type} -D_GNU_SOURCE ")
86 SET(pkgmgr-server_LDFLAGS ${pkgs_LDFLAGS})
88 ADD_EXECUTABLE(pkgmgr-server ${pkgmgr-server_SOURCES})
89 TARGET_LINK_LIBRARIES(pkgmgr-server pkgmgr_installer pkgmgr_installer_pkg_mgr_server)
90 TARGET_LINK_LIBRARIES(pkgmgr-server ${pkgs_LDFLAGS})
91 SET_TARGET_PROPERTIES(pkgmgr-server PROPERTIES COMPILE_FLAGS "${pkgmgr-server_CFLAGS}")
92 ####################################################################################################
94 CONFIGURE_FILE(pkgmgr.pc.in pkgmgr.pc @ONLY)
95 configure_file(org.tizen.slp.pkgmgr.service.in org.tizen.slp.pkgmgr.service @ONLY)
96 configure_file(org.tizen.slp.pkgmgr.conf.in org.tizen.slp.pkgmgr.conf @ONLY)
97 configure_file(pkg_path.conf.in pkg_path.conf @ONLY)
98 configure_file(pkgmgr.patch.sh.in pkgmgr.patch.sh @ONLY)
100 #INSTALL(FILES ${CMAKE_BINARY_DIR}/libpkgmgr-client.so DESTINATION ${LIB_INSTALL_DIR})
101 INSTALL(TARGETS ${PKGMGR_CLIENT} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
102 INSTALL(FILES ${CMAKE_BINARY_DIR}/pkgmgr-server DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE)
103 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
104 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/client/include/package-manager.h DESTINATION include)
105 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/client/include/pkgmgr-dbinfo.h DESTINATION include)
106 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.slp.pkgmgr.service DESTINATION ${PREFIX}/share/dbus-1/system-services/)
107 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.slp.pkgmgr.conf DESTINATION ${SYSCONFDIR}/dbus-1/system.d/)
108 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkg_path.conf DESTINATION ${SYSCONFDIR}/package-manager/)
109 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/queue_status DESTINATION ${SYSCONFDIR}/package-manager/server/)
110 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgmgr.patch.sh DESTINATION ${SYSCONFDIR}/opt/upgrade/)
112 ####################################################################################################
113 add_subdirectory(installers)