1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/PTdecode/CImg-1.3.0/resources/cimg_buildpackage Mon Aug 03 14:09:20 2009 +0100 1.3 @@ -0,0 +1,206 @@ 1.4 +#!/bin/bash 1.5 +# 1.6 +# File : cimg_buildpackage 1.7 +# ( Bash script ) 1.8 +# 1.9 +# Description : Build .zip, .tar.gz and .deb package files 1.10 +# of the CImg Library, from the current CImg/ 1.11 +# directory. Must be run from ../CImg 1.12 +# This file is a part of the CImg Library project. 1.13 +# ( http://cimg.sourceforge.net ) 1.14 +# 1.15 +# Usage : ./cimg_buildpackage [beta] [compile] 1.16 +# 1.17 +# Copyright : David Tschumperle 1.18 +# ( http://www.greyc.ensicaen.fr/~dtschump/ ) 1.19 +# 1.20 +# License : CeCILL v2.0 1.21 +# ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html ) 1.22 +# 1.23 +# This software is governed by the CeCILL license under French law and 1.24 +# abiding by the rules of distribution of free software. You can use, 1.25 +# modify and/ or redistribute the software under the terms of the CeCILL 1.26 +# license as circulated by CEA, CNRS and INRIA at the following URL 1.27 +# "http://www.cecill.info". 1.28 +# 1.29 +# As a counterpart to the access to the source code and rights to copy, 1.30 +# modify and redistribute granted by the license, users are provided only 1.31 +# with a limited warranty and the software's author, the holder of the 1.32 +# economic rights, and the successive licensors have only limited 1.33 +# liability. 1.34 +# 1.35 +# In this respect, the user's attention is drawn to the risks associated 1.36 +# with loading, using, modifying and/or developing or reproducing the 1.37 +# software by the user in light of its specific status of free software, 1.38 +# that may mean that it is complicated to manipulate, and that also 1.39 +# therefore means that it is reserved for developers and experienced 1.40 +# professionals having in-depth computer knowledge. Users are therefore 1.41 +# encouraged to load and test the software's suitability as regards their 1.42 +# requirements in conditions enabling the security of their systems and/or 1.43 +# data to be ensured and, more generally, to use and operate it in the 1.44 +# same conditions as regards security. 1.45 +# 1.46 +# The fact that you are presently reading this means that you have had 1.47 +# knowledge of the CeCILL license and that you accept its terms. 1.48 +# 1.49 + 1.50 +# Define release number. 1.51 +RELEASE0=`grep "#define cimg_version" CImg/CImg.h | tail -c 4` 1.52 +RELEASE1=`echo $RELEASE0 | head -c 1` 1.53 +RELEASE2=`echo $RELEASE0 | head -c 2 | tail -c 1` 1.54 +RELEASE3=`echo $RELEASE0 | head -c 3 | tail -c 1` 1.55 +RELEASE=$RELEASE1.$RELEASE2.$RELEASE3 1.56 + 1.57 +# Read command line options. 1.58 +if [ "$1" == "beta" -o "$2" == "beta" ]; then BETA="yes"; RELEASE=${RELEASE}beta; else BETA="no"; fi 1.59 +if [ "$1" == "compile" -o "$2" == "compile" ]; then COMPILE="yes"; else COMPILE="no"; fi 1.60 + 1.61 +# Define the different paths and filenames used in this script. 1.62 +BASE_DIR=`pwd` 1.63 +cd ${BASE_DIR} 1.64 +SRC_DIR=${BASE_DIR}/CImg 1.65 +DEST_DIR=/tmp/CImg-${RELEASE} 1.66 +ZIP_FILE=CImg-${RELEASE}.zip 1.67 +TAR_FILE=CImg_${RELEASE}.tar 1.68 +DEB_DIR=cimg-${RELEASE} 1.69 +DEB_FILE=cimg-dev_${RELEASE}-1_all.deb 1.70 +LOG_FILE=${BASE_DIR}/LOG_`basename $DEST_DIR`.txt 1.71 +rm -rf $LOG_FILE 1.72 + 1.73 +echo 1.74 +echo " - Release number : $RELEASE" 1.75 +echo " - Base directory : $BASE_DIR/" 1.76 +echo " - Source directory : $SRC_DIR/" 1.77 +echo " - Build directory : $DEST_DIR/" 1.78 +echo " - ZIP package filename : $ZIP_FILE" 1.79 +echo " - TAR.GZ package filename : $TAR_FILE.gz" 1.80 +echo " - DEB package filename : $DEB_FILE" 1.81 +echo " - LOG file : $LOG_FILE" 1.82 +echo " - Compile examples : $COMPILE" 1.83 + 1.84 +# Create archive structure 1.85 +echo " - Create package structure." 1.86 +rm -rf $DEST_DIR 1.87 +mkdir $DEST_DIR 1.88 +cd $SRC_DIR 1.89 +cp -f CHANGES.txt CImg.h Licence_CeCILL-C_V1-en.txt Licence_CeCILL_V2-en.txt README.txt $DEST_DIR 1.90 + 1.91 +mkdir $DEST_DIR/examples 1.92 +cd $SRC_DIR/examples 1.93 +cp -f *.cpp *.h *_def.raw Makefile *.m $DEST_DIR/examples/ 1.94 +mkdir $DEST_DIR/examples/img 1.95 +cd $SRC_DIR/examples/img 1.96 +cp -f *.pgm *.ppm *.bmp *.h $DEST_DIR/examples/img/ 1.97 + 1.98 +mkdir $DEST_DIR/html 1.99 +cd $SRC_DIR/html 1.100 +cp -f *.shtml *.html *.doxygen *.h favicon.* $DEST_DIR/html/ 1.101 +mkdir $DEST_DIR/html/img 1.102 +cd $SRC_DIR/html/img 1.103 +cp -f *.html *.jpg *.gif *.png *.ppm $DEST_DIR/html/img/ 1.104 + 1.105 +mkdir $DEST_DIR/plugins 1.106 +cd $SRC_DIR/plugins 1.107 +cp -f *.h $DEST_DIR/plugins/ 1.108 + 1.109 +mkdir $DEST_DIR/resources 1.110 +cd $SRC_DIR/resources 1.111 +cp -rf *.bat *.txt cimg_buildpackage debian project_* $DEST_DIR/resources/ 1.112 + 1.113 +# Clean directory 1.114 +echo " - Clean package directory." 1.115 +cd $DEST_DIR 1.116 +for i in `find . -name "\#*"`; do rm -rf $i; done 1.117 +for i in `find . -name "*~"`; do rm -rf $i; done 1.118 +for i in `find . -name "core*"`; do rm -rf $i; done 1.119 +for i in `find . -name "CVS"`; do rm -rf $i; done 1.120 +for i in `find . -name "*.plg"`; do rm -rf $i; done 1.121 +for i in `find . -name "*.ncb"`; do rm -rf $i; done 1.122 +for i in `find . -name "*.layout"`; do rm -rf $i; done 1.123 +for i in `find . -name "*.win"`; do rm -rf $i; done 1.124 +for i in `find . -name "Debug"`; do rm -rf $i; done 1.125 +for i in `find . -name "Release"`; do rm -rf $i; done 1.126 +for i in `find . -name "*.h"`; do col -x <$i >tmp; mv tmp $i; done 1.127 +for i in `find . -name "*.cpp"`; do col -x <$i >tmp; mv tmp $i; done 1.128 +for i in `find . ! -type d`; do chmod a-x $i; done 1.129 +for i in `find . -name "*.sh"`; do chmod a+x $i; done 1.130 +for i in `find . -name "rules"`; do chmod a+x $i; done 1.131 +iconv -t utf8 -f latin1 resources/debian/changelog > /tmp/foo.changelog 1.132 +mv /tmp/foo.changelog resources/debian/changelog 1.133 +iconv -t utf8 -f latin1 resources/debian/control > /tmp/foo.control 1.134 +mv /tmp/foo.control resources/debian/control 1.135 +chmod a+x $DEST_DIR/resources/cimg_buildpackage 1.136 + 1.137 +# Generate special files 'gmic.h' and 'gmic4gimp.h' 1.138 +# (gmic must be installed !) 1.139 +cd $DEST_DIR/examples 1.140 +make gmic_def >>$LOG_FILE 2>&1 1.141 +make gmic4gimp_def >>$LOG_FILE 2>&1 1.142 + 1.143 +# Generate Documentation with doxygen 1.144 +echo " - Generate reference documentation using Doxygen." 1.145 +cd $DEST_DIR/html 1.146 +echo -e "\n** Log generated by 'doxygen' **\n\n">>$LOG_FILE 1.147 +doxygen CImg.doxygen>>$LOG_FILE 2>&1 1.148 + 1.149 +echo " - Build reference documentation in PDF format." 1.150 +cd $DEST_DIR/html/latex 1.151 +echo -e "\n** Log generated by 'latex' **\n\n">>$LOG_FILE 1.152 +make>>$LOG_FILE 2>&1 1.153 +cp -f refman.pdf ../CImg_reference.pdf 1.154 +rm -rf ../latex 1.155 + 1.156 +# Create ZIP archive 1.157 +echo " - Build ZIP archive file '$ZIP_FILE'." 1.158 +cd $DEST_DIR/.. 1.159 +rm -f $ZIP_FILE 1.160 +echo -e "\n** Log generated by 'zip' **\n\n">>$LOG_FILE 1.161 +zip -r -9 $ZIP_FILE `basename $DEST_DIR`>>$LOG_FILE 2>&1 1.162 + 1.163 +# Create TAR.GZ archive 1.164 +echo " - Build TAR.GZ archive file '$TAR_FILE.gz'." 1.165 +cd $DEST_DIR/.. 1.166 +rm -f $TAR_FILE $TAR_FILE.gz 1.167 +echo -e "\n** Log generated by 'tar' **\n\n">>$LOG_FILE 1.168 +tar cvf $TAR_FILE `basename $DEST_DIR`>>$LOG_FILE 2>&1 1.169 +gzip --best $TAR_FILE 1.170 + 1.171 +# Compile examples 1.172 +if [ $COMPILE == "yes" ]; then 1.173 +echo " - Compile CImg examples." 1.174 +cd $DEST_DIR/examples/ 1.175 +mkdir -p ../bin 1.176 +echo -e "\n** Log generated by 'CImg compilation' **\n\n">>$LOG_FILE 1.177 +make -j "CC=g++ -Dcimg_imagepath=\"\\\"/usr/share/CImg/examples/img/\\\"\"" EXEPFX=../bin/cimg_ olinux 1.178 +rm -f *.o 1.179 +cd $DEST_DIR/resources/debian 1.180 +echo "bin/* usr/bin/" >> cimg-dev.install 1.181 +fi 1.182 + 1.183 +# Create Debian package 1.184 +echo " - Build Debian package file '$DEB_FILE'." 1.185 +cd $DEST_DIR/.. 1.186 +rm -rf $DEB_DIR.tar $DEB_DIR.tar.gz 1.187 +mv $DEST_DIR $DEB_DIR 1.188 +tar cvf $DEB_DIR.tar $DEB_DIR>>$LOG_FILE 2>&1 1.189 +gzip $DEB_DIR.tar 1.190 +cp -f $DEB_DIR.tar.gz cimg_$RELEASE.orig.tar.gz 1.191 + 1.192 +cd $DEB_DIR 1.193 +cp -f CHANGES.txt changelog 1.194 +cp -rf resources/debian . 1.195 +export DEBNAME=$DEB_FILE 1.196 +export DEBFULLNAME="David Tschumperlé" 1.197 +export DEBEMAIL="David.Tschumperle@greyc.ensicaen.fr" 1.198 +echo -e "\n** Log generated by 'Debian packaging tools' **\n\n">>$LOG_FILE 1.199 +dpkg-buildpackage -rfakeroot>>$LOG_FILE 2>&1 1.200 +cd ../ 1.201 +mv $DEB_DIR $DEST_DIR 1.202 + 1.203 +# Clean temporary files and directories 1.204 +echo " - Clean temporary files and directories." 1.205 +cd $DEST_DIR/.. 1.206 +mv $ZIP_FILE $TAR_FILE.gz $DEB_FILE $BASE_DIR 1.207 + 1.208 +# End of build script 1.209 +echo -e " - All done, you should look at the LOG file '$LOG_FILE'.\n"