summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2013-03-03 15:09:53 +0100
committerAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2013-03-03 15:09:53 +0100
commitbb89d09a6a91b7883faed703543de08888fd0e3e (patch)
tree92b6605e4bee20952b321562d83b529c75320c44 /packages
parentf69e66d2f246b35ff486d09079a47a411157c372 (diff)
downloadembtoolkit-bb89d09a6a91b7883faed703543de08888fd0e3e.tar.gz
embtoolkit-bb89d09a6a91b7883faed703543de08888fd0e3e.tar.bz2
embtoolkit-bb89d09a6a91b7883faed703543de08888fd0e3e.tar.xz
Packages: Add gtest: google c++ testing framework
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
Diffstat (limited to 'packages')
-rw-r--r--packages/development/development.kconfig3
-rw-r--r--packages/development/development.mk6
-rw-r--r--packages/development/gtest/Makefile68
-rw-r--r--packages/development/gtest/gtest.kconfig48
-rw-r--r--packages/development/gtest/gtest.mk56
5 files changed, 180 insertions, 1 deletions
diff --git a/packages/development/development.kconfig b/packages/development/development.kconfig
index 0cd7c14..b9409ca 100644
--- a/packages/development/development.kconfig
+++ b/packages/development/development.kconfig
@@ -29,6 +29,9 @@ source packages/development/libbsd/libbsd.kconfig
#libevent
source packages/development/libevent/libevent.kconfig
+# gtest
+source packages/development/gtest/gtest.kconfig
+
#libnih
source packages/development/libnih/libnih.kconfig
diff --git a/packages/development/development.mk b/packages/development/development.mk
index 2be5b46..0e0bfd1 100644
--- a/packages/development/development.mk
+++ b/packages/development/development.mk
@@ -1,6 +1,6 @@
################################################################################
# Embtoolkit
-# Copyright(C) 2009-2012 Abdoulaye Walsimou GAYE.
+# Copyright(C) 2009-2013 Abdoulaye Walsimou GAYE.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,6 +31,10 @@ ROOTFS_COMPONENTS-$(CONFIG_EMBTK_HAVE_LIBBSD) += libbsd_install
include packages/development/libevent/libevent.mk
ROOTFS_COMPONENTS-$(CONFIG_EMBTK_HAVE_LIBEVENT) += libevent_install
+# gtest
+include packages/development/gtest/gtest.mk
+ROOTFS_COMPONENTS-$(CONFIG_EMBTK_HAVE_GTEST) += gtest_install
+
#libnih
include packages/development/libnih/libnih.mk
ROOTFS_COMPONENTS-$(CONFIG_EMBTK_HAVE_LIBNIH) += libnih_install
diff --git a/packages/development/gtest/Makefile b/packages/development/gtest/Makefile
new file mode 100644
index 0000000..bcbded7
--- /dev/null
+++ b/packages/development/gtest/Makefile
@@ -0,0 +1,68 @@
+################################################################################
+# Copyright 2013 Abdoulaye Walsimou GAYE <awg@embtoolkit.org>. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+################################################################################
+
+rootsrc ?= $(shell pwd)
+LIBDIR ?= lib
+
+CXX_SRCS := $(rootsrc)/src/gtest-all.cc
+HEADERS := $(rootsrc)/include/gtest
+OBJS := $(patsubst %.cc,%.o,$(CXX_SRCS))
+LIB := gtest
+
+CC ?= gcc
+CXX ?= g++
+
+ARFLAGS := rvs
+
+override CFLAGS := $(CFLAGS) -W -Wall -Wextra -pthread
+override CPPFLAGS := $(CPPFLAGS) -I. -I./include
+override CXXFLAGS := $(CXXFLAGS) $(CFLAGS)
+
+define __lib_install
+ $(if $(SYSROOT),
+ mkdir -p $(SYSROOT)/$(LIBDIR)
+ mkdir -p $(SYSROOT)/usr
+ mkdir -p $(SYSROOT)/usr/include
+ cp lib$(LIB).a $(SYSROOT)/usr/$(LIBDIR)/
+ cp -R $(HEADERS) $(SYSROOT)/usr/include/)
+endef
+
+all: lib$(LIB).a
+ $(Q)true
+
+install: all
+ $(Q)$(__lib_install)
+ $(Q)true
+
+lib$(LIB).a: $(OBJS)
+ $(Q)$(AR) $(ARFLAGS) $@ $(OBJS)
+
+%.o: %.cc
+ $(Q)$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
+
+clean:
+ $(Q)rm -rf $(OBJS) lib$(LIB).a
+
diff --git a/packages/development/gtest/gtest.kconfig b/packages/development/gtest/gtest.kconfig
new file mode 100644
index 0000000..943e61d
--- /dev/null
+++ b/packages/development/gtest/gtest.kconfig
@@ -0,0 +1,48 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2013 Abdoulaye Walsimou GAYE.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+################################################################################
+#
+# \file gtest.kconfig
+# \brief gtest.kconfig of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date March 2013
+################################################################################
+
+config EMBTK_HAVE_GTEST
+ bool "Have gtest"
+ help
+ Google C++ Testing Framework.
+
+choice
+ prompt "gtest version you wish"
+ depends on EMBTK_HAVE_GTEST
+ help
+ Here you can choose which version of gtest you want to use.
+
+ config EMBTK_GTEST_VERSION_EMBTK_110
+ bool "gtest-embtk-1.1.0"
+endchoice
+
+config EMBTK_GTEST_VERSION_STRING
+ string
+ default "embtk-1.1.0" if EMBTK_GTEST_VERSION_EMBTK_110
+
+config EMBTK_GTEST_NEED_PATCH
+ bool
+config EMBTK_GTEST_NEED_AUTORECONF
+ bool
diff --git a/packages/development/gtest/gtest.mk b/packages/development/gtest/gtest.mk
new file mode 100644
index 0000000..fbdf4e1
--- /dev/null
+++ b/packages/development/gtest/gtest.mk
@@ -0,0 +1,56 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2013 Abdoulaye Walsimou GAYE.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+################################################################################
+#
+# \file gtest.mk
+# \brief gtest.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date March 2013
+################################################################################
+
+GTEST_NAME := gtest
+GTEST_VERSION := $(call embtk_get_pkgversion,gtest)
+GTEST_SITE := ftp://ftp.embtoolkit.org/embtoolkit.org/packages-mirror
+GTEST_PACKAGE := gtest-$(GTEST_VERSION).tar.bz2
+GTEST_SRC_DIR := $(embtk_pkgb)/gtest-$(GTEST_VERSION)
+GTEST_BUILD_DIR := $(embtk_pkgb)/gtest-$(GTEST_VERSION)
+GTEST_EMBTK_DIR := $(EMBTK_ROOT)/packages/development/gtest
+
+__embtk_gtest_cflags := $(TARGET_CFLAGS)
+
+GTEST_MAKE_OPTS := CC="$(TARGETCC)" CXX="$(TARGETCXX)"
+GTEST_MAKE_OPTS += CFLAGS="$(__embtk_gtest_cflags)" LIBDIR="$(LIBDIR)"
+GTEST_MAKE_OPTS += AR="$(TARGETAR)" RANLIB="$(TARGETRANLIB)"
+GTEST_MAKE_OPTS += SYSROOT="$(embtk_sysroot)"
+
+define embtk_install_gtest
+ $(call embtk_makeinstall_pkg,gtest)
+endef
+
+define embtk_beforeinstall_gtest
+ [ -e $(call __embtk_pkg_srcdir,gtest)/Makefile ] || \
+ ln -sf $(GTEST_EMBTK_DIR)/Makefile \
+ $(call __embtk_pkg_srcdir,gtest)/Makefile
+endef
+
+define embtk_cleanup_gtest
+ if [ -e $(call __embtk_pkg_srcdir,gtest)/Makefile ]; then \
+ $(MAKE) -C $(call __embtk_pkg_srcdir,gtest) clean; \
+ fi
+ rm -rf $(call __embtk_pkg_srcdir,gtest)/Makefile
+endef