root/lang/c/libintl-msvc/step1.sh @ 25300

Revision 25300, 3.3 kB (checked in by saturday06, 5 years ago)

comit!

Line 
1
2CFLAGS=" -O3 -DNDEBUG -U_DEBUG "
3CFLAGS_UNICODE=" -DUNICODE -D_UNICODE "
4CFLAGS_MSVC=" $CFLAGS -mno-stack-arg-probe -D__USE_MINGW_ANSI_STDIO=0 "
5#CFLAGS_MSVC=" $CFLAGS -mno-stack-arg-probe -D__USE_MINGW_ANSI_STDIO=0 -fno-gnu-linker __MINGW_IMPORT=extern "
6
7# skip LC_MESSAGES
8skip_LC_MESSAGES=no
9
10# POSIX/XSI format strings
11use_POSIX_XSI_format_strings=yes
12
13# ---------------------
14# setup dummy libiconv
15# ---------------------
16rm -fr win_iconv
17mkdir -p win_iconv/include
18mkdir -p win_iconv/lib
19cp iconv.h win_iconv/include/
20gcc $CFLAGS $CFLAGS_UNICODE -c win_iconv.c -o win_iconv.o
21ar rv win_iconv/lib/libiconv.a win_iconv.o
22
23rm -fr win_iconv-win9x
24mkdir -p win_iconv-win9x/include
25mkdir -p win_iconv-win9x/lib
26cp iconv.h win_iconv-win9x/include/
27gcc $CFLAGS -c win_iconv.c -o win_iconv-win9x.o
28ar rv win_iconv-win9x/lib/libiconv.a win_iconv-win9x.o
29
30# ---------------------
31# compile libintl
32# ---------------------
33cd recipes/libintl
34rm -rf intl
35autoreconf -i
36cp ../loadmsgcat-windows.h ../bindtextdom-windows.h intl/
37
38patch --batch --forward -p0 < ../intl.patch
39if [ "$skip_LC_MESSAGES" = "yes" ]; then
40  patch --batch --forward -p0 < ../skip-LC_MESSAGES.patch
41fi
42
43objlist="\
44  bindtextdom.o dcgettext.o dgettext.o gettext.o finddomain.o hash-string.o \
45  loadmsgcat.o localealias.o textdomain.o l10nflist.o explodename.o dcigettext.o \
46  dcngettext.o dngettext.o ngettext.o plural.o plural-exp.o localcharset.o lock.o \
47  relocatable.o langprefs.o localename.o version.o tsearch.o log.o \
48"
49#intl-compat.o
50
51if [ "$use_POSIX_XSI_format_strings" = "yes" ]; then
52  objlist="$objlist printf.o"
53fi
54
55# ---------------------
56# msvc(Win9x)
57# ---------------------
58CFLAGS="$CFLAGS_MSVC" ./configure \
59  --with-libiconv-prefix=`pwd`/../../win_iconv-win9x \
60  --with-included-gettext \
61  --enable-threads=win32 &&
62  cd intl && make clean && make && gcc $CFLAGS_MSVC -c tsearch.c -I.. && cd ..
63
64strip -gx intl/*.o
65mkdir -p ../msvc-win9x-obj
66for obj in $objlist
67do
68  cp -f intl/$obj ../msvc-win9x-obj/${obj}bj
69done
70
71# ---------------------
72# msvc
73# ---------------------
74CFLAGS="$CFLAGS_MSVC $CFLAGS_UNICODE" ./configure \
75  --with-libiconv-prefix=`pwd`/../../win_iconv \
76  --with-included-gettext \
77  --enable-threads=win32 &&
78  cd intl && make clean && make && gcc $CFLAGS_MSVC $CFLAGS_UNICODE -c tsearch.c -I.. && cd ..
79
80strip -gx intl/*.o
81mkdir -p ../msvc-obj
82for obj in $objlist
83do
84  cp -f intl/$obj ../msvc-obj/${obj}bj
85done
86
87# ---------------------
88# mingw(Win9x)
89# ---------------------
90CFLAGS="$CFLAGS" ./configure \
91  --with-libiconv-prefix=`pwd`/../../win_iconv-win9x \
92  --with-included-gettext \
93  --enable-threads=win32 &&
94  cd intl && make clean && make && cp -f libintl.a ../../../libintl-win9x.a && cd ..
95
96# ---------------------
97# mingw
98# ---------------------
99CFLAGS="$CFLAGS $CFLAGS_UNICODE" ./configure \
100  --with-libiconv-prefix=`pwd`/../../win_iconv \
101  --with-included-gettext \
102  --enable-threads=win32 &&
103  cd intl && make clean && make && cp -f libintl.a ../../../libintl.a && cd ..
104
105# ---------------------
106# compile test
107# ---------------------
108cd ../../samples
109rm -f mingw-sample-win9x.exe mingw-sample.exe
110g++ $CFLAGS -o mingw-sample-win9x.exe sample.cpp ../win_iconv-win9x.o ../libintl-win9x.a -luser32 -lshlwapi
111g++ $CFLAGS $CFLAGS_UNICODE -o mingw-sample.exe sample.cpp ../win_iconv.o ../libintl.a -luser32 -lshlwapi
112./mingw-sample-win9x > hello-win9x.txt
113./mingw-sample > hello.txt
114cd ..
115
Note: See TracBrowser for help on using the browser.