Use CMake instead of Automake 69/117969/1 accepted/tizen/unified/20170418.072814 submit/tizen/20170418.021954 tizen_4.0.m1_release
authorSunmin Lee <sunm.lee@samsung.com>
Wed, 8 Mar 2017 05:18:24 +0000 (14:18 +0900)
committerSunmin Lee <sunm.lee@samsung.com>
Wed, 8 Mar 2017 05:41:17 +0000 (14:41 +0900)
CMake is preferred build tool in Tizen.
(CMake is faster than automake in this package)

+ Use dash instead of underscore in binary name.
 It looks more general.

Change-Id: I451a93c68a4837841e9d20f77a8c9c9775c044a4
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
CMakeLists.txt [new file with mode: 0644]
Makefile.am [deleted file]
autogen.sh [deleted file]
configure.ac [deleted file]
packaging/session-utils.manifest
packaging/session-utils.spec
src/systemd-user-helper/CMakeLists.txt [new file with mode: 0644]
src/systemd-user-helper/systemd-user-helper.c

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2f27d51
--- /dev/null
@@ -0,0 +1,6 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(session-utils C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+ADD_SUBDIRECTORY(src/systemd-user-helper)
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644 (file)
index 5c4ec1b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-SUBDIRS = .
-
-AM_CPPFLAGS = \
-       -include $(top_builddir)/config.h \
-       -I $(top_srcdir)/src \
-       -I $(top_srcdir)/src/shared \
-       $(DEFAULT_CFLAGS)
-
-AM_CFLAGS = $(OUR_CFLAGS)
-AM_LDFLAGS = $(OUR_LDFLAGS)
-
-bin_PROGRAMS = \
-       systemd_user_helper
-
-systemd_user_helper_SOURCES = \
-       src/systemd-user-helper/systemd-user-helper.c
-
-systemd_user_helper_CFLAGS = \
-       $(AM_CFLAGS) \
-       ${TZPLATFORMCONF_CFLAGS}
-
-systemd_user_helper_LDADD = \
-       ${TZPLATFORMCONF_LIBS} \
-       -ldl
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755 (executable)
index 968bc8e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-set -e
-
-if [ -f .git/hooks/pre-commit.sample ] && [ ! -f .git/hooks/pre-commit ]; then
-    # This part is allowed to fail
-    cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
-        chmod +x .git/hooks/pre-commit && \
-        echo "Activated pre-commit hook." || :
-fi
-
-# README and INSTALL are required by automake, but may be deleted by
-# clean up rules. to get automake to work, simply touch these here,
-# they will be regenerated from their corresponding *.in files by
-# ./configure anyway.
-touch README INSTALL
-
-# Make sure m4 directory exist
-mkdir -p m4
-
-autoreconf --force --install --verbose || exit $?
diff --git a/configure.ac b/configure.ac
deleted file mode 100644 (file)
index 23613fc..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#                                               -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ([2.68])
-AC_INIT(session-utils, 0.1, [BUG-REPORT-ADDRESS])
-AC_CONFIG_HEADERS([config.h])
-
-AC_USE_SYSTEM_EXTENSIONS
-AC_SYS_LARGEFILE
-AC_PREFIX_DEFAULT([/usr])
-AM_INIT_AUTOMAKE([foreign])
-
-# Checks for programs.
-AC_PROG_MKDIR_P
-AC_PROG_LN_S
-AC_PROG_SED
-AC_PROG_GREP
-AC_PROG_AWK
-#AC_PROG_INSTALL
-
-AC_PROG_CC
-AM_PROG_CC_C_O
-
-AC_SUBST([OUR_CFLAGS], "$our_cflags")
-dnl AC_SUBST([OUR_CPPFLAGS], "$OUR_CFLAGS -Wp,-D_FORTIFY_SOURCE=2")
-AC_SUBST([OUR_LDFLAGS], "$our_ldflags")
-
-PKG_CHECK_MODULES(TZPLATFORMCONF, libtzplatform-config)
-
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
index 90334b84f632110c7f4098f2145697b1546ba44c..d20fa766088be35f231a8c7969487b9831e7c492 100644 (file)
@@ -3,6 +3,6 @@
     <domain name="_"/>
   </request>
   <assign>
-    <filesystem path="/usr/bin/systemd_user_helper" label="_" exec_label="System::Privileged" />
+    <filesystem path="/usr/bin/systemd-user-helper" label="_" exec_label="System::Privileged" />
   </assign>
 </manifest>
index 342acec1da7f85bbaf0d3d75597071caac4513f0..b92b335d5231492e75005131d688d70822f846a7 100644 (file)
@@ -8,6 +8,7 @@ Source0:   %{name}-%{version}.tar.bz2
 Source1:   %{name}.manifest
 
 BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: cmake
 
 %description
 This package provides some utils for session control in multi-user environment.
@@ -18,15 +19,9 @@ This package provides some utils for session control in multi-user environment.
 %build
 cp %{SOURCE1} .
 
-./autogen.sh
-%reconfigure \
-               --disable-static \
-               --prefix=%{_prefix} \
-               --disable-debug-mode \
-               --disable-eng-mode
-
-%__make %{?jobs:-j%jobs} \
-       CFLAGS+=-DLIBDIR=\\\"%{_libdir}\\\"
+%cmake . \
+       -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+       -DLIBDIR=%{_libdir}
 
 %install
 rm -rf %{buildroot}
@@ -35,14 +30,14 @@ rm -rf %{buildroot}
 %files
 %license LICENSE.Apache-2.0
 %manifest session-utils.manifest
-%caps(cap_sys_admin,cap_mac_admin,cap_mac_override,cap_dac_override,cap_setgid=ei) %{_bindir}/systemd_user_helper
+%caps(cap_sys_admin,cap_mac_admin,cap_mac_override,cap_dac_override,cap_setgid=ei) %{_bindir}/systemd-user-helper
 
 #TODO: when uninstalling, it should be restored to original file
 %posttrans
 cp -a /usr/lib/systemd/system/user\@.service /usr/lib/systemd/system/__user@.service
 /usr/bin/sed -i -e 's/Type=\(.*\)/Type=forking/' /usr/lib/systemd/system/user\@.service
-/usr/bin/sed -i -e 's/ExecStart=\(.*\)/ExecStart=\/usr\/bin\/systemd_user_helper start %i/' /usr/lib/systemd/system/user\@.service
-/usr/bin/sed -i -e '/ExecStart=\(.*\)/ a ExecStop=\/usr\/bin\/systemd_user_helper stop %i' /usr/lib/systemd/system/user\@.service
+/usr/bin/sed -i -e 's/ExecStart=\(.*\)/ExecStart=\/usr\/bin\/systemd-user-helper start %i/' /usr/lib/systemd/system/user\@.service
+/usr/bin/sed -i -e '/ExecStart=\(.*\)/ a ExecStop=\/usr\/bin\/systemd-user-helper stop %i' /usr/lib/systemd/system/user\@.service
 /usr/bin/sed -i -e '/PIDFile=\(.*\)/d' /usr/lib/systemd/system/user\@.service
 /usr/bin/sed -i -e '/XDG_RUNTIME_DIR/ a Environment=XDG_RUNTIME_EXT_DIR=/run/user_ext/%i' /usr/lib/systemd/system/user\@.service
 echo 'PIDFile=/run/user/%i/.systemd.pid' >> /usr/lib/systemd/system/user\@.service
diff --git a/src/systemd-user-helper/CMakeLists.txt b/src/systemd-user-helper/CMakeLists.txt
new file mode 100644 (file)
index 0000000..dc7f5ea
--- /dev/null
@@ -0,0 +1,22 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(systemd-user-helper C)
+
+ADD_DEFINITIONS(-DLIBDIR=\"${LIBDIR}\")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${PROJECT_NAME}_pkgs REQUIRED
+       libtzplatform-config
+)
+
+FOREACH(flag ${${PROJECT_NAME}_pkgs})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_EXECUTABLE(${PROJECT_NAME} systemd-user-helper.c)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_pkgs_LDFLAGS} -ldl)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin
+               PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+               GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
index b65a7d9f3e7258106b6b5c154efa408489b17ad7..f2b9620235de92a56d10761c9d1ce27db893e2bb 100644 (file)
@@ -23,6 +23,7 @@
  * compatibility and container.
  */
 
+#define _GNU_SOURCE
 #include <dlfcn.h>
 #include <unistd.h>
 #include <stdio.h>