Minor improvements
authorJosé Bollo <jose.bollo@iot.bzh>
Tue, 11 Oct 2016 14:34:46 +0000 (16:34 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Tue, 18 Oct 2016 07:30:31 +0000 (09:30 +0200)
- Clean cmake files
- Fix orthograph and vocabulary

Signed-off-by: José Bollo <jose.bollo@iot.bzh>
CMakeLists.txt
TODO
conf/CMakeLists.txt
src/CMakeLists.txt
src/wgtpkg-install.c

index 0b643c8..e893222 100644 (file)
@@ -22,43 +22,36 @@ cmake_minimum_required(VERSION 2.8)
 
 include(GNUInstallDirs)
 
-macro(setc name value)
-       if(NOT DEFINED ${name})
-               set(${name} ${value})
-       endif(NOT DEFINED ${name})
-endmacro(setc)
-
-SET(PROJECT_NAME "AFM Main")
-SET(PROJECT_PRETTY_NAME "Application Framework Main")
-SET(PROJECT_DESCRIPTION "Secured Application framework")
-SET(PROJECT_VERSION "1.0")
-
-setc(USE_LIBZIP 1)
-setc(USE_SIMULATION 1)
-setc(USE_SDK 0)
-
-setc(afm_name                "afm")
-setc(afm_confdir             "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${afm_name}")
-setc(afm_datadir             "${CMAKE_INSTALL_FULL_DATADIR}/${afm_name}")
-setc(afm_appdir              "${afm_datadir}/applications")
-setc(afm_icondir             "${afm_datadir}/icons")
-setc(afm_prefix              "urn:AGL:")
-setc(afm_prefix_binding      "${afm_prefix}binding:")
-setc(afm_user_appdir         "app-data")
-setc(wgtpkg_trusted_cert_dir "${afm_confdir}/certs")
-
-macro(defstr name value)
-       add_definitions(-D${name}="${value}")
-endmacro(defstr)
-
-defstr(FWK_CONFIG_DIR          "${afm_confdir}")
-defstr(FWK_PREFIX              "${afm_prefix}")
-defstr(FWK_PREFIX_BINDING      "${afm_prefix_binding}")
-defstr(FWK_ICON_DIR            "${afm_icondir}")
-defstr(FWK_APP_DIR             "${afm_appdir}")
-defstr(FWK_USER_APP_DIR        "${afm_user_appdir}")
-defstr(WGTPKG_TRUSTED_CERT_DIR "${wgtpkg_trusted_cert_dir}")
-defstr(FWK_LAUNCH_CONF         "${afm_confdir}/afm-launch.conf")
+set(PROJECT_NAME "AFM Main")
+set(PROJECT_PRETTY_NAME "Application Framework Main")
+set(PROJECT_DESCRIPTION "Secured Application framework")
+set(PROJECT_VERSION "1.0")
+
+
+set(USE_LIBZIP     ON  CACHE BOOL "should try to use libzip?")
+set(USE_SIMULATION ON  CACHE BOOL "if set simulates security manager")
+set(USE_SDK        OFF CACHE BOOL "if set, avoids installating system runtime files")
+
+set(afm_name                "afm" CACHE STRING "Name for application framework user")
+set(afm_confdir             "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${afm_name}" CACHE STRING "Directory for configuration files")
+set(afm_datadir             "${CMAKE_INSTALL_FULL_DATADIR}/${afm_name}" CACHE STRING "Root directory for installions")
+set(afm_appdir              "${afm_datadir}/applications" CACHE STRING "Directory for installing applications")
+set(afm_icondir             "${afm_datadir}/icons" CACHE STRING "Directory for installing icons")
+set(afm_prefix              "urn:AGL:" CACHE STRING "Prefix for uniform resource name")
+set(afm_prefix_binding      "${afm_prefix}binding:" CACHE STRING "URN for bindings")
+set(afm_user_appdir         "app-data" CACHE STRING "User subdirectory for applications")
+set(wgtpkg_trusted_cert_dir "${afm_confdir}/certs" CACHE STRING "Path to internal certificates")
+
+add_definitions(
+       -DFWK_CONFIG_DIR="${afm_confdir}"
+       -DFWK_PREFIX="${afm_prefix}"
+       -DFWK_PREFIX_BINDING="${afm_prefix_binding}"
+       -DFWK_ICON_DIR="${afm_icondir}"
+       -DFWK_APP_DIR="${afm_appdir}"
+       -DFWK_USER_APP_DIR="${afm_user_appdir}"
+       -DWGTPKG_TRUSTED_CERT_DIR="${wgtpkg_trusted_cert_dir}"
+       -DFWK_LAUNCH_CONF="${afm_confdir}/afm-launch.conf"
+)
 
 add_subdirectory(src)
 add_subdirectory(conf)
diff --git a/TODO b/TODO
index f466a3e..268feac 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,7 +1,7 @@
 List of things to do
 - Implement CRL and OCSP parts of x509
 - Implement permissions grant based on certificates
-- more documentation
+- improve documentation
 - manage upgrading packages
 - use key facilities of kernel
 - remove the link to the icon on failure or create it lately
index 31a5963..32a0cc4 100644 (file)
@@ -21,15 +21,15 @@ cmake_minimum_required(VERSION 2.8)
 configure_file(afm-launch.conf.in afm-launch.conf)
 
 if(NOT USE_SDK)
-       setc(SYSCONFDIR_DBUS_SYSTEM ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/system.d)
-       setc(SYSCONFDIR_DBUS_USER   ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/session.d)
-       setc(UNITDIR_SYSTEM         ${CMAKE_INSTALL_LIBDIR}/systemd/system)
-       setc(UNITDIR_USER           ${CMAKE_INSTALL_LIBDIR}/systemd/user)
+       set(SYSCONFDIR_DBUS_SYSTEM ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/system.d CACHE STRING "Path to dbus system configuration files")
+       set(SYSCONFDIR_DBUS_USER   ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/session.d CACHE STRING "Path to dbus session configuration files")
+       set(UNITDIR_SYSTEM         ${CMAKE_INSTALL_LIBDIR}/systemd/system CACHE STRING "Path to systemd system unit files")
+       set(UNITDIR_USER           ${CMAKE_INSTALL_LIBDIR}/systemd/user CACHE STRING "Path to systemd system unit files")
 
        install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/afm-system-daemon.conf    DESTINATION ${SYSCONFDIR_DBUS_SYSTEM})
        install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/afm-system-daemon.service DESTINATION ${UNITDIR_SYSTEM})
        install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/afm-user-daemon.conf      DESTINATION ${SYSCONFDIR_DBUS_USER})
        install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/afm-user-daemon.service   DESTINATION ${UNITDIR_USER})
-       install(FILES ${CMAKE_CURRENT_BINARY_DIR}/afm-launch.conf                       DESTINATION ${afm_confdir})
+       install(FILES ${CMAKE_CURRENT_BINARY_DIR}/afm-launch.conf           DESTINATION ${afm_confdir})
 endif()
 
index ac5c105..6610251 100644 (file)
@@ -47,7 +47,7 @@ include_directories(${EXTRAS_INCLUDE_DIRS})
 link_libraries(${EXTRAS_LIBRARIES})
 
 pkg_check_modules(libzip libzip>=0.11)
-if(libzip_FOUND)
+if(libzip_FOUND AND USE_LIBZIP)
        add_compile_options(${libzip_CFLAGS})
        include_directories(${libzip_INCLUDE_DIRS})
        link_libraries(${libzip_LIBRARIES})
index b5f0a40..c1baaa5 100644 (file)
@@ -145,7 +145,7 @@ static int move_widget(const char *root, const struct wgt_desc *desc, int force)
 
        rc = snprintf(newdir, sizeof newdir, "%s/%s/%s", root, desc->id, desc->ver);
        if (rc >= (int)sizeof newdir) {
-               ERROR("path to long in move_widget");
+               ERROR("path too long in move_widget");
                errno = EINVAL;
                return -1;
        }
@@ -162,14 +162,14 @@ static int install_icon(const struct wgt_desc *desc)
        create_directory(FWK_ICON_DIR, 0755, 1);
        rc = snprintf(link, sizeof link, "%s/%s", FWK_ICON_DIR, desc->idaver);
        if (rc >= (int)sizeof link) {
-               ERROR("link to long in install_icon");
+               ERROR("link too long in install_icon");
                errno = EINVAL;
                return -1;
        }
 
        rc = snprintf(target, sizeof target, "%s/%s", workdir, desc->icons->src);
        if (rc >= (int)sizeof target) {
-               ERROR("target to long in install_icon");
+               ERROR("target too long in install_icon");
                errno = EINVAL;
                return -1;
        }
@@ -284,7 +284,7 @@ struct wgt_info *install_widget(const char *wgtfile, const char *root, int force
 
        if (install_security(desc))
                goto error3;
-       
+
        file_reset();
        return ifo;