Tue, 18 Mar 2014 01:27:15 +0000
Update PTdecode to handle output from other Ptouch drivers
philpem@5 | 1 | #!/bin/bash |
philpem@5 | 2 | # |
philpem@5 | 3 | # File : cimg_buildpackage |
philpem@5 | 4 | # ( Bash script ) |
philpem@5 | 5 | # |
philpem@5 | 6 | # Description : Build .zip, .tar.gz and .deb package files |
philpem@5 | 7 | # of the CImg Library, from the current CImg/ |
philpem@5 | 8 | # directory. Must be run from ../CImg |
philpem@5 | 9 | # This file is a part of the CImg Library project. |
philpem@5 | 10 | # ( http://cimg.sourceforge.net ) |
philpem@5 | 11 | # |
philpem@5 | 12 | # Usage : ./cimg_buildpackage [beta] [compile] |
philpem@5 | 13 | # |
philpem@5 | 14 | # Copyright : David Tschumperle |
philpem@5 | 15 | # ( http://www.greyc.ensicaen.fr/~dtschump/ ) |
philpem@5 | 16 | # |
philpem@5 | 17 | # License : CeCILL v2.0 |
philpem@5 | 18 | # ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html ) |
philpem@5 | 19 | # |
philpem@5 | 20 | # This software is governed by the CeCILL license under French law and |
philpem@5 | 21 | # abiding by the rules of distribution of free software. You can use, |
philpem@5 | 22 | # modify and/ or redistribute the software under the terms of the CeCILL |
philpem@5 | 23 | # license as circulated by CEA, CNRS and INRIA at the following URL |
philpem@5 | 24 | # "http://www.cecill.info". |
philpem@5 | 25 | # |
philpem@5 | 26 | # As a counterpart to the access to the source code and rights to copy, |
philpem@5 | 27 | # modify and redistribute granted by the license, users are provided only |
philpem@5 | 28 | # with a limited warranty and the software's author, the holder of the |
philpem@5 | 29 | # economic rights, and the successive licensors have only limited |
philpem@5 | 30 | # liability. |
philpem@5 | 31 | # |
philpem@5 | 32 | # In this respect, the user's attention is drawn to the risks associated |
philpem@5 | 33 | # with loading, using, modifying and/or developing or reproducing the |
philpem@5 | 34 | # software by the user in light of its specific status of free software, |
philpem@5 | 35 | # that may mean that it is complicated to manipulate, and that also |
philpem@5 | 36 | # therefore means that it is reserved for developers and experienced |
philpem@5 | 37 | # professionals having in-depth computer knowledge. Users are therefore |
philpem@5 | 38 | # encouraged to load and test the software's suitability as regards their |
philpem@5 | 39 | # requirements in conditions enabling the security of their systems and/or |
philpem@5 | 40 | # data to be ensured and, more generally, to use and operate it in the |
philpem@5 | 41 | # same conditions as regards security. |
philpem@5 | 42 | # |
philpem@5 | 43 | # The fact that you are presently reading this means that you have had |
philpem@5 | 44 | # knowledge of the CeCILL license and that you accept its terms. |
philpem@5 | 45 | # |
philpem@5 | 46 | |
philpem@5 | 47 | # Define release number. |
philpem@5 | 48 | RELEASE0=`grep "#define cimg_version" CImg/CImg.h | tail -c 4` |
philpem@5 | 49 | RELEASE1=`echo $RELEASE0 | head -c 1` |
philpem@5 | 50 | RELEASE2=`echo $RELEASE0 | head -c 2 | tail -c 1` |
philpem@5 | 51 | RELEASE3=`echo $RELEASE0 | head -c 3 | tail -c 1` |
philpem@5 | 52 | RELEASE=$RELEASE1.$RELEASE2.$RELEASE3 |
philpem@5 | 53 | |
philpem@5 | 54 | # Read command line options. |
philpem@5 | 55 | if [ "$1" == "beta" -o "$2" == "beta" ]; then BETA="yes"; RELEASE=${RELEASE}beta; else BETA="no"; fi |
philpem@5 | 56 | if [ "$1" == "compile" -o "$2" == "compile" ]; then COMPILE="yes"; else COMPILE="no"; fi |
philpem@5 | 57 | |
philpem@5 | 58 | # Define the different paths and filenames used in this script. |
philpem@5 | 59 | BASE_DIR=`pwd` |
philpem@5 | 60 | cd ${BASE_DIR} |
philpem@5 | 61 | SRC_DIR=${BASE_DIR}/CImg |
philpem@5 | 62 | DEST_DIR=/tmp/CImg-${RELEASE} |
philpem@5 | 63 | ZIP_FILE=CImg-${RELEASE}.zip |
philpem@5 | 64 | TAR_FILE=CImg_${RELEASE}.tar |
philpem@5 | 65 | DEB_DIR=cimg-${RELEASE} |
philpem@5 | 66 | DEB_FILE=cimg-dev_${RELEASE}-1_all.deb |
philpem@5 | 67 | LOG_FILE=${BASE_DIR}/LOG_`basename $DEST_DIR`.txt |
philpem@5 | 68 | rm -rf $LOG_FILE |
philpem@5 | 69 | |
philpem@5 | 70 | echo |
philpem@5 | 71 | echo " - Release number : $RELEASE" |
philpem@5 | 72 | echo " - Base directory : $BASE_DIR/" |
philpem@5 | 73 | echo " - Source directory : $SRC_DIR/" |
philpem@5 | 74 | echo " - Build directory : $DEST_DIR/" |
philpem@5 | 75 | echo " - ZIP package filename : $ZIP_FILE" |
philpem@5 | 76 | echo " - TAR.GZ package filename : $TAR_FILE.gz" |
philpem@5 | 77 | echo " - DEB package filename : $DEB_FILE" |
philpem@5 | 78 | echo " - LOG file : $LOG_FILE" |
philpem@5 | 79 | echo " - Compile examples : $COMPILE" |
philpem@5 | 80 | |
philpem@5 | 81 | # Create archive structure |
philpem@5 | 82 | echo " - Create package structure." |
philpem@5 | 83 | rm -rf $DEST_DIR |
philpem@5 | 84 | mkdir $DEST_DIR |
philpem@5 | 85 | cd $SRC_DIR |
philpem@5 | 86 | cp -f CHANGES.txt CImg.h Licence_CeCILL-C_V1-en.txt Licence_CeCILL_V2-en.txt README.txt $DEST_DIR |
philpem@5 | 87 | |
philpem@5 | 88 | mkdir $DEST_DIR/examples |
philpem@5 | 89 | cd $SRC_DIR/examples |
philpem@5 | 90 | cp -f *.cpp *.h *_def.raw Makefile *.m $DEST_DIR/examples/ |
philpem@5 | 91 | mkdir $DEST_DIR/examples/img |
philpem@5 | 92 | cd $SRC_DIR/examples/img |
philpem@5 | 93 | cp -f *.pgm *.ppm *.bmp *.h $DEST_DIR/examples/img/ |
philpem@5 | 94 | |
philpem@5 | 95 | mkdir $DEST_DIR/html |
philpem@5 | 96 | cd $SRC_DIR/html |
philpem@5 | 97 | cp -f *.shtml *.html *.doxygen *.h favicon.* $DEST_DIR/html/ |
philpem@5 | 98 | mkdir $DEST_DIR/html/img |
philpem@5 | 99 | cd $SRC_DIR/html/img |
philpem@5 | 100 | cp -f *.html *.jpg *.gif *.png *.ppm $DEST_DIR/html/img/ |
philpem@5 | 101 | |
philpem@5 | 102 | mkdir $DEST_DIR/plugins |
philpem@5 | 103 | cd $SRC_DIR/plugins |
philpem@5 | 104 | cp -f *.h $DEST_DIR/plugins/ |
philpem@5 | 105 | |
philpem@5 | 106 | mkdir $DEST_DIR/resources |
philpem@5 | 107 | cd $SRC_DIR/resources |
philpem@5 | 108 | cp -rf *.bat *.txt cimg_buildpackage debian project_* $DEST_DIR/resources/ |
philpem@5 | 109 | |
philpem@5 | 110 | # Clean directory |
philpem@5 | 111 | echo " - Clean package directory." |
philpem@5 | 112 | cd $DEST_DIR |
philpem@5 | 113 | for i in `find . -name "\#*"`; do rm -rf $i; done |
philpem@5 | 114 | for i in `find . -name "*~"`; do rm -rf $i; done |
philpem@5 | 115 | for i in `find . -name "core*"`; do rm -rf $i; done |
philpem@5 | 116 | for i in `find . -name "CVS"`; do rm -rf $i; done |
philpem@5 | 117 | for i in `find . -name "*.plg"`; do rm -rf $i; done |
philpem@5 | 118 | for i in `find . -name "*.ncb"`; do rm -rf $i; done |
philpem@5 | 119 | for i in `find . -name "*.layout"`; do rm -rf $i; done |
philpem@5 | 120 | for i in `find . -name "*.win"`; do rm -rf $i; done |
philpem@5 | 121 | for i in `find . -name "Debug"`; do rm -rf $i; done |
philpem@5 | 122 | for i in `find . -name "Release"`; do rm -rf $i; done |
philpem@5 | 123 | for i in `find . -name "*.h"`; do col -x <$i >tmp; mv tmp $i; done |
philpem@5 | 124 | for i in `find . -name "*.cpp"`; do col -x <$i >tmp; mv tmp $i; done |
philpem@5 | 125 | for i in `find . ! -type d`; do chmod a-x $i; done |
philpem@5 | 126 | for i in `find . -name "*.sh"`; do chmod a+x $i; done |
philpem@5 | 127 | for i in `find . -name "rules"`; do chmod a+x $i; done |
philpem@5 | 128 | iconv -t utf8 -f latin1 resources/debian/changelog > /tmp/foo.changelog |
philpem@5 | 129 | mv /tmp/foo.changelog resources/debian/changelog |
philpem@5 | 130 | iconv -t utf8 -f latin1 resources/debian/control > /tmp/foo.control |
philpem@5 | 131 | mv /tmp/foo.control resources/debian/control |
philpem@5 | 132 | chmod a+x $DEST_DIR/resources/cimg_buildpackage |
philpem@5 | 133 | |
philpem@5 | 134 | # Generate special files 'gmic.h' and 'gmic4gimp.h' |
philpem@5 | 135 | # (gmic must be installed !) |
philpem@5 | 136 | cd $DEST_DIR/examples |
philpem@5 | 137 | make gmic_def >>$LOG_FILE 2>&1 |
philpem@5 | 138 | make gmic4gimp_def >>$LOG_FILE 2>&1 |
philpem@5 | 139 | |
philpem@5 | 140 | # Generate Documentation with doxygen |
philpem@5 | 141 | echo " - Generate reference documentation using Doxygen." |
philpem@5 | 142 | cd $DEST_DIR/html |
philpem@5 | 143 | echo -e "\n** Log generated by 'doxygen' **\n\n">>$LOG_FILE |
philpem@5 | 144 | doxygen CImg.doxygen>>$LOG_FILE 2>&1 |
philpem@5 | 145 | |
philpem@5 | 146 | echo " - Build reference documentation in PDF format." |
philpem@5 | 147 | cd $DEST_DIR/html/latex |
philpem@5 | 148 | echo -e "\n** Log generated by 'latex' **\n\n">>$LOG_FILE |
philpem@5 | 149 | make>>$LOG_FILE 2>&1 |
philpem@5 | 150 | cp -f refman.pdf ../CImg_reference.pdf |
philpem@5 | 151 | rm -rf ../latex |
philpem@5 | 152 | |
philpem@5 | 153 | # Create ZIP archive |
philpem@5 | 154 | echo " - Build ZIP archive file '$ZIP_FILE'." |
philpem@5 | 155 | cd $DEST_DIR/.. |
philpem@5 | 156 | rm -f $ZIP_FILE |
philpem@5 | 157 | echo -e "\n** Log generated by 'zip' **\n\n">>$LOG_FILE |
philpem@5 | 158 | zip -r -9 $ZIP_FILE `basename $DEST_DIR`>>$LOG_FILE 2>&1 |
philpem@5 | 159 | |
philpem@5 | 160 | # Create TAR.GZ archive |
philpem@5 | 161 | echo " - Build TAR.GZ archive file '$TAR_FILE.gz'." |
philpem@5 | 162 | cd $DEST_DIR/.. |
philpem@5 | 163 | rm -f $TAR_FILE $TAR_FILE.gz |
philpem@5 | 164 | echo -e "\n** Log generated by 'tar' **\n\n">>$LOG_FILE |
philpem@5 | 165 | tar cvf $TAR_FILE `basename $DEST_DIR`>>$LOG_FILE 2>&1 |
philpem@5 | 166 | gzip --best $TAR_FILE |
philpem@5 | 167 | |
philpem@5 | 168 | # Compile examples |
philpem@5 | 169 | if [ $COMPILE == "yes" ]; then |
philpem@5 | 170 | echo " - Compile CImg examples." |
philpem@5 | 171 | cd $DEST_DIR/examples/ |
philpem@5 | 172 | mkdir -p ../bin |
philpem@5 | 173 | echo -e "\n** Log generated by 'CImg compilation' **\n\n">>$LOG_FILE |
philpem@5 | 174 | make -j "CC=g++ -Dcimg_imagepath=\"\\\"/usr/share/CImg/examples/img/\\\"\"" EXEPFX=../bin/cimg_ olinux |
philpem@5 | 175 | rm -f *.o |
philpem@5 | 176 | cd $DEST_DIR/resources/debian |
philpem@5 | 177 | echo "bin/* usr/bin/" >> cimg-dev.install |
philpem@5 | 178 | fi |
philpem@5 | 179 | |
philpem@5 | 180 | # Create Debian package |
philpem@5 | 181 | echo " - Build Debian package file '$DEB_FILE'." |
philpem@5 | 182 | cd $DEST_DIR/.. |
philpem@5 | 183 | rm -rf $DEB_DIR.tar $DEB_DIR.tar.gz |
philpem@5 | 184 | mv $DEST_DIR $DEB_DIR |
philpem@5 | 185 | tar cvf $DEB_DIR.tar $DEB_DIR>>$LOG_FILE 2>&1 |
philpem@5 | 186 | gzip $DEB_DIR.tar |
philpem@5 | 187 | cp -f $DEB_DIR.tar.gz cimg_$RELEASE.orig.tar.gz |
philpem@5 | 188 | |
philpem@5 | 189 | cd $DEB_DIR |
philpem@5 | 190 | cp -f CHANGES.txt changelog |
philpem@5 | 191 | cp -rf resources/debian . |
philpem@5 | 192 | export DEBNAME=$DEB_FILE |
philpem@5 | 193 | export DEBFULLNAME="David Tschumperlé" |
philpem@5 | 194 | export DEBEMAIL="David.Tschumperle@greyc.ensicaen.fr" |
philpem@5 | 195 | echo -e "\n** Log generated by 'Debian packaging tools' **\n\n">>$LOG_FILE |
philpem@5 | 196 | dpkg-buildpackage -rfakeroot>>$LOG_FILE 2>&1 |
philpem@5 | 197 | cd ../ |
philpem@5 | 198 | mv $DEB_DIR $DEST_DIR |
philpem@5 | 199 | |
philpem@5 | 200 | # Clean temporary files and directories |
philpem@5 | 201 | echo " - Clean temporary files and directories." |
philpem@5 | 202 | cd $DEST_DIR/.. |
philpem@5 | 203 | mv $ZIP_FILE $TAR_FILE.gz $DEB_FILE $BASE_DIR |
philpem@5 | 204 | |
philpem@5 | 205 | # End of build script |
philpem@5 | 206 | echo -e " - All done, you should look at the LOG file '$LOG_FILE'.\n" |