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>
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(session-utils C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+ADD_SUBDIRECTORY(src/systemd-user-helper)
+++ /dev/null
-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
+++ /dev/null
-#!/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 $?
+++ /dev/null
-# -*- 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
<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>
Source1: %{name}.manifest
BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: cmake
%description
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}
%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
--- /dev/null
+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)
* compatibility and container.
*/
+#define _GNU_SOURCE
#include <dlfcn.h>
#include <unistd.h>
#include <stdio.h>