moving to cmake
authorJosé Bollo <jose.bollo@iot.bzh>
Fri, 18 Dec 2015 15:58:10 +0000 (16:58 +0100)
committerJosé Bollo <jose.bollo@iot.bzh>
Fri, 18 Dec 2015 15:58:10 +0000 (16:58 +0100)
Change-Id: Ic1c7ce208f88c707435cce0ec0e658974315d3d1

CMakeLists.txt [new file with mode: 0644]
src/CMakeLists.txt [new file with mode: 0644]
src/af-usrd.c
src/utils-jbus.c

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..504162b
--- /dev/null
@@ -0,0 +1,48 @@
+###########################################################################
+# Copyright 2015 IoT.bzh
+#
+# author: José Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+cmake_minimum_required(VERSION 2.8)
+
+project("afm-main" LANGUAGES "C")
+
+set(afm_name                "aglfwk")
+set(afm_confdir             "${sysconfdir}/${afm_name}")
+set(afm_datadir             "${datadir}/$(afm_name}")
+set(afm_appdir              "${afm_datadir}/applications")
+set(afm_icondir             "${afm_datadir}/icons")
+set(afm_prefix              "urn:agl:")
+set(afm_prefix_permission   "${afm_prefix}perm:")
+set(afm_prefix_plugin       "${afm_prefix}plugin:")
+set(afm_user_appdir         "app-data")
+set(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_PERMISSION   "${afm_prefix_permission}")
+defstr(FWK_PREFIX_PLUGIN       "${afm_prefix_plugin}")
+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}")
+
+add_subdirectory(src)
+
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0512206
--- /dev/null
@@ -0,0 +1,105 @@
+###########################################################################
+# Copyright 2015 IoT.bzh
+#
+# author: José Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+include(FindPkgConfig)
+
+pkg_check_modules(EXTRAS REQUIRED
+       libzip>=0.11
+       libxml-2.0
+       openssl
+       xmlsec1 xmlsec1-openssl
+       json-c
+       dbus-1
+       )
+
+add_compile_options(${EXTRAS_CFLAGS})
+include_directories(${EXTRAS_INCLUDE_DIRS})
+link_libraries(${EXTRAS_LIBRARIES})
+
+###########################################################################
+
+include_directories(simulation)
+
+###########################################################################
+
+add_compile_options(-Wall -Wno-pointer-sign)
+add_compile_options(-ffunction-sections -fdata-sections)
+add_compile_options(-Wl,--gc-sections)
+
+#SET(CMAKE_C_FLAGS_PROFILING    "-g -O0 -pg -Wp,-U_FORTIFY_SOURCE")
+#SET(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
+#SET(CMAKE_C_FLAGS_RELEASE      "-g -O2")
+#SET(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
+#ADD_COMPILE_OPTIONS("-fPIC")
+
+###########################################################################
+
+add_library(wgtpkg
+       wgtpkg-base64.c
+       wgtpkg-certs.c
+       wgtpkg-digsig.c
+       wgtpkg-files.c
+       wgtpkg-install.c
+       wgtpkg-permissions.c
+       wgtpkg-workdir.c
+       wgtpkg-xmlsec.c
+       wgtpkg-zip.c
+       )
+
+add_library(utils
+       utils-dir.c
+       utils-jbus.c
+       verbose.c
+       )
+
+add_library(wgt
+       wgt-config.c
+       wgt-info.c
+       wgt.c
+       )
+
+add_library(secwrp
+       secmgr-wrap.c
+       )
+
+add_library(afm
+       af-db.c
+       af-launch.c
+       af-run.c
+       )
+
+add_executable(wgtpkg-sign wgtpkg-sign.c)
+target_link_libraries(wgtpkg-sign wgtpkg utils)
+
+
+add_executable(wgtpkg-pack wgtpkg-pack.c)
+target_link_libraries(wgtpkg-pack wgtpkg utils)
+
+
+add_executable(wgtpkg-info wgtpkg-info.c)
+target_link_libraries(wgtpkg-info wgtpkg wgt utils)
+
+
+add_executable(wgtpkg-installer wgtpkg-installer.c)
+target_link_libraries(wgtpkg-installer wgtpkg wgt secwrp utils)
+
+
+add_executable(af-usrd af-usrd.c)
+target_link_libraries(af-usrd afm secwrp wgt utils)
+
+
index 6314e2a..960b44b 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <unistd.h>
 #include <stdio.h>
+#include <time.h>
 
 #include <json.h>
 
index a542d0b..ef87227 100644 (file)
@@ -276,8 +276,6 @@ int jbus_add_service(struct jbus *jbus, const char *method, void (*oncall)(struc
 
        return 0;
 
-error3:
-       free(srv->method);
 error2:
        free(srv);
 error: