Mostly minor fixes up until version 0.8.10.
[irreco.git] / script / make-deb.sh
blob7d6273d14ec38fa7850e1932bb4579e7d6c18dab
1 #!/bin/bash
3 echo ""
4 echo "Deb related option disabled."
5 echo "Use deb-creator.sh to make .deb packages."
6 echo "Some scripts still use this script to do cleaning, so don't delete yet."
7 echo ""
9 cd `dirname "$0"`
10 source variables.sh
11 scratchbox_need
13 make_deb_main()
15 COMMAND="$1"
16 ARGS=("$@")
18 if [[ "$COMMAND" == "" ]]; then
19 make_deb_usage
20 echo "Error: You did not give me a command to run!"
21 exit 1
24 cd ..
26 case "$COMMAND" in
27 # --release|release|rel) make_deb_release "${ARGS[@]:2}";;
28 # --debug|debug|bug) make_deb_debug "${ARGS[@]:2}";;
29 # --developer|developer|dev) make_deb_dev "${ARGS[@]:2}";;
30 --clean|clean) make_deb_clean "${ARGS[@]:2}";;
31 *) echo "Error: Unknown command \"$COMMAND\"";
32 make_deb_usage;
33 exit 1;;
34 esac
37 make_deb_usage()
39 echo "Usage: $SCRIPT_NAME COMMAND"
40 echo ""
41 echo "Commands:"
42 # echo " --release | release | rel"
43 # echo " Create a release package of irreco."
44 # echo " --debug | debug | bug"
45 # echo " Create a debug package of irreco."
46 # echo " --developer | developer | dev"
47 # echo " Create a package for backend developers. This will"
48 # echo " install irreco and irreco-util pkg-config files, and"
49 # echo " irreco-api and irreco-util headers."
50 echo " --clean | clean"
51 echo " Delete few files."
52 echo ""
53 # echo "IRRECO_BACKENDS variable:"
54 # echo " IRRECO_BACKENDS variable can be used to select which backends"
55 # echo " will be compilend into the deb. For example: "
56 # echo ""
57 # echo " IRRECO_BACKENDS=\"dummy lirc\" ./make-deb.sh --debug"
58 # echo ""
59 # echo " would make a debug package with only dummy and lirc backends."
60 # echo ""
63 make_deb_release()
65 make_deb_clean
66 make_deb_print_title "RELEASE"
68 REGEX='AC_INIT\(\[irreco\], \[(.*)\]\)'
69 VERSION_CONFIGURE=$(egrep -o '^'"$REGEX"'$' ./irreco/configure.ac | sed -r "s|$REGEX|\1|")
70 check_exit_code "$?"
71 if [[ "$VERSION_CONFIGURE" == "" ]]; then
72 echo "Could not get version number."
73 exit 1
76 head ./ChangeLog -n 1 | grep "$VERSION_CONFIGURE" > /dev/null
77 check_exit_code "$?" "Version numbers dont match in ./ChangeLog and ./irreco/configure.ac"
79 head ./debian/changelog -n 1 | grep "$VERSION_CONFIGURE" > /dev/null
80 check_exit_code "$?" "Version numbers dont match in ./debian/changelog and ./irreco/configure.ac"
82 head ./debian/changelog -n 1 | egrep '\([0-9.]+-[0-9]+\)' > /dev/null
83 check_exit_code "$?" "Version number in ./debian/changelog must be in"\
84 "the form (__SRC_VERSION__-__DEB_VERSION__). For example (0.5.6-1)."
86 make_deb "irtrans lirc mythtv"
89 make_deb_debug()
91 make_deb_clean
92 make_deb_print_title "DEBUG"
93 export IRRECO_DEBUG=yes
94 make_deb "dummy irtrans lirc mythtv"
97 make_deb_dev()
99 make_deb_clean
100 make_deb_print_title "DEV"
101 export IRRECO_DEBUG=yes
102 export IRRECO_DEVELOPER=yes
103 make_deb "dummy"
107 # Make debian package.
109 make_deb()
111 "$SCRIPT_DIR"/irtrans.sh make
113 # Check backend list
114 if [[ "$IRRECO_BACKENDS" == "" ]]; then
115 export IRRECO_BACKENDS="$1"
117 echo "IRRECO_BACKENDS=$IRRECO_BACKENDS";
119 # Build package.
120 export IRTRANS_LIB_DIR="$IRTRANS_SHLIB_DIR"
121 save_exit_code dpkg-buildpackage -rfakeroot -B 2>&1 \
122 | tee "$DEB_LOG_FILE"
124 # Check output
125 get_exit_code
126 if [[ "$EXIT_CODE" != "0" ]]; then
127 make_deb_print_title "WARNINGS & ERRORS"
128 check_log "$DEB_LOG_FILE" "0"
130 exit "$EXIT_CODE"
133 make_deb_clean()
135 rm -f "$SCRIPT_TMP_DIR/irreco_sb_target"
136 make_deb_print_title "CLEAN"
137 "$SCRIPT_DIR"/irreco.sh clean
138 check_exit_code "$?"
139 "$SCRIPT_DIR"/backend.sh all clean
140 check_exit_code "$?"
141 rm -fv ./build-stamp
142 rm -fv ./configure-stamp
143 rm -fv ./irreco.pc
144 rm -rfv ./debian/irreco
147 make_deb_print_title()
149 print_title "MAKE DEB $1"
152 make_deb_main "$@"