Building and packaging structure.
authorJan Olszak <j.olszak@samsung.com>
Tue, 11 Feb 2014 12:52:12 +0000 (13:52 +0100)
committerJan Olszak <j.olszak@samsung.com>
Mon, 19 May 2014 11:47:14 +0000 (13:47 +0200)
         [Issue#]      PSDAC-64
         [Bug]         N/A
         [Cause]       N/A
         [Solution]    N/A
         [Verfication] Build and install all packages with rpm.

Change-Id: I41654c8aa0e98e8ad3235bb6ec9c257bcad7a3de

15 files changed:
.gitignore [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
packaging/security-containers.spec [new file with mode: 0644]
security-containers.pc.in [new file with mode: 0644]
src/CMakeLists.txt [new file with mode: 0644]
src/client/CMakeLists.txt [new file with mode: 0644]
src/client/include/sc-client.hpp [new file with mode: 0644]
src/client/include/security-containers-client.h [new file with mode: 0644]
src/client/src/CMakeLists.txt [new file with mode: 0644]
src/client/src/sc-client.cpp [new file with mode: 0644]
src/server/CMakeLists.txt [new file with mode: 0644]
src/server/include/sc-server.hpp [new file with mode: 0644]
src/server/src/CMakeLists.txt [new file with mode: 0644]
src/server/src/main.cpp [new file with mode: 0644]
src/server/src/sc-server.cpp [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..dbad6ab
--- /dev/null
@@ -0,0 +1,21 @@
+# Compiled Object files
+*.slo
+*.lo
+*.o
+
+# Compiled Dynamic libraries
+*.so
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+
+# CMake/Makefile files
+*.cmake
+CMakeCache.txt
+CMakeFiles
+Makefile
+
+# Others
+security-containers.pc
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2a82c73
--- /dev/null
@@ -0,0 +1,60 @@
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    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.
+#
+#
+# @file   CMakeLists.txt
+# @author Jan Olszak (j.olszak@samsung.com)
+#
+
+CMAKE_MINIMUM_REQUIRED (VERSION 2.6.2)
+PROJECT(security-containers)
+
+## File names ##################################################################
+SET(SERVER_CODENAME "${PROJECT_NAME}-server")
+SET(CLIENT_CODENAME "${PROJECT_NAME}-client")
+
+
+## Generate the pc file ########################################################
+CONFIGURE_FILE(security-containers.pc.in security-containers.pc @ONLY)
+
+
+## Compiler flags, depending on the build type #################################
+SET(CMAKE_C_FLAGS_PROFILING    "-g -O0 -pg")
+SET(CMAKE_CXX_FLAGS_PROFILING  "-g -std=c++0x -O0 -pg")
+SET(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb")
+SET(CMAKE_CXX_FLAGS_DEBUG      "-g -std=c++0x -O0 -ggdb")
+SET(CMAKE_C_FLAGS_RELEASE      "-g -O2")
+SET(CMAKE_CXX_FLAGS_RELEASE    "-g -std=c++0x -O2")
+SET(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
+SET(CMAKE_CXX_FLAGS_CCOV       "-g -std=c++0x -O2 --coverage")
+
+ADD_DEFINITIONS("-fPIC")   # Position Independent Code
+ADD_DEFINITIONS("-Werror") # Make all warnings into errors.
+ADD_DEFINITIONS("-Wall")   # Generate all warnings
+ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
+
+
+## Subdirectories ##############################################################
+SET(CLIENT_FOLDER ${PROJECT_SOURCE_DIR}/src/client)
+SET(SERVER_FOLDER ${PROJECT_SOURCE_DIR}/src/server)
+ADD_SUBDIRECTORY(src)
+
+
+## Installations ###############################################################
+# FILE(MAKE_DIRECTORY /usr/include/security-containers)
+INSTALL(FILES       ${CLIENT_FOLDER}/include/security-containers-client.h
+        DESTINATION /usr/include/security-containers)
+
+INSTALL(FILES       ${CMAKE_BINARY_DIR}/security-containers.pc
+        DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
diff --git a/packaging/security-containers.spec b/packaging/security-containers.spec
new file mode 100644 (file)
index 0000000..5ee08bc
--- /dev/null
@@ -0,0 +1,62 @@
+Name:          security-containers
+Version:       0.1.0
+Release:       0
+Source0:       %{name}-%{version}.tar.gz
+License:       Apache-2.0
+Group:         Security/Other
+Summary:       Daemon for managing containers
+BuildRequires: cmake
+
+%description
+This package provides a daemon used to manage containers - start, stop and switch
+between them. A proccess from inside a container can request a switch of context
+(display, inputdevices) to the other container.
+
+%files
+%attr(755,root,root) %{_bindir}/security-containers-server
+
+%prep
+%setup -q
+
+%build
+%cmake . -DVERSION=%{version} \
+         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type}%{!?build_type:RELEASE} \
+         -DCMAKE_VERBOSE_MAKEFILE=ON
+make %{?jobs:-j%jobs}
+
+%install
+%make_install
+
+%clean
+rm -rf %{buildroot}
+
+
+## Client Package ##############################################################
+%package client
+Summary:          Security Containers Client
+Group:            Development/Libraries
+Requires:         security-containers = %{version}-%{release}
+Requires(post):   /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description client
+Library interface to the security-containers daemon
+
+%files client
+%attr(644,root,root) %{_libdir}/libsecurity-containers-client.so
+
+
+## Devel Package ###############################################################
+%package devel
+Summary:          Security Containers Client Devel
+Group:            Development/Libraries
+Requires:         security-containers = %{version}-%{release}
+Requires:         security-containers-client = %{version}-%{release}
+
+%description devel
+Development package including the header files for the client library
+
+%files devel
+%defattr(644,root,root,644)
+%attr(644,root,root) %{_includedir}/security-containers/security-containers-client.h
+%attr(644,root,root) %{_libdir}/pkgconfig/security-containers.pc
diff --git a/security-containers.pc.in b/security-containers.pc.in
new file mode 100644 (file)
index 0000000..16a4330
--- /dev/null
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=@LIB_INSTALL_DIR@
+includedir=${prefix}/include
+
+Name: security-containers
+Description: Security Containers Package
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lsecurity-containers-client
+Cflags: -I${includedir}/security-containers
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..719d8b8
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    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.
+#
+#
+# @file   CMakeLists.txt
+# @author Jan Olszak (j.olszak@samsung.com)
+#
+
+ADD_SUBDIRECTORY(client)
+ADD_SUBDIRECTORY(server)
\ No newline at end of file
diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f0e5c53
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    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.
+#
+#
+# @file   CMakeLists.txt
+# @author Jan Olszak (j.olszak@samsung.com)
+#
+
+INCLUDE_DIRECTORIES ("${CLIENT_FOLDER}/include")
+ADD_SUBDIRECTORY(src)
\ No newline at end of file
diff --git a/src/client/include/sc-client.hpp b/src/client/include/sc-client.hpp
new file mode 100644 (file)
index 0000000..426c3db
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef SC_CLIENT_H
+#define SC_CLIENT_H
+
+#endif /*SC_CLIENT_H*/
diff --git a/src/client/include/security-containers-client.h b/src/client/include/security-containers-client.h
new file mode 100644 (file)
index 0000000..6e3a3bc
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ *  Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Contact: Bumjin Im <bj.im@samsung.com>
+ *
+ *  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
+ */
+
+
+/**
+ * @file    security-containers-client.h
+ * @author  Jan Olszak (j.olszak@samsung.com)
+ * @brief   This file contains the API for Security Containers Client
+ */
+
+#ifndef SECURITY_CONTAINERS_CLIENT_H
+#define SECURITY_CONTAINERS_CLIENT_H
+
+#endif /*SECURITY_CONTAINERS_CLIENT_H*/
diff --git a/src/client/src/CMakeLists.txt b/src/client/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..efb4f27
--- /dev/null
@@ -0,0 +1,27 @@
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    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.
+#
+#
+# @file   CMakeLists.txt
+# @author Jan Olszak (j.olszak@samsung.com)
+#
+
+MESSAGE ("Generating makefile for the Client...")
+FILE (GLOB_RECURSE project_SRCS *.cpp *.cxx *.cc *.C *.c *.h *.hpp)
+MESSAGE ("Files:  ${project_SRCS}")
+
+ADD_LIBRARY(${CLIENT_CODENAME} SHARED ${project_SRCS})
+INSTALL(TARGETS     ${CLIENT_CODENAME}
+        DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        COMPONENT   RuntimeLibraries)
\ No newline at end of file
diff --git a/src/client/src/sc-client.cpp b/src/client/src/sc-client.cpp
new file mode 100644 (file)
index 0000000..ab5ade2
--- /dev/null
@@ -0,0 +1 @@
+#include <sc-client.hpp>
\ No newline at end of file
diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2fc0de2
--- /dev/null
@@ -0,0 +1,21 @@
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    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.
+#
+#
+# @file   CMakeLists.txt
+# @author Jan Olszak (j.olszak@samsung.com)
+#
+
+INCLUDE_DIRECTORIES ("${SERVER_FOLDER}/include")
+ADD_SUBDIRECTORY(src)
\ No newline at end of file
diff --git a/src/server/include/sc-server.hpp b/src/server/include/sc-server.hpp
new file mode 100644 (file)
index 0000000..f2b538c
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef SC_SERVER_H
+#define SC_SERVER_H
+
+#endif /*SC_SERVER_H*/
diff --git a/src/server/src/CMakeLists.txt b/src/server/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..48d96f6
--- /dev/null
@@ -0,0 +1,26 @@
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    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.
+#
+#
+# @file   CMakeLists.txt
+# @author Jan Olszak (j.olszak@samsung.com)
+#
+
+MESSAGE ("Generating makefile for the Server...")
+FILE(GLOB_RECURSE project_SRCS *.cpp *.cxx *.cc *.C *.c *.h *.hpp)
+MESSAGE("Files: " ${project_SRCS})
+
+SET(SERVER_CODENAME "${PROJECT_NAME}-server")
+ADD_EXECUTABLE(${SERVER_CODENAME} main.cpp)
+INSTALL(TARGETS ${SERVER_CODENAME} DESTINATION bin)
\ No newline at end of file
diff --git a/src/server/src/main.cpp b/src/server/src/main.cpp
new file mode 100644 (file)
index 0000000..b8c29e1
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ *  Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Contact: Bumjin Im <bj.im@samsung.com>
+ *
+ *  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
+ */
+
+
+/**
+ * @file    main.cpp
+ * @author  Jan Olszak (j.olszak@samsung.com)
+ * @brief   Main file for the Security Containers Daemon
+ */
+
+
+#include <iostream>
+
+#include <sc-server.hpp>
+
+int main(int argc, const char *argv[])
+{
+    std::cout << "SC FTW!" << std::endl;
+    std::cout << argc << std::endl;
+    for (int i = 0; i < argc; ++i){
+        std::cout << argv[i] << std::endl;
+    }
+}
\ No newline at end of file
diff --git a/src/server/src/sc-server.cpp b/src/server/src/sc-server.cpp
new file mode 100644 (file)
index 0000000..e69de29