Skip to content

Commit 1c86de6

Browse files
committed
windows/cygwin build script
1 parent fc3e7c4 commit 1c86de6

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

gempak_so/build_for_windows.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/bash
2+
# 1. Create a Java project and source folder....
3+
# 2. Configure build path (see M. Li's lecture note):
4+
# Right click the working project -> Build Path -> Configure build path
5+
# -> Libraries -> Add JARs -> com.sun.jna – jna.jar
6+
# 3. cp /usr/lib/gcc/i386-redhat-linux/3.4.6/libg2c.so locally, e.g.,
7+
# $AWIPS2/lib/so
8+
# 4. Use this script to create a shared library (.so)
9+
# 5. Deploy the SL and add the path, e.g., AWIPS2/lib, to LD_LIBRARY_PATH
10+
# (in ~/.alias)
11+
12+
. ../../gempak/Gemenviron.profile
13+
CC=gcc
14+
FC=gfortran
15+
echo "OS_INC = $OS_INC"
16+
echo "OS_LIB = $OS_LIB"
17+
echo "GEMPAK = $GEMPAK"
18+
echo "working in "`pwd`
19+
20+
21+
# check that libraries exist
22+
libs=(snlist sflist nxmlib gemlib gplt cgemlib rsl device xwp xw ps gn nsharp netcdf textlib)
23+
for file in ${libs[@]}
24+
do
25+
if [ ! -f $OS_LIB/lib$file.a ]; then
26+
echo "$OS_LIB/lib$file.a does not exist"
27+
if [ -f $OS_LIB/$file.a ]; then
28+
cp $OS_LIB/$file.a $OS_LIB/lib$file.a
29+
echo "copied OS_LIB/$file.a to OS_LIB/lib$file.a for linking"
30+
fi
31+
fi
32+
done
33+
34+
35+
myCflags="$CFLAGS -I. -I$GEMPAK/source/diaglib/dg -I$GEMPAK/source/gemlib/er \
36+
-I/opt/X11/include/X11 -I/usr/include/Xm -I/opt/local/include -I/usr/include/malloc -Wno-return-type -DUNDERSCORE -fPIC -DDEBUG -c"
37+
38+
myFflags="-I. -I$OS_INC -I$GEMPAK/include -fPIC -g -c -Wtabs -fno-second-underscore"
39+
40+
41+
myLinkflags="-L/usr/local/Cellar/gcc/4.9.2_1/lib/gcc/4.9/ -L/opt/local/lib -L/usr/X11R6/lib \
42+
-shared -Wno-return-type,-install_name,libgempak.dll -o libgdtest.dll"
43+
44+
myLinktail="-lgfortran -lpng -lc"
45+
46+
myLibs="-I$OS_INC -I$GEMPAK/include -I. \
47+
$OS_LIB/ginitp_alt.o \
48+
$OS_LIB/gendp_alt.o \
49+
$OS_LIB/libsflist.a \
50+
$OS_LIB/gdlist.a \
51+
$OS_LIB/libgemlib.a \
52+
$OS_LIB/libcgemlib.a \
53+
$OS_LIB/libgplt.a \
54+
$OS_LIB/libdevice.a \
55+
$OS_LIB/libgn.a \
56+
$OS_LIB/libcgemlib.a \
57+
$OS_LIB/libgemlib.a \
58+
$OS_LIB/libtextlib.a \
59+
$OS_LIB/libxslt.a \
60+
$OS_LIB/libxml2.a \
61+
-liconv \
62+
$OS_LIB/libz.a \
63+
$OS_LIB/librsl.a \
64+
$OS_LIB/libgemlib.a \
65+
$OS_LIB/libbz2.a"
66+
67+
echo ""
68+
echo "$CC $myCflags *.c"
69+
echo ""
70+
echo "$FC $myFflags *.f"
71+
echo ""
72+
echo "$CC $myLinkflags *.o $myLibs $myLinktail"
73+
74+
pwd
75+
76+
$CC $myCflags *.c
77+
$FC $myFflags *.f
78+
$CC $myLinkflags *.o $myLibs $myLinktail
79+
80+
exit

0 commit comments

Comments
 (0)