Merge branch 'master' of ssh://pege77@mercury.wipsl.com/var/git/irreco
[irreco.git] / script / irtrans.sh
blobfdc84756de85735fbd64931fbed9463e446eccc1
1 #!/bin/bash
2 cd `dirname "$0"`
3 source variables.sh
4 scratchbox_need
6 irtrans_main()
8 COMMAND="$1"
10 if [[ "$COMMAND" == "" ]]; then
11 echo "Error: You did not give me a command to run!"
12 irtrans_usage
13 exit 1
16 find_irtrans_dir
17 cd "$IRTRANS_DIR"
18 check_exit_code "$?"
20 ARGS=("$@")
21 case "$COMMAND" in
22 --untar|untar) irtrans_untar "${ARGS[@]:1}";;
23 --make|make) irtrans_make "${ARGS[@]:1}";;
24 --install|install|inst) irtrans_install "${ARGS[@]:1}";;
25 --clean|clean) irtrans_clean "${ARGS[@]:1}";;
26 --test|test) irtrans_test "${ARGS[@]:1}";;
27 *) echo "Error: Unknown command \"$COMMAND\"";
28 irtrans_usage;
29 exit 1;;
30 esac
33 irtrans_usage()
35 echo "Usage: $SCRIPT_NAME COMMAND"
36 echo ""
37 echo "Commands:"
38 echo " --untar | untar"
39 echo " Untar irtrans package"
40 echo " Create untar for irserver-src.tar.gz and IRTransDLL_N800.tar.gz"
41 echo " Use this when you are compiling irtrans first time "
42 echo ""
43 echo " --make | make"
44 echo " Run make for irtrans"
45 echo ""
46 echo " --install | install | inst"
47 echo " Run make for irtrans if needed"
48 echo " copy libIRTrans.so to $INSTALL_DIR/lib"
49 echo " copy irserver to $INSTALL_DIR/bin"
50 echo " Run autogen.sh for irreco-backend-irtrans if needed"
51 echo " Run configure.sh for irreco-backend-irtrans if needed"
52 echo " Run make for irreco-backend-irtrans"
53 echo " Run make install for irreco-backend-irtrans"
54 echo ""
55 echo " --clean|clean"
56 echo " Run \"make clean\" for irtrans"
57 echo " Run \"make clean\" and autoclean.sh for irreco-backend-irtrans"
58 echo ""
61 irtrans_test()
63 echo $IRTRANS_SHLIB_DIR
64 echo $SCRIPT_TMP_DIR
65 echo $IRTRANS_DIR
67 irtrans_untar()
69 rm "$SCRIPT_TMP_DIR/irtrans_sb_target"
70 if [ -d "$IRTRANS_DIR" ]; then
71 if [ ! -d "$IRTRANS_SHLIB_DIR" ] \
72 || [ ! -d "$IRTRANS_IRSERVER_DIR" ] \
73 || [[ "$1" == '--force' ]] \
74 || [[ "$1" == 'force' ]]; then
75 irtrans_print_title "UNTAR"
76 cd "$IRTRANS_DIR"
77 check_exit_code "$?"
78 ./untar-irtrans.sh
79 check_exit_code "$?"
80 cd "$OLDPWD"
81 check_exit_code "$?"
86 irtrans_make()
88 match_sb_target "$SCRIPT_TMP_DIR/irtrans_sb_target"
89 if [[ "$?" != "0" ]]; then
90 irtrans_print_title "MAKE"
92 cd "$IRTRANS_DIR"
93 check_exit_code "$?"
95 make clean
96 check_exit_code "$?"
98 #make $@
99 make irtrans_noccf
100 check_exit_code "$?"
102 make install_sdk
103 check_exit_code "$?"
105 cd "$OLDPWD"
106 check_exit_code "$?"
110 irtrans_backend_conf()
112 create_install_dir
114 if [ -e './autogen.sh' ]; then
115 irtrans_print_title "BACKEND AUTOGEN"
116 ./autogen.sh
117 check_exit_code "$?"
120 irtrans_print_title "BACKEND CONFIGURE"
122 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$INSTALL_DIR/lib/pkgconfig ./configure \
123 --with-irtrans=$IRTRANS_DIR/irtransdll --prefix=$INSTALL_DIR --enable-debug=yes "$@"
124 check_exit_code "$?"
127 irtrans_install()
129 if [ ! -e "$IRTRANS_SHLIB_DIR/libIRTrans.so" ] || \
130 [ ! -e "$IRTRANS_IRSERVER_DIR/irserver" ]; then
131 irtrans_make
133 cp -v "$IRTRANS_SHLIB_DIR/libIRTrans.so" "$INSTALL_DIR/lib"
134 cp -v "$IRTRANS_IRSERVER_DIR/irserver" "$INSTALL_DIR/bin"
136 cd "$BACKEND_DIR/irtrans"
137 check_exit_code "$?"
139 if [ ! -e "Makefile" ]; then
140 irtrans_backend_conf
143 irtrans_print_title "BACKEND MAKE"
144 generic_make
145 irtrans_print_title "BACKEND MAKE INSTALL"
146 make install
147 cd "$OLDPWD"
150 irtrans_clean()
152 irtrans_print_title "CLEAN"
153 rm "$SCRIPT_TMP_DIR/irtrans_sb_target"
154 cd "$IRTRANS_DIR"
155 make clean
156 cd "$OLDPWD"
158 irtrans_print_title "BACKEND CLEAN"
159 cd "$BACKEND_DIR/irtrans"
160 make clean
161 ./autoclean.sh
162 cd "$OLDPWD"
165 irtrans_print_title()
167 print_title "IRTRANS $1"
170 irtrans_main "$@"