source: trunk/bin/package.sh @ 2939

Last change on this file since 2939 was 2939, checked in by bradbell, 7 years ago
  1. Make sure all '# defines' have an '# undef' and vise-verser.
  2. Add adolc tests to jenkins.sh.

check_define.sh: New reoutine that check defines have matching undef.
package.sh: run check_define.sh.
search.sh: add missing source directory to search.
configure.hpp.in: fix bug in speed tests (name of preprocessor macro).
pow.hpp: fix comment.
thread_alloc.hpp: fix spelling in comment.
jenkins.sh: Automatically set LD_LIBRARY_PATH.
base_adolc.hpp: fix problem when using ADOL-C-2.4.1
adolc_prefix.omh: add link to get_adolc.sh.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1#! /bin/bash -e
2# $Id: package.sh 2939 2013-10-14 11:06:18Z bradbell $
3# -----------------------------------------------------------------------------
4# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
5#
6# CppAD is distributed under multiple licenses. This distribution is under
7# the terms of the
8#                     Eclipse Public License Version 1.0.
9#
10# A copy of this license is included in the COPYING file of this distribution.
11# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
12# -----------------------------------------------------------------------------
13if [ $0 != "bin/package.sh" ]
14then
15        echo "bin/package.sh: must be executed from its parent directory"
16        exit 1
17fi
18echo_log_eval() {
19        echo $*
20        echo $* >> $top_srcdir/package.log
21        if ! eval $* >> $top_srcdir/package.log
22        then
23                echo "Error: check package.log"
24                exit 1
25        fi
26}
27log_eval() {
28        echo $* >> $top_srcdir/package.log
29        if ! eval $* >> $top_srcdir/package.log
30        then
31                echo "Error: check package.log"
32                exit 1
33        fi
34}
35if [ -e package.log ]
36then
37        echo "rm package.log"
38        rm package.log
39fi
40top_srcdir=`pwd`
41# ----------------------------------------------------------------------------
42this_license=`\
43        grep '$verbatim%' omh/license.omh | sed -e 's|$verbatim%\(...\).*|\1|'`
44if [ "$this_license" == 'epl' ]
45then
46        remove_list='gpl-3.0.txt bin/gpl_license.sh'
47elif [ "$this_license" == 'gpl' ]
48then
49        remove_list='epl-v10.txt epl-v10.html bin/gpl_license.sh'
50else
51        echo 'bin/package.sh: cannot find license in omh/license.omh'
52        exit 1
53fi
54# ----------------------------------------------------------------------------
55# Automated updates to source directory
56#
57# Get version number and make sure all copies of it are up to date.
58version=`bin/version.sh get`
59echo_log_eval bin/version.sh get
60echo_log_eval bin/version.sh copy
61# ----------------------------------------------------------------------------
62# Run automated checking of file names in original source directory
63# (check_include_omh.sh uses files built by cmake)
64list="
65        check_define.sh
66        check_example.sh
67        check_if_0.sh
68        check_include_def.sh
69        check_include_file.sh
70        check_include_omh.sh
71        check_makefile.sh
72        check_op_code.sh
73        check_svn_id.sh
74        check_verbatim.sh
75"
76for check in $list 
77do
78        echo_log_eval bin/$check
79done
80# ----------------------------------------------------------------------------
81# Check for doxygen errors
82echo_log_eval bin/run_doxygen.sh
83# ----------------------------------------------------------------------------
84# Create the package directory
85package_dir="build/cppad-$version"
86if [ -e "$package_dir" ]
87then
88        echo_log_eval rm -r $package_dir
89fi
90for lic in epl gpl
91do
92        if [ -e "$package_dir.epl.tgz" ]
93        then
94                echo_log_eval rm $package_dir.$lic.tgz
95        fi
96done
97echo_log_eval mkdir -p $package_dir
98# -----------------------------------------------------------------------------
99# Source file that are coppied to the package directory
100file_list=`find . \
101        \( -name '*.ac' \) -or \
102        \( -name '*.am' \) -or \
103        \( -name '*.c' \) -or \
104        \( -name '*.cmake' \) -or \
105        \( -name '*.cpp' \) -or \
106        \( -name '*.h' \) -or \
107        \( -name '*.hpp' \) -or \
108        \( -name '*.html' \) -or \
109        \( -name '*.in' \) -or \
110        \( -name '*.omh' \) -or \
111        \( -name '*.pc' \) -or \
112        \( -name '*.py' \) -or \
113        \( -name '*.sed' \) -or \
114        \( -name '*.sh' \) -or \
115        \( -name '*.txt' \) | sed \
116                -e '/\.\/build\//d' \
117                -e '/bug\/build\//d' \
118                -e '/\/junk.sh$/d' \
119                -e '/\/temp.sh$/d' \
120                -e 's|^\./||'`
121other_files="
122        AUTHORS
123        ChangeLog
124        configure
125        COPYING
126        depcomp
127        INSTALL
128        NEWS
129        README
130"
131#
132# Copy the files, creating sub-directories when necessary
133echo_log_eval echo "copy files to $package_dir"
134for file in $file_list $other_files
135do
136        sub_dir=`echo $file | sed -e 's|\(.*\)/[^/]*$|\1|'`
137        if [ "$sub_dir" != "$file" ]
138        then
139                if [ ! -e "$package_dir/$sub_dir" ]
140                then
141                        log_eval mkdir -p $package_dir/$sub_dir
142                fi
143        fi
144        log_eval cp $file $package_dir/$file
145done
146echo_log_eval echo "remove certain files from $package_dir"
147for file in $remove_list 
148do
149        if [ -e $package_dir/$file ]
150        then
151                echo_log_eval rm $package_dir/$file 
152        fi
153done
154# ----------------------------------------------------------------------------
155# build the xml version of documentation for this distribution
156echo_log_eval cd $package_dir
157#
158# Only include the *.xml verison of the documentation in distribution
159# So remove the table at the top (but save the original doc.omh file).
160if ! grep < doc.omh > /dev/null \
161        'This comment is used to remove the table below' 
162then
163        echo "Missing comment expected in doc.omh"
164        exit 1
165fi
166echo_log_eval echo "sed -i.save doc.omh ..."
167sed -i.save doc.omh \
168        -e '/This comment is used to remove the table below/,/$tend/d'
169#
170# This command creates omhelp.xml.log in current directory (and says so)
171echo_log_eval echo "bin/run_omhelp.sh xml"
172if ! bin/run_omhelp.sh xml
173then
174        echo_log_eval cp omhelp.xml.log $top_srcdir/omhelp.xml.log
175        exit 1
176fi
177# Copy the log to the directory where the package.sh command was executed
178echo_log_eval cp omhelp.xml.log $top_srcdir/omhelp.xml.log
179# Restore the original doc.omh
180echo_log_eval mv doc.omh.save doc.omh
181# ----------------------------------------------------------------------------
182# change back to the package parent directory and create the tarball
183echo_log_eval cd ..
184echo_log_eval tar -czf cppad-$version.$this_license.tgz cppad-$version
185# ----------------------------------------------------------------------------
186# create gpl version of package
187echo_log_eval cd $top_srcdir
188if [ -e 'bin/gpl_license.sh' ]
189then
190        if [ "$this_license" != 'epl' ]
191        then
192                echo 'package.sh: bin/gpl_license.sh found in gpl verison of source.'
193                exit 1
194        fi
195        echo_log_eval bin/gpl_license.sh cppad-$version build build
196fi
Note: See TracBrowser for help on using the repository browser.