source: trunk/bin/gpl_license.sh @ 3092

Last change on this file since 3092 was 3092, checked in by bradbell, 6 years ago
  1. Make handeling of options cases clearer in speed/adolc and speed/cppad.
  2. Add the boolsparsity option to speed tests.

colpack.sh: add svn Id command at top.
gpl_license.sh: intentionally no license in bin/colpack.sh.
sparse_jacobian.cpp: add bit pattern sparsity option.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 5.7 KB
Line 
1#! /bin/bash -e
2# $Id: gpl_license.sh 3092 2014-02-15 19:27:53Z bradbell $
3# -----------------------------------------------------------------------------
4# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 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# -----------------------------------------------------------------------------
13# Bradley M. Bell has given COIN-OR permission to use this script to generate
14# a distribution of CppAD that has "GNU General Public License Version 3"
15# in place of "Eclipse Public License Version 1.0." in all occurrences
16# of the message above.
17# -----------------------------------------------------------------------------
18if [ ! -e "bin/gpl_license.sh" ]
19then
20        echo "bin/gpl_license.sh: must be executed from its parent directory"
21        exit 1
22fi
23echo_eval() {
24     echo $* 
25     eval $*
26}
27# ----------------------------------------------------------------------------
28if [ "$3" == '' ]
29then
30        echo 'usage: bin/gpl_license.sh archive_name archive_dir work_dir'
31        exit 1
32fi
33archive_name="$1"
34archive_dir="$2"
35work_dir="$3"
36# ----------------------------------------------------------------------------
37start_dir=`pwd`
38if [[ "$archive_name" =~ .*/.* ]]
39then
40        echo "bin/gpl_version.sh: archive_name = $archive_name"
41        echo "                    archive_name cannot contain a / character"
42        exit 1
43fi
44# change archive_dir to an absolute path so can use after changing directories
45first_character=`echo "$archive_dir" | sed -e 's/\(.\).*/\1/'`
46if [ "$first_character" != '/' ]
47then
48        archive_dir="$start_dir/$archive_dir"
49fi
50#
51# delete old gpl version of tarball (if it exists)
52if [ -e $archive_dir/$archive_name.gpl.tgz ]
53then
54        echo_eval rm $archive_dir/$archive_name.gpl.tgz
55fi
56#
57# change into work directory
58echo_eval cd $work_dir
59#
60# delete old version of directory (if it exists)
61if [ -e $archive_name ]
62then
63        echo_eval rm -r $archive_name
64fi
65if [ -e $archive_name ]
66then
67        echo "bin/gpl_license.sh: cannot remove old $archive_name directory"
68        exit 1
69fi
70#
71# extract from the EPL version
72echo_eval tar -xzf $archive_dir/$archive_name.epl.tgz
73#
74# remove documentation directory (if it exists)
75if [ -e $archive_name/doc ]
76then
77        echo_eval rm -r $archive_name/doc
78fi
79#
80# change into the directory
81echo_eval cd $archive_name
82#
83# files that need removing
84echo_eval rm epl-v10.html epl-v10.txt
85#
86# files that need changing
87list=`find . \
88        \( -name '*.ac'  \) -or \
89        \( -name '*.am'  \) -or \
90        \( -name '*.c'   \) -or \
91        \( -name '*.cpp' \) -or \
92        \( -name '*.hpp' \) -or \
93        \( -name '*.in'  \) -or \
94        \( -name '*.omh' \) -or \
95        \( -name '*.pc' \)  -or \
96        \( -name '*.py' \)  -or \
97        \( -name '*.sh' \)  -or \
98        \( -name '*.txt'  \)`
99#
100# change back up to work directory (to be safe)
101echo_eval cd ..
102#
103echo "Changing license from EPL to GPL"
104for file in $list
105do
106        file=`echo $file | sed -e 's|^\./||'`
107        name=`echo $file | sed -e 's|.*\/||'`
108        ext=`echo $name  | sed -e 's|.*\.|\.|'`
109        #
110        if [ "$name" == 'gpl-3.0.txt' ]
111        then
112                echo "gpl-3.0.txt is in $archive_dir/$archive_name.epl.tgz"
113        fi
114        if [ "$name" == 'gpl_license.sh' ]
115        then
116                echo "gpl_license.sh is in $archive_dir/$archive_name.epl.tgz"
117        fi
118        if grep "GNU General Public License" $archive_name/$file > /dev/null
119        then
120                if [ "$name" != "doc.omh" ]
121                then
122                        echo "GPL license in initial $archive_name/$file"
123                        exit 1
124                fi
125        fi
126        #
127        sed -i $archive_name/$file \
128-e 's/Eclipse Public License Version 1.0/GNU General Public License Version 3/' 
129        #
130        if ! grep "GNU General Public License Version 3" $archive_name/$file \
131                > /dev/null
132        then
133                if [ "$name" != 'config.h.in' ] && [ "$name" != 'colpack.sh' ]
134                then
135                        echo "Cannot change EPL to GPL for $archive_name/$file"
136                        exit 1
137                fi
138        fi
139        if [ "$ext" = ".sh" ]
140        then
141                chmod +x $archive_name/$file
142        fi
143done
144#
145echo "change the COPYING file"
146sed -n -i $archive_name/COPYING -e '/-\{70\}/,/-\{70\}/p'
147cat $start_dir/gpl-3.0.txt >> $archive_name/COPYING
148#
149echo "change the file epl-v10.txt to the file gpl-3.0.txt"
150cp $start_dir/gpl-3.0.txt $archive_name/gpl-3.0.txt
151#
152list="
153        makefile.am
154        makefile.in
155        omh/license.omh
156"
157for file in $list
158do
159        if grep "gpl-3.0.txt" $archive_name/$file > /dev/null
160        then
161                echo bin/"gpl_license.sh: gpl-3.0.txt in initial $archive_name/$file"
162                exit 1
163        fi
164        sed -i $archive_name/$file -e 's/epl-v10.txt/gpl-3.0.txt/'
165        if ! grep "gpl-3.0.txt" $archive_name/$file > /dev/null
166        then
167                msg=bin/"gpl_license.sh: cannot change epl-v10.txt to gpl-3.0.txt"
168                echo "$msg for $archive_name/$file"
169                exit 1
170        fi
171done
172#
173# change into the version directory
174echo_eval cd $archive_name
175#
176# Only include the *.xml verison of the documentation in distribution
177# So remove the table at the top (but save the original doc.omh file).
178if ! grep < doc.omh > /dev/null \
179        'This comment is used to remove the table below' 
180then
181        echo "Missing comment expected in doc.omh"
182        exit 1
183fi
184echo "sed -i.save doc.omh ..."
185sed -i.save doc.omh \
186        -e '/This comment is used to remove the table below/,/$tend/d'
187#
188# This command creates omhelp.xml.log in current directory (and says so)
189echo "bin/run_omhelp.sh xml"
190if ! bin/run_omhelp.sh xml
191then
192        mv omhelp.xml.log ../..
193        echo_eval mv doc.omh.save doc.omh
194        exit 1
195fi
196# Move the log to the directory where the start directory
197echo_eval mv omhelp.xml.log $start_dir
198#
199echo_eval mv doc.omh.save doc.omh
200echo_eval cd ..
201# ----------------------------------------------------------------------------
202#
203# create GPL tarball file as copy or the version directory
204echo_eval tar -czf $archive_dir/$archive_name.gpl.tgz $archive_name
205
206# if we reach here, no error occurred
207echo "bin/gpl_license.sh: OK"
Note: See TracBrowser for help on using the repository browser.