source: trunk/bin/package.sh @ 2903

Last change on this file since 2903 was 2903, checked in by bradbell, 7 years ago

Add lines from atomic_base documentation to corresponding examples.

package.sh: ignore the bug/build directory.

  • 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 2903 2013-09-19 15:53:13Z 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_example.sh
66        check_if_0.sh
67        check_include_def.sh
68        check_include_file.sh
69        check_include_omh.sh
70        check_makefile.sh
71        check_op_code.sh
72        check_svn_id.sh
73        check_verbatim.sh
74"
75for check in $list 
76do
77        echo_log_eval bin/$check
78done
79# ----------------------------------------------------------------------------
80# Check for doxygen errors
81echo_log_eval bin/run_doxygen.sh
82# ----------------------------------------------------------------------------
83# Create the package directory
84package_dir="build/cppad-$version"
85if [ -e "$package_dir" ]
86then
87        echo_log_eval rm -r $package_dir
88fi
89for lic in epl gpl
90do
91        if [ -e "$package_dir.epl.tgz" ]
92        then
93                echo_log_eval rm $package_dir.$lic.tgz
94        fi
95done
96echo_log_eval mkdir -p $package_dir
97# -----------------------------------------------------------------------------
98# Source file that are coppied to the package directory
99file_list=`find . \
100        \( -name '*.ac' \) -or \
101        \( -name '*.am' \) -or \
102        \( -name '*.c' \) -or \
103        \( -name '*.cmake' \) -or \
104        \( -name '*.cpp' \) -or \
105        \( -name '*.h' \) -or \
106        \( -name '*.hpp' \) -or \
107        \( -name '*.html' \) -or \
108        \( -name '*.in' \) -or \
109        \( -name '*.omh' \) -or \
110        \( -name '*.pc' \) -or \
111        \( -name '*.py' \) -or \
112        \( -name '*.sed' \) -or \
113        \( -name '*.sh' \) -or \
114        \( -name '*.txt' \) | sed \
115                -e '/\.\/build\//d' \
116                -e '/bug\/build\//d' \
117                -e '/\/junk.sh$/d' \
118                -e '/\/temp.sh$/d' \
119                -e 's|^\./||'`
120other_files="
121        AUTHORS
122        ChangeLog
123        configure
124        COPYING
125        depcomp
126        INSTALL
127        NEWS
128        README
129"
130#
131# Copy the files, creating sub-directories when necessary
132echo_log_eval echo "copy files to $package_dir"
133for file in $file_list $other_files
134do
135        sub_dir=`echo $file | sed -e 's|\(.*\)/[^/]*$|\1|'`
136        if [ "$sub_dir" != "$file" ]
137        then
138                if [ ! -e "$package_dir/$sub_dir" ]
139                then
140                        log_eval mkdir -p $package_dir/$sub_dir
141                fi
142        fi
143        log_eval cp $file $package_dir/$file
144done
145echo_log_eval echo "remove certain files from $package_dir"
146for file in $remove_list 
147do
148        if [ -e $package_dir/$file ]
149        then
150                echo_log_eval rm $package_dir/$file 
151        fi
152done
153# ----------------------------------------------------------------------------
154# build the xml version of documentation for this distribution
155echo_log_eval cd $package_dir
156#
157# Only include the *.xml verison of the documentation in distribution
158# So remove the table at the top (but save the original doc.omh file).
159if ! grep < doc.omh > /dev/null \
160        'This comment is used to remove the table below' 
161then
162        echo "Missing comment expected in doc.omh"
163        exit 1
164fi
165echo_log_eval echo "sed -i.save doc.omh ..."
166sed -i.save doc.omh \
167        -e '/This comment is used to remove the table below/,/$tend/d'
168#
169# This command creates omhelp.xml.log in current directory (and says so)
170echo_log_eval echo "bin/run_omhelp.sh xml"
171if ! bin/run_omhelp.sh xml
172then
173        echo_log_eval cp omhelp.xml.log $top_srcdir/omhelp.xml.log
174        exit 1
175fi
176# Copy the log to the directory where the package.sh command was executed
177echo_log_eval cp omhelp.xml.log $top_srcdir/omhelp.xml.log
178# Restore the original doc.omh
179echo_log_eval mv doc.omh.save doc.omh
180# ----------------------------------------------------------------------------
181# change back to the package parent directory and create the tarball
182echo_log_eval cd ..
183echo_log_eval tar -czf cppad-$version.$this_license.tgz cppad-$version
184# ----------------------------------------------------------------------------
185# create gpl version of package
186echo_log_eval cd $top_srcdir
187if [ -e 'bin/gpl_license.sh' ]
188then
189        if [ "$this_license" != 'epl' ]
190        then
191                echo 'package.sh: bin/gpl_license.sh found in gpl verison of source.'
192                exit 1
193        fi
194        echo_log_eval bin/gpl_license.sh cppad-$version build build
195fi
Note: See TracBrowser for help on using the repository browser.