source: trunk/bin/package.sh @ 3553

Last change on this file since 3553 was 3553, checked in by bradbell, 5 years ago

git-svn faild on these transfers, so done by hand.

add_copyright.sh: change copyright date.
check_copyright.sh: new routine to keep copyright up to date.
commit.sed: old copyright utility.
commit.sh: old commit utility, now use a generic one for all packages.
github2coin.sh: utility that moves commits from github to coin.
package.sh: add new utility to list of checks.
color_symmetric.hpp: only compile when Colpack is present.
makefile.in: changes automatically generated by auto-tools.
makefile.in: changes automatically generated b auto-tools.

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