1 | # $Id: gen_libmy_static.sh 3041 2013-06-08 12:51:14Z peter $ |
---|
2 | |
---|
3 | # Create a static library: test/lib/libmy-static.a |
---|
4 | |
---|
5 | # Copyright (C) 2013 Peter Johansson |
---|
6 | # |
---|
7 | # This file is part of the yat library, http://dev.thep.lu.se/yat |
---|
8 | # |
---|
9 | # The yat library is free software; you can redistribute it |
---|
10 | # and/or modify it under the terms of the GNU General Public License as |
---|
11 | # published by the Free Software Foundation; either version 3 of the |
---|
12 | # License, or (at your option) any later version. |
---|
13 | # |
---|
14 | # The yat library is distributed in the hope that it will be useful, |
---|
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
17 | # General Public License for more details. |
---|
18 | # |
---|
19 | # You should have received a copy of the GNU General Public License |
---|
20 | # along with yat. If not, see <http://www.gnu.org/licenses/>. |
---|
21 | |
---|
22 | . test/defs.sh || exit 99 |
---|
23 | |
---|
24 | rm -rf $test_dir/* |
---|
25 | $mkdir_p $test_dir |
---|
26 | cd $test_dir |
---|
27 | |
---|
28 | # redefine so we can call check_requirment without exit |
---|
29 | exit_skip () |
---|
30 | { |
---|
31 | req_failed=yes |
---|
32 | } |
---|
33 | |
---|
34 | required="autoconf automake static" |
---|
35 | check_requirements > stdout 2> stderr |
---|
36 | |
---|
37 | # if requirments are misssing we just create an empty dummy file (to |
---|
38 | # avoid triggering the make target over and over again) |
---|
39 | if test x$req_failed = xyes; then |
---|
40 | $mkdir_p $abs_top_builddir/test/lib |
---|
41 | : > $abs_top_builddir/test/lib/libmy-static.a |
---|
42 | exit 0 |
---|
43 | fi |
---|
44 | |
---|
45 | cat > configure.ac <<EOF |
---|
46 | AC_INIT([foo], [1]) |
---|
47 | AM_INIT_AUTOMAKE([foreign]) |
---|
48 | AC_PROG_CXX |
---|
49 | AC_PROG_RANLIB |
---|
50 | AC_CONFIG_FILES([Makefile]) |
---|
51 | AC_OUTPUT |
---|
52 | EOF |
---|
53 | |
---|
54 | cat > Makefile.am <<EOF |
---|
55 | lib_LIBRARIES = libmy-static.a |
---|
56 | libmy_static_a_SOURCES = foo.cc |
---|
57 | EOF |
---|
58 | |
---|
59 | cat > foo.cc <<EOF |
---|
60 | int foo_static(void) { return 0; } |
---|
61 | EOF |
---|
62 | |
---|
63 | verbose= |
---|
64 | bootstrap |
---|
65 | ./configure --prefix=$abs_top_builddir/test || exit 1 |
---|
66 | |
---|
67 | unset MAKEFLAGS |
---|
68 | make install V=0 || exit 1 |
---|
69 | exit 0 |
---|