diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-10-31 11:07:59 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2013-10-31 11:08:31 +0100 |
commit | fcf19a18767882d90492c1e681059fd779248035 (patch) | |
tree | 85b3155a432fafc032e271a7600ec8163175eef0 | |
parent | 92a07cc99c3eee527c780b781252bf25cbee4e5a (diff) |
build: add proper autotools build files
Use autotools to generate the openwfd project instead of a statically
managed Makefile.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r-- | .gitignore | 24 | ||||
-rw-r--r-- | COPYING | 41 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | Makefile.am | 171 | ||||
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | README | 2 | ||||
-rwxr-xr-x | autogen.sh | 17 | ||||
-rw-r--r-- | configure.ac | 74 | ||||
-rw-r--r-- | test/test_common.h | 107 | ||||
-rw-r--r-- | test/test_rtsp.c | 42 |
10 files changed, 481 insertions, 6 deletions
@@ -1,4 +1,28 @@ +*.la +*.lo +*.log *.o *.swp +*.tar.xz +*.trs +.deps/ +.dirstamp +.libs/ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache/ +build-aux/ +config.h +config.h.in +config.h.in~ +config.log +config.status +configure +libtool +m4/ openwfd_ie openwfd_p2pd +stamp-h1 +test-suite.log +test_rtsp @@ -0,0 +1,41 @@ + + Authors + ========= + +This software was written by: + David Herrmann <dh.herrmann@gmail.com> + +Copyright Notice +================ + +This software is licensed under the terms of the MIT license. Please see each +source file for the related copyright notice and license. + +If a file does not contain a copright notice, the following license shall +apply: + + Copyright (c) 2013 David Herrmann <dh.herrmann@gmail.com> + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Third-Party Source +================== + + N/A diff --git a/Makefile b/Makefile deleted file mode 100644 index a7cbab1..0000000 --- a/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -CFLAGS=-Wall -D_GNU_SOURCE -Isrc -g -DBUILD_ENABLE_DEBUG "-DBUILD_BINDIR_WPA_SUPPLICANT=\"/bin\"" - -all: - gcc -o openwfd_ie tools/openwfd_ie.c $(CFLAGS) - gcc -o openwfd_p2pd src/p2pd.c src/p2pd_config.c src/p2pd_interface.c src/rtsp_ctrl.c src/rtsp_decoder.c src/wpa_ctrl.c src/shared.c src/shl_log.c src/shl_ring.c $(CFLAGS) diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..1f52992 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,171 @@ +# +# OpenWFD - Open-Source Wifi-Display Implementation +# Copyright (c) 2013 David Herrmann <dh.herrmann@gmail.com> +# + +# +# Global Configurations and Initializations +# + +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} +AM_MAKEFLAGS = --no-print-directory +AUTOMAKE_OPTIONS = color-tests +.DELETE_ON_ERROR: + +include_HEADERS = +EXTRA_DIST = \ + README \ + COPYING \ + NEWS +CLEANFILES = +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = +TPHONY = + +TESTS = +bin_PROGRAMS = +check_PROGRAMS = +lib_LTLIBRARIES = +noinst_LTLIBRARIES = + +# +# Default CFlags +# Make all files include "config.h" by default. This shouldn't cause any +# problems and we cannot forget to include it anymore. +# +# Also make the linker discard all unused symbols. +# + +AM_CFLAGS = \ + -Wall \ + -pipe \ + -fno-common \ + -ffast-math \ + -fdiagnostics-show-option \ + -fno-strict-aliasing \ + -fvisibility=hidden \ + -ffunction-sections \ + -fdata-sections +AM_CPPFLAGS = \ + -include $(top_builddir)/config.h \ + -I $(srcdir)/src +AM_LDFLAGS = \ + -Wl,--as-needed \ + -Wl,--gc-sections \ + -Wl,-z,relro \ + -Wl,-z,now + +# +# Additional parameters +# TODO: these should be configurable in configure.ac +# + +AM_CPPFLAGS += \ + -DBUILD_ENABLE_DEBUG \ + "-DBUILD_BINDIR_WPA_SUPPLICANT=\"/bin\"" + +# +# SHL - Static Helper Library +# The SHL subsystem contains several small code pieces used all over the place. +# + +noinst_LTLIBRARIES += libshl.la + +libshl_la_SOURCES = \ + src/shl_llog.h \ + src/shl_log.h \ + src/shl_log.c \ + src/shl_ring.h \ + src/shl_ring.c +libshl_la_CPPFLAGS = $(AM_CPPFLAGS) +libshl_la_LDFLAGS = $(AM_LDFLAGS) +libshl_la_LIBADD = $(AM_LIBADD) + +# +# owfd - shared helpers +# + +noinst_LTLIBRARIES += libowfd.la + +libowfd_la_SOURCES = \ + src/rtsp.h \ + src/rtsp_ctrl.c \ + src/rtsp_decoder.c \ + src/shared.h \ + src/shared.c \ + src/wpa_ctrl.h \ + src/wpa_ctrl.c +libowfd_la_CPPFLAGS = $(AM_CPPFLAGS) +libowfd_la_LDFLAGS = $(AM_LDFLAGS) +libowfd_la_LIBADD = $(AM_LIBADD) + +# +# openwfd_p2pd +# + +bin_PROGRAMS += openwfd_p2pd + +openwfd_p2pd_SOURCES = \ + src/p2pd.h \ + src/p2pd.c \ + src/p2pd_config.c \ + src/p2pd_interface.c + +openwfd_p2pd_CPPFLAGS = $(AM_CPPFLAGS) +openwfd_p2pd_LDADD = \ + libowfd.la \ + libshl.la +openwfd_p2pd_LDFLAGS = $(AM_LDFLAGS) + +# +# Tools +# + +check_PROGRAMS += \ + openwfd_ie + +openwfd_ie_SOURCES = tools/openwfd_ie.c +openwfd_ie_CPPFLAGS = $(AM_CPPFLAGS) +openwfd_ie_LDADD = +openwfd_ie_LDFLAGS = $(AM_LDFLAGS) + +# +# Tests +# + +if BUILD_HAVE_CHECK +check_PROGRAMS += \ + test_rtsp +TESTS += \ + test_rtsp +endif + +test_sources = \ + test/test_common.h +test_libs = \ + libowfd.la \ + libshl.la \ + $(CHECK_LIBS) +test_cflags = \ + $(AM_CPPFLAGS) \ + $(CHECK_CFLAGS) +test_lflags = \ + $(AM_LDFLAGS) + +test_rtsp_SOURCES = test/test_rtsp.c $(test_sources) +test_rtsp_CPPFLAGS = $(test_cflags) +test_rtsp_LDADD = $(test_libs) +test_rtsp_LDFLAGS = $(test_lflags) + +# +# Phony targets +# + +.PHONY: $(TPHONY) + +# +# Empty .SECONDARY target causes alle intermediate files to be treated as +# secondary files. That is, they don't get deleted after make finished. +# + +.SECONDARY: @@ -0,0 +1,4 @@ += OpenWFD Release News = + +CHANGES WITH 1: + * TODO @@ -1,6 +1,6 @@ OpenWFD - Open-Source WiFi-Display Implementation - ================================================= + =================================================== OpenWFD is currently under heavy development. It is not ready to be used, yet. Stay tuned! diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..65a6fe1 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,17 @@ +#!/bin/sh +set -e + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +origdir=`pwd` +cd $srcdir + +mkdir -p m4 +autoreconf -is --force + +cd $origdir + +if test -z "$NOCONFIGURE" ; then + exec $srcdir/configure "$@" +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..10b8cfc --- /dev/null +++ b/configure.ac @@ -0,0 +1,74 @@ +# +# OpenWFD - Open-Source Wifi-Display Implementation +# Copyright (c) 2013 David Herrmann <dh.herrmann@gmail.com> +# + +AC_PREREQ(2.68) + +AC_INIT([openwfd], + [1], + [http://bugs.freedesktop.org/enter_bug.cgi?product=openwfd], + [openwfd], + [http://www.freedesktop.org/wiki/Software/openwfd]) +AC_CONFIG_SRCDIR([src/openwfd/wfd.h]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_HEADER(config.h) +AC_USE_SYSTEM_EXTENSIONS +AC_SYS_LARGEFILE +AC_CANONICAL_HOST + +AM_INIT_AUTOMAKE([foreign 1.11 subdir-objects dist-xz no-dist-gzip tar-pax -Wall -Werror -Wno-portability]) +AM_SILENT_RULES([yes]) + +AC_SUBST(PACKAGE_DESCRIPTION, ["Open-Source Wifi-Display Implementation"]) + +AC_PROG_CC +AC_PROG_CC_C99 +AM_PROG_CC_C_O +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) +AC_PROG_SED +AC_PROG_MKDIR_P +AC_PROG_LN_S +AC_PROG_GREP +AC_PROG_AWK + +LT_PREREQ(2.2) +LT_INIT + +# +# Test for "check" which we use for our test-suite. If not found, we disable +# all tests. +# + +PKG_CHECK_MODULES([CHECK], [check], + [have_check=yes], [have_check=no]) +AC_SUBST(CHECK_CFLAGS) +AC_SUBST(CHECK_LIBS) +AM_CONDITIONAL([BUILD_HAVE_CHECK], [test "x$have_check" = "xyes"]) + +# +# Makefile vars +# After everything is configured, we create all makefiles. +# + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT + +# +# Configuration output +# Show configuration to the user so they can check whether everything was +# configured as expected. +# + +AC_MSG_NOTICE([Build configuration: + + prefix: $prefix + exec-prefix: $exec_prefix + libdir: $libdir + includedir: $includedir + + Miscellaneous Options: + building tests: $have_check + + Run "${MAKE-make}" to start compilation process]) diff --git a/test/test_common.h b/test/test_common.h new file mode 100644 index 0000000..a4f3a84 --- /dev/null +++ b/test/test_common.h @@ -0,0 +1,107 @@ +/* + * OpenWFD - Open-Source Wifi-Display Implementation + * + * Copyright (c) 2013 David Herrmann <dh.herrmann@gmail.com> + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * Test Helper + * This header includes all kinds of helpers for testing. It tries to include + * everything required and provides simple macros to avoid duplicating code in + * each test. We try to keep tests as small as possible and move everything that + * might be common here. + * + * We avoid sticking to our usual coding conventions (including headers in + * source files, etc. ..) and instead make this the most convenient we can. + */ + +#ifndef TEST_COMMON_H +#define TEST_COMMON_H + +#include <check.h> +#include <inttypes.h> +#include <stdarg.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "shared.h" +#include "rtsp.h" + +/* lower address-space is protected from user-allocation, so this is invalid */ +#define TEST_INVALID_PTR ((void*)0x10) + +#define TEST_DEFINE_CASE(_name) \ + static TCase *test_create_case_##_name(void) \ + { \ + TCase *tc; \ + \ + tc = tcase_create(#_name); \ + +#define TEST(_name) tcase_add_test(tc, _name); + +#define TEST_END_CASE \ + return tc; \ + } \ + +#define TEST_END NULL + +#define TEST_CASE(_name) test_create_case_##_name + +static inline Suite *test_create_suite(const char *name, ...) +{ + Suite *s; + va_list list; + TCase *(*fn)(void); + + s = suite_create(name); + + va_start(list, name); + while ((fn = va_arg(list, TCase *(*)(void)))) + suite_add_tcase(s, fn()); + va_end(list); + + return s; +} + +#define TEST_SUITE(_name, ...) test_create_suite((#_name), ##__VA_ARGS__) + +static inline int test_run_suite(Suite *s) +{ + int ret; + SRunner *sr; + + sr = srunner_create(s); + srunner_run_all(sr, CK_NORMAL); + ret = srunner_ntests_failed(sr); + srunner_free(sr); + + return ret; +} + +#define TEST_DEFINE(_suite) \ + int main(int argc, char **argv) \ + { \ + return test_run_suite(_suite); \ + } + +#endif /* TEST_COMMON_H */ diff --git a/test/test_rtsp.c b/test/test_rtsp.c new file mode 100644 index 0000000..7b90fe0 --- /dev/null +++ b/test/test_rtsp.c @@ -0,0 +1,42 @@ +/* + * OpenWFD - Open-Source Wifi-Display Implementation + * + * Copyright (c) 2013 David Herrmann <dh.herrmann@gmail.com> + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "test_common.h" + +START_TEST(test_rtsp) +{ +} +END_TEST + +TEST_DEFINE_CASE(misc) + TEST(test_rtsp) +TEST_END_CASE + +TEST_DEFINE( + TEST_SUITE(rtsp, + TEST_CASE(misc), + TEST_END + ) +) |