-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
166 lines (157 loc) · 5.12 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
NAME=htmlview
TARGET=src/$NAME.dll
SRC="src/$NAME.c"
OBJS="src/$NAME.o src/version.o src/sylplugin_factory.o"
PKG=sylpheed-$NAME
LIBSYLPH=./lib/libsylph-0-1.a
LIBSYLPHEED=./lib/libsylpheed-plugin-0-1.a
LIBSYLFILTER=./lib/libsylfilter.a
#LIBS=" -lglib-2.0-0 -lintl"
LIBS=" `pkg-config --libs glib-2.0 gobject-2.0 gtk+-2.0 gthread-2.0 libgtkhtml-3.14`"
INC=" -I. -I../../ -I../../libsylph -I../../src -I../sylplugin_factory/src -I/mingw/local `pkg-config --cflags glib-2.0 cairo gdk-2.0 gtk+-2.0 gthread-2.0 libgtkhtml-3.14`"
DEF=" -DHAVE_CONFIG_H -DUNICODE -D_UNICODE -DRELEASE_3_1"
DEBUG=0
MAJOR=0
MINOR=1
SUBMINOR=0
DCOMPILE=src/.compile
PBUILDH=src/private_build.h
function compile ()
{
if [ ! -f "$PBUILDH" ]; then
echo "1" > $DCOMPILE
echo "#define PRIVATE_BUILD 1" > $PBUILDH
else
ret=`cat $DCOMPILE | gawk '{print $i+1}'`
echo $ret | tee $DCOMPILE
echo "#define PRIVATE_BUILD \"build $ret\\0\"" > $PBUILDH
echo "#define NAME \"SylNotify\\0\"" >> $PBUILDH
echo "#define VERSION \"$MAJOR, $MINOR, $SUBMINOR, 0\\0\"" >> $PBUILDH
echo "#define NAMEVERSION \"SylNotify $MAJOR.$MINOR.$SUBMINOR\\0\"" >> $PBUILDH
echo "#define QVERSION \"$MAJOR,$MINOR,$SUBMINOR,0\"" >> $PBUILDH
fi
com="windres -i res/version.rc -o src/version.o"
echo $com
eval $com
for f in $SRC; do
BASENAME=`basename $f .c`
com="gcc -Wall -c -o src/$BASENAME.o $DEF $INC $f"
echo $com
eval $com
if [ $? != 0 ]; then
echo "compile error"
exit
fi
done
com="gcc -shared -o $TARGET $OBJS -L./lib $LIBSYLPH $LIBSYLPHEED $LIBS -lws2_32 -liconv"
echo $com
eval $com
if [ $? != 0 ]; then
echo "done"
else
if [ -d "$SYLPLUGINDIR" ]; then
com="cp $TARGET \"$SYLPLUGINDIR/$NAME.dll\""
echo $com
eval $com
else
:
fi
fi
}
if [ -z "$1" ]; then
compile
else
while [ $# -ne 0 ]; do
case "$1" in
-debug|--debug)
DEF=" -ggdb $DEF -DDEBUG"
shift
;;
pot)
mkdir -p po
com="xgettext $NAME.h $NAME.c -k_ -kN_ -o po/$NAME.pot"
echo $com
eval $com
shift
;;
po)
com="msgmerge po/ja.po po/$NAME.pot -o po/ja.po"
echo $com
eval $com
shift
;;
mo)
com="msgfmt po/ja.po -o po/$NAME.mo"
echo $com
eval $com
if [ -d "$SYLLOCALEDIR" ]; then
com="cp po/$NAME.mo \"$SYLLOCALEDIR/$NAME.mo\""
echo $com
eval $com
fi
exit
;;
res)
com="windres -i version.rc -o version.o"
echo $com
eval $com
shift
;;
-r|release)
shift
if [ ! -z "$1" ]; then
r=$1
shift
zip sylpheed-$NAME-$r.zip $NAME.dll
#zip -r sylpheed-$NAME-$r.zip README
zip -r sylpheed-$NAME-$r.zip README.md
zip -r sylpheed-$NAME-$r.zip src/$NAME.[ch]
zip -r sylpheed-$NAME-$r.zip res/version.rc
zip -r sylpheed-$NAME-$r.zip NEWS
#zip -r sylpheed-$NAME-$r.zip po/$NAME.mo
#zip -r sylpheed-$NAME-$r.zip *.xpm
sha1sum sylpheed-$NAME-$r.zip > sylpheed-$NAME-$r.zip.sha1sum
fi
;;
-c|-compile)
shift
if [ ! -z "$1" ]; then
if [ "$1" = "stable" ]; then
DEF="$DEF -DSTABLE_RELEASE";
shift
fi
fi
compile
;;
def)
shift
PKG=libsylph-0-1
com="(cd lib;pexports $PKG.dll > $PKG.dll.def)"
echo $com
eval $com
com="(cd lib;dlltool --dllname $PKG.dll --input-def $PKG.dll.def --output-lib $PKG.a)"
echo $com
eval $com
PKG=libsylpheed-plugin-0-1
com="(cd lib;pexports $PKG.dll > $PKG.dll.def)"
echo $com
eval $com
com="(cd lib;dlltool --dllname $PKG.dll --input-def $PKG.dll.def --output-lib $PKG.a)"
echo $com
eval $com
exit
;;
clean)
rm -f *.o *.lo *.la *.bak *~
shift
;;
cleanall|distclean)
rm -f *.o *.lo *.la *.bak *.dll *.zip
shift
;;
*)
shift
;;
esac
done
fi