Skip to content

Commit fc3e7c4

Browse files
committed
osx and el7 NSHARP library build scripts
1 parent 1bd4a7c commit fc3e7c4

File tree

2 files changed

+68
-34
lines changed

2 files changed

+68
-34
lines changed

nsharp/build_el7.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
#
3+
# Dec 15, 2015 mjames@ucar Created
4+
# Sep 13, 2016 mjames@ucar Updated for 16.2.2 using awips2-ncep/viz/gov.noaa.nws.ncep.ui.nsharp
5+
# Sep 15, 2016 mjames@ucar CentOS 7 build
6+
#
7+
# awips2-ncep/viz/gov.noaa.nws.ncep.ui.nsharp
8+
# awips2-ncep/viz/gov.noaa.nws.ncep.ui.nsharp.linux64
9+
10+
. ~/GEMPAK7/Gemenviron.profile
11+
export NSHARP=$GEMPAK/source/programs/gui/nsharp
12+
export NWX=$GEMPAK/source/programs/gui/nwx
13+
14+
CC=gcc
15+
FC=gfortran
16+
17+
# check that libraries exist
18+
cp $OS_LIB/Nxmlib.a $OS_LIB/nxmlib.a
19+
libs=(snlist sflist nxmlib gemlib gplt cgemlib rsl device xwp xw ps gn nsharp netcdf textlib)
20+
for file in ${libs[@]}
21+
do
22+
if [ -f $OS_LIB/$file.a ]; then
23+
cp $OS_LIB/$file.a $OS_LIB/lib$file.a
24+
echo "copied OS_LIB/$file.a to OS_LIB/lib$file.a for linking"
25+
fi
26+
done
27+
28+
# Set C flags. Include necessary *.h files from application and library functions, e.g., diaglib/dg/*.h
29+
# gdlist/gdlist.h for gdldsp.c. Note that diaglib/dg/*.h has layers of *.h, de.h, dl.h, df.h, dv.h.
30+
31+
myLibs="$OS_LIB/ginitp_alt.o $OS_LIB/gendp_alt.o"
32+
33+
myCflags="$CFLAGS -I. -I./Sndglib -I$NSHARP -I$GEMPAK/include -I$OS_INC -I$NWX \
34+
-I/usr/include/X11 -I/usr/include/Xm -DUNDERSCORE -fPIC -DDEBUG -c"
35+
36+
myFflags="-I. -I$OS_INC -I$GEMPAK/include -I$NSHARP -fPIC -g -c -Wall -fno-second-underscore"
37+
38+
myLinkflags="-L/usr/lib/gcc/x86_64-redhat-linux/4.8.2/ -L$OS_LIB -L. -L./Sndglib -L/usr/X11R6/lib \
39+
-shared -Wl,-soname,libbignsharp.so -o libbignsharp.so"
40+
41+
myLibsInc="$OS_LIB/ginitp_alt.o $OS_LIB/gendp_alt.o $OS_LIB/libnxmlib.a $OS_LIB/libsnlist.a \
42+
$OS_LIB/libsflist.a $OS_LIB/libgemlib.a $OS_LIB/libcgemlib.a $OS_LIB/libgplt.a $OS_LIB/libdevice.a \
43+
$OS_LIB/libxwp.a $OS_LIB/libxw.a $OS_LIB/libps.a $OS_LIB/libgn.a $OS_LIB/libcgemlib.a $OS_LIB/libgemlib.a \
44+
$OS_LIB/libtextlib.a $OS_LIB/libxslt.a \
45+
$OS_LIB/libgemlib.a $OS_LIB/libcgemlib.a $OS_LIB/librsl.a $OS_LIB/libbz2.a"
46+
47+
myLinktail="-I$OS_INC \
48+
-I$GEMPAK/include -I$NWX -I$NSHARP -I. -I./Sndglib -I/usr/include/X11 -I/usr/include -I/usr/include/Xm -lhdf5 -lgfortran -lc -lXt -lX11 -lz -lm -lXm"
49+
50+
$CC $myCflags *.c Sndglib/*.c
51+
$FC $myFflags *.f
52+
$CC $myLinkflags *.o $myLibsInc $myLinktail
53+
54+
echo ""
55+
echo "$CC $myCflags *.c Sndglib/*.c"
56+
echo ""
57+
echo "$FC $myFflags *.f"
58+
echo ""
59+
echo "$CC $myLinkflags *.o $myLibsInc $myLinktail"
60+
61+
# cp libbignsharp.so ~/awips2-ncep/viz/gov.noaa.nws.ncep.ui.nsharp.linux64/
62+
exit
Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
#!/bin/bash
22
#
33
# Dec 15, 2015 mjames@ucar Created
4-
# Sep 13, 2016 mjames@ucar Updated for 16.2.2 using awips2-ncep/viz/gov.noaa.nws.ncep.ui.nsharp
4+
# Sep 13, 2016 mjames@ucar Updated for 16.2.2
55
#
6-
# 1. Create a Java project and source folder....
7-
#
8-
# 2. Configure build path (see M. Li's lecture note):
9-
# Right click the working project -> Build Path -> Configure build path
10-
# -> Libraries -> Add JARs -> com.sun.jna – jna.jar
11-
#
12-
# 3. cp /usr/lib/gcc/i386-redhat-linux/3.4.6/libg2c.so locally, e.g.,
13-
# $AWIPS2/tools/lib and make myLinkFlags to contain -L$AWIPS2/tools/lib
14-
#
15-
# 4. Use this script to create a shared library (.so)
16-
#
17-
# 5. Deploy the SL and add the path, e.g., AWIPS2/lib, to LD_LIBRARY_PATH
18-
# (in ~/.alias)
6+
# awips2-ncep/viz/gov.noaa.nws.ncep.ui.nsharp
7+
# awips2-ncep/viz/gov.noaa.nws.ncep.ui.nsharp.macosx
198
#
209
. ~/gempak/Gemenviron.profile
2110
export NSHARP=$GEMPAK/source/programs/gui/nsharp
@@ -28,8 +17,6 @@ echo "OS_INC = $OS_INC"
2817
echo "OS_LIB = $OS_LIB"
2918
echo "GEMPAK = $GEMPAK"
3019
echo "NWX = $NWX"
31-
cd /Users/mj/awips2-gemlibs/nsharp
32-
echo "working in "`pwd`
3320

3421
# check that libraries exist
3522
libs=(snlist sflist nxmlib gemlib gplt cgemlib rsl device xwp xw ps gn nsharp netcdf textlib)
@@ -44,20 +31,8 @@ do
4431
fi
4532
done
4633

47-
#rm -rf *.o glibnsharp.so Sndglib/*.o
48-
49-
# -L/usr/local/Cellar/gcc/4.9.2_1/lib/gcc/4.9/ is for -lgfortran
50-
51-
#myLinktail=" \
52-
#$OS_LIB/ginitp_alt.o $OS_LIB/gendp_alt.o -lnxmlib \
53-
#-lsndg -lsnlist -lsflist -lgemlib -lgplt -lcgemlib -ldevice -lxwp -lxw -lps -lgn -lnsharp -lgemlib -lrsl -lnetcdf \
54-
#-ltextlib -lxml2 -lxslt -liconv -lbz2 -lhdf5 -lgfortran -ljasper -lpng -liconv -lc -lXt -lX11 -lz -lm"
55-
56-
#
5734
# Set C flags. Include necessary *.h files from application and library functions, e.g., diaglib/dg/*.h
5835
# gdlist/gdlist.h for gdldsp.c. Note that diaglib/dg/*.h has layers of *.h, de.h, dl.h, df.h, dv.h.
59-
#
60-
# We need to compile here, not link.
6136

6237
myLibs="$OS_LIB/ginitp_alt.o $OS_LIB/gendp_alt.o"
6338

@@ -70,29 +45,26 @@ myFflags="-I. -I$OS_INC -I$GEMPAK/include -I$NSHARP -fPIC -g -c -fno-second-unde
7045
myLinkflags="-L/usr/local/Cellar/gcc/4.9.2_1/lib/gcc/4.9/ -L/opt/local/lib -L$OS_LIB -L. -L./Sndglib -L/usr/X11R6/lib \
7146
-shared -Wl -Wcomment -Wincompatible-pointer-types -Wimplicit-function-declaration -Wno-return-type,-install_name,libbignsharp.dylib -o libbignsharp.dylib"
7247

73-
# INCLUDE
7448
myLibsInc="$OS_LIB/ginitp_alt.o $OS_LIB/gendp_alt.o $OS_LIB/libnxmlib.a $OS_LIB/libsnlist.a \
7549
$OS_LIB/libsflist.a $OS_LIB/libgemlib.a $OS_LIB/libcgemlib.a $OS_LIB/libgplt.a $OS_LIB/libdevice.a \
7650
$OS_LIB/libxwp.a $OS_LIB/libxw.a $OS_LIB/libps.a $OS_LIB/libgn.a $OS_LIB/libcgemlib.a $OS_LIB/libgemlib.a \
7751
$OS_LIB/libnetcdf.a $OS_LIB/libtextlib.a $OS_LIB/libxml2.a $OS_LIB/libxslt.a \
7852
$OS_LIB/libgemlib.a $OS_LIB/libcgemlib.a $OS_LIB/librsl.a $OS_LIB/libbz2.a"
7953

80-
# TAIL
8154
myLinktail="-I$OS_INC \
8255
-I$GEMPAK/include -I$NWX -I$NSHARP -I. -I./Sndglib -I/opt/X11/include/X11 -I/usr/include -I/usr/include/Xm -I/opt/local/include/ -I/opt/local/include -lhdf5 -lgfortran -ljasper -lpng -liconv -lc -lXt -lX11 -lz -lm -lXm"
83-
## RUN
56+
8457
$CC $myCflags *.c Sndglib/*.c
8558
$FC $myFflags *.f
8659
$CC $myLinkflags *.o $myLibsInc $myLinktail
8760

88-
8961
echo ""
9062
echo "$CC $myCflags *.c Sndglib/*.c"
9163
echo ""
9264
echo "$FC $myFflags *.f"
9365
echo ""
9466
echo "$CC $myLinkflags *.o $myLibsInc $myLinktail"
95-
pwd
96-
cp libbignsharp.dylib ~/awips2-ncep/viz/gov.noaa.nws.ncep.ui.nsharp.macosx/
67+
68+
#cp libbignsharp.dylib ~/awips2-ncep/viz/gov.noaa.nws.ncep.ui.nsharp.macosx/
9769

9870
exit

0 commit comments

Comments
 (0)