Cleanup comments etc. in src
[gimp-lqr-plugin.git] / makedist
blob2ba3e1afa313517289bc05a9e8620a0cdca56722
1 #! /bin/bash
3 # Functions
4 #{{{
5 function usage() {
6 cat << EOF
7 Usage: $(basename $0) [ options ] [ <languages list> ]
9 Create bzip2 tarball for distribution, optionally updates po files before.
11 Options:
12 --all-po update all languages
13 -f, --force force overwriting existing files
14 -h, --help this help
15 EOF
18 function err_mess() {
19 echo "$(basename $0): error: $1" > /dev/stderr;
21 #}}}
23 # Init costants & parameters
24 #{{{
25 NOPO=1
26 ALL=0
27 FORCE=0
28 #}}}
30 # Parse command line
31 #{{{
32 PARAMETERS=$(getopt -a -o "hf" -l "help, all-po, force" -- "$@")
34 [ $? -ne 0 ] && { usage; exit 1; }
36 eval set -- "$PARAMETERS"
38 while true
40 case "$1" in
41 --force)
42 FORCE=1
43 shift
45 --all)
46 NOPO=0
47 ALL=1
48 shift;
50 --)
51 shift;
52 break;
54 -h|--help)
55 usage;
56 exit 0;
59 usage;
60 exit 1;
62 esac
63 done
65 if [ -n "$1" ]
66 then
67 [ $ALL -eq 1 ] && { err_mess "use either --all or specify languages"; exit 1; }
68 ALL=0
69 NOPO=0
70 LANGS="$@"
72 #}}}
74 # Complete (and check) parameter initialization
75 #{{{
76 [ -f "Makefile" ] || { echo "error: makefile not found"; exit 1; }
77 [ -f "configure.ac" ] || { echo "error: configure.ac not found"; exit 1; }
79 NAME=$(head -n 50 configure.ac | grep "m4_define(\[plugin_name\], \[.*\])" | sed "s/m4_define(\[plugin_name\], \[\(.*\)\])/\1/")
80 MAJOR_VER=$(head -n 50 configure.ac | grep "m4_define(\[plugin_major_version\], \[.*\])" | sed "s/m4_define(\[plugin_major_version\], \[\(.*\)\])/\1/")
81 MINOR_VER=$(head -n 50 configure.ac | grep "m4_define(\[plugin_minor_version\], \[.*\])" | sed "s/m4_define(\[plugin_minor_version\], \[\(.*\)\])/\1/")
82 MICRO_VER=$(head -n 50 configure.ac | grep "m4_define(\[plugin_micro_version\], \[.*\])" | sed "s/m4_define(\[plugin_micro_version\], \[\(.*\)\])/\1/")
84 #[ -f "release_subv_src" ] || { echo "error: release_subv_src not found"; exit 1; }
86 #REL_SUB_VER="$(cat release_subv_src)";
87 #echo "$REL_SUB_VER" | grep -q "[[:digit:]]\+" || { echo "error: invalid release subversion: $REL_SUB_VER"; exit 1;}
88 #REL_SUB_VER=$[ $REL_SUB_VER + 1 ] || exit 1;
90 PLUGIN_NAME="${NAME}-${MAJOR_VER}.${MINOR_VER}.${MICRO_VER}"
91 #NEW_PLUGIN_NAME="${PLUGIN_NAME}-${REL_SUB_VER}"
92 #TGZ_NAME="${PLUGIN_NAME}.tar.gz"
93 TBZ2_NAME="${PLUGIN_NAME}.tar.bz2"
95 #NEW_TBZ2_NAME="${NEW_PLUGIN_NAME}.tar.bz2"
97 [ $FORCE -eq 0 ] && [ -f "$TBZ2_NAME" ] && { err_mess "file exists, use --force to force writing"; exit 1; }
99 #}}}
101 # Main
102 #{{{
104 if [ "${NOPO}" -eq 0 ]
105 then
106 if [ "${ALL}" -eq 1 ]
107 then
108 intltool-update-all || exit 1
109 else
110 cd po || exit 1
111 for LL in $LANGS
113 intltool-update $LL || exit 1
114 done
115 cd .. || exit 1
119 make dist-bzip2 || exit 1
121 #mv "${TBZ2_NAME}" "${NEW_TBZ2_NAME}" || exit 1
123 #echo $REL_SUB_VER > release_subv_src;
124 #}}}