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