Skip to content

Fix errors when building an RPM #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/mac_mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ jobs:
echo "---- test make install prefix=${prefix_path}"
make install prefix=${prefix_path}
test/tst_install.sh ${prefix_path}
prefix_path=pnetcdf_install
destdir_path=${GITHUB_WORKSPACE}/inst/
prefix_path="/pnetcdf_install"
destdir_path=${GITHUB_WORKSPACE}/inst
echo "---- test make install prefix=${prefix_path} DESTDIR=${destdir_path}"
make install prefix=${prefix_path} DESTDIR=${destdir_path}
test/tst_install.sh ${destdir_path}${prefix_path}
test/tst_install.sh ${prefix_path} ${destdir_path}
- name: Cleanup
if: ${{ always() }}
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/mac_openmpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ jobs:
echo "---- test make install prefix=${prefix_path}"
make install prefix=${prefix_path}
test/tst_install.sh ${prefix_path}
prefix_path=pnetcdf_install
destdir_path=${GITHUB_WORKSPACE}/inst/
prefix_path="/pnetcdf_install"
destdir_path=${GITHUB_WORKSPACE}/inst
echo "---- test make install prefix=${prefix_path} DESTDIR=${destdir_path}"
make install prefix=${prefix_path} DESTDIR=${destdir_path}
test/tst_install.sh ${destdir_path}${prefix_path}
test/tst_install.sh ${prefix_path} ${destdir_path}
- name: Cleanup
if: ${{ always() }}
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ubuntu_mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ jobs:
echo "---- test make install prefix=${prefix_path}"
make install prefix=${prefix_path}
test/tst_install.sh ${prefix_path}
prefix_path=pnetcdf_install
destdir_path=${GITHUB_WORKSPACE}/inst/
prefix_path="/pnetcdf_install"
destdir_path=${GITHUB_WORKSPACE}/inst
echo "---- test make install prefix=${prefix_path} DESTDIR=${destdir_path}"
make install prefix=${prefix_path} DESTDIR=${destdir_path}
test/tst_install.sh ${destdir_path}${prefix_path}
test/tst_install.sh ${prefix_path} ${destdir_path}
- name: Cleanup
if: ${{ always() }}
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ubuntu_openmpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ jobs:
echo "---- test make install prefix=${prefix_path}"
make install prefix=${prefix_path}
test/tst_install.sh ${prefix_path}
prefix_path=pnetcdf_install
destdir_path=${GITHUB_WORKSPACE}/inst/
prefix_path="/pnetcdf_install"
destdir_path=${GITHUB_WORKSPACE}/inst
echo "---- test make install prefix=${prefix_path} DESTDIR=${destdir_path}"
make install prefix=${prefix_path} DESTDIR=${destdir_path}
test/tst_install.sh ${destdir_path}${prefix_path}
test/tst_install.sh ${prefix_path} ${destdir_path}
- name: Cleanup
if: ${{ always() }}
run: |
Expand Down
28 changes: 16 additions & 12 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -69,44 +69,48 @@ check-local:
# work on platforms that have drive letters. On the other hand, it does better
# at avoiding recompilation issues, and works well even when some directory
# options were not specified in terms of '${prefix}' at configure time."
# Note command "make install prefix=/path/of/install DESTDIR=/path/to/dest"
# does not install the library. It copies all install files into folder
# "$DESTDIR/$prefix", so one can cd to $DESTDIR and pack the folder $prefix
# there into a tar ball.
install-data-hook:
@echo '+----------------------------------------------------------------------------+'
@echo '|'
@echo '| PnetCDF has been successfully installed under'
@echo '| $(DESTDIR)$(prefix)'
@echo '| $(prefix)'
@echo '|'
@echo '| * PnetCDF header files have been installed in'
@echo '| $(DESTDIR)$(prefix)/include'
@echo '| $(prefix)/include'
@echo '| * PnetCDF library files have been installed in'
@echo '| $(DESTDIR)$(exec_prefix)/lib'
@echo '| $(exec_prefix)/lib'
@echo '| * PnetCDF utility programs have been installed in'
@echo '| $(DESTDIR)$(exec_prefix)/bin'
@echo '| $(exec_prefix)/bin'
@echo '| * PnetCDF man pages have been installed in'
@echo '| $(DESTDIR)$(prefix)/share/man'
@echo '| $(prefix)/share/man'
@echo '|'
@echo '| To compile your PnetCDF programs, please add the following to the command'
@echo '| line, so the compiler can find the PnetCDF header files:'
@echo '| -I$(DESTDIR)$(prefix)/include'
@echo '| -I$(prefix)/include'
@echo '|'
@if test "x$(has_fortran)" = xyes -a 'x$(FC_MODINC)' != 'x-I' ; then \
echo '| Add the following line to compile your Fortran programs' ; \
echo '| $(FC_MODINC)$(DESTDIR)$(prefix)/include' ; \
echo '| $(FC_MODINC)$(prefix)/include' ; \
echo '|' ; \
fi
@echo '| Add the following line to link your program to PnetCDF library:'
@echo '| -L$(DESTDIR)$(exec_prefix)/lib -lpnetcdf'
@echo '| -L$(exec_prefix)/lib -lpnetcdf'
@echo '|'
@if test "x$(enable_shared)" = xyes ; then \
echo '| Add the following to your run-time environment variable LD_LIBRARY_PATH,' ; \
echo '| when linking your executable with the PnetCDF shared libraries.' ; \
if test "x$(enable_netcdf4)" = xyes -a "x$(enable_adios)" = xyes ; then \
echo '| $(DESTDIR)$(exec_prefix)/lib:$(netcdf4_libdir):$(adios_libdir)' ; \
echo '| $(exec_prefix)/lib:$(netcdf4_libdir):$(adios_libdir)' ; \
elif test "x$(enable_netcdf4)" = xyes ; then \
echo '| $(DESTDIR)$(exec_prefix)/lib:$(netcdf4_libdir)' ; \
echo '| $(exec_prefix)/lib:$(netcdf4_libdir)' ; \
elif test "x$(enable_adios)" = xyes ; then \
echo '| $(DESTDIR)$(exec_prefix)/lib:$(adios_libdir)' ; \
echo '| $(exec_prefix)/lib:$(adios_libdir)' ; \
else \
echo '| $(DESTDIR)$(exec_prefix)/lib' ; \
echo '| $(exec_prefix)/lib' ; \
fi ; \
echo '|' ; \
fi
Expand Down
6 changes: 3 additions & 3 deletions examples/C/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ check_PROGRAMS = collective_write \

if INSTALL_EXAMPLES
example_execbin_PROGRAMS = $(check_PROGRAMS)
example_execbindir = $(DESTDIR)$(exec_prefix)/pnetcdf_examples/C
example_execbindir = $(exec_prefix)/pnetcdf_examples/C
example_execbin_SCRIPTS = run_c_examples.sh
endif

Expand Down Expand Up @@ -106,7 +106,7 @@ tests-local: all $(check_PROGRAMS)

install-exec-hook:
@if test "x$(example_execbindir)" != x ; then \
cp -f $(srcdir)/cdl_header.txt $(DESTDIR)$(example_execbindir) ; \
$(SED_I) -e 's|check_PROGRAMS|$(check_PROGRAMS)|g ; s|TESTOUTDIR|$(TESTOUTDIR)|g ; s|TESTMPIRUN|$(TESTMPIRUN)|g ; s|SED_CMD|$(SED)|g ; s|ENABLE_BURST_BUFFER|$(ENABLE_BURST_BUFFER)|g ; s|ENABLE_NETCDF4|$(ENABLE_NETCDF4)|g' $(DESTDIR)$(example_execbindir)/run_c_examples.sh ; \
cp -f $(srcdir)/cdl_header.txt $(DESTDIR)/$(example_execbindir) ; \
$(SED_I) -e 's|check_PROGRAMS|$(check_PROGRAMS)|g ; s|TESTOUTDIR|$(TESTOUTDIR)|g ; s|TESTMPIRUN|$(TESTMPIRUN)|g ; s|SED_CMD|$(SED)|g ; s|ENABLE_BURST_BUFFER|$(ENABLE_BURST_BUFFER)|g ; s|ENABLE_NETCDF4|$(ENABLE_NETCDF4)|g' $(DESTDIR)/$(example_execbindir)/run_c_examples.sh ; \
fi

4 changes: 2 additions & 2 deletions examples/CXX/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ check_PROGRAMS = collective_write \

if INSTALL_EXAMPLES
example_execbin_PROGRAMS = $(check_PROGRAMS)
example_execbindir = $(DESTDIR)$(exec_prefix)/pnetcdf_examples/CXX
example_execbindir = $(exec_prefix)/pnetcdf_examples/CXX
example_execbin_SCRIPTS = run_cxx_examples.sh
endif

Expand Down Expand Up @@ -86,7 +86,7 @@ tests-local: all $(check_PROGRAMS)

install-exec-hook:
@if test "x$(example_execbindir)" != x ; then \
$(SED_I) -e 's|check_PROGRAMS|$(check_PROGRAMS)|g ; s|TESTOUTDIR|$(TESTOUTDIR)|g ; s|TESTMPIRUN|$(TESTMPIRUN)|g ; s|SED_CMD|$(SED)|g ; s|ENABLE_BURST_BUFFER|$(ENABLE_BURST_BUFFER)|g ; s|ENABLE_NETCDF4|$(ENABLE_NETCDF4)|g' $(DESTDIR)$(example_execbindir)/run_cxx_examples.sh ; \
$(SED_I) -e 's|check_PROGRAMS|$(check_PROGRAMS)|g ; s|TESTOUTDIR|$(TESTOUTDIR)|g ; s|TESTMPIRUN|$(TESTMPIRUN)|g ; s|SED_CMD|$(SED)|g ; s|ENABLE_BURST_BUFFER|$(ENABLE_BURST_BUFFER)|g ; s|ENABLE_NETCDF4|$(ENABLE_NETCDF4)|g' $(DESTDIR)/$(example_execbindir)/run_cxx_examples.sh ; \
fi

.PHONY: ptest ptests ptest2 ptest3 ptest4 ptest6 ptest8 ptest10
Expand Down
4 changes: 2 additions & 2 deletions examples/F77/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ check_PROGRAMS = nonblocking_write \

if INSTALL_EXAMPLES
example_execbin_PROGRAMS = $(check_PROGRAMS)
example_execbindir = $(DESTDIR)$(exec_prefix)/pnetcdf_examples/F77
example_execbindir = $(exec_prefix)/pnetcdf_examples/F77
example_execbin_SCRIPTS = run_f77_examples.sh
endif

Expand Down Expand Up @@ -111,7 +111,7 @@ tests-local: all $(check_PROGRAMS)

install-exec-hook:
@if test "x$(example_execbindir)" != x ; then \
$(SED_I) -e 's|check_PROGRAMS|$(check_PROGRAMS)|g ; s|TESTOUTDIR|$(TESTOUTDIR)|g ; s|TESTMPIRUN|$(TESTMPIRUN)|g ; s|SED_CMD|$(SED)|g ; s|ENABLE_BURST_BUFFER|$(ENABLE_BURST_BUFFER)|g ; s|ENABLE_NETCDF4|$(ENABLE_NETCDF4)|g' $(DESTDIR)$(example_execbindir)/run_f77_examples.sh ; \
$(SED_I) -e 's|check_PROGRAMS|$(check_PROGRAMS)|g ; s|TESTOUTDIR|$(TESTOUTDIR)|g ; s|TESTMPIRUN|$(TESTMPIRUN)|g ; s|SED_CMD|$(SED)|g ; s|ENABLE_BURST_BUFFER|$(ENABLE_BURST_BUFFER)|g ; s|ENABLE_NETCDF4|$(ENABLE_NETCDF4)|g' $(DESTDIR)/$(example_execbindir)/run_f77_examples.sh ; \
fi

.PHONY: ptest ptests ptest2 ptest3 ptest4 ptest6 ptest8 ptest10
Expand Down
4 changes: 2 additions & 2 deletions examples/F90/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ check_PROGRAMS = nonblocking_write \

if INSTALL_EXAMPLES
example_execbin_PROGRAMS = $(check_PROGRAMS)
example_execbindir = $(DESTDIR)$(exec_prefix)/pnetcdf_examples/F90
example_execbindir = $(exec_prefix)/pnetcdf_examples/F90
example_execbin_SCRIPTS = run_f90_examples.sh
endif

Expand Down Expand Up @@ -100,7 +100,7 @@ tests-local: all $(check_PROGRAMS)

install-exec-hook:
@if test "x$(example_execbindir)" != x ; then \
$(SED_I) -e 's|check_PROGRAMS|$(check_PROGRAMS)|g ; s|TESTOUTDIR|$(TESTOUTDIR)|g ; s|TESTMPIRUN|$(TESTMPIRUN)|g ; s|SED_CMD|$(SED)|g ; s|ENABLE_BURST_BUFFER|$(ENABLE_BURST_BUFFER)|g ; s|ENABLE_NETCDF4|$(ENABLE_NETCDF4)|g' $(DESTDIR)$(example_execbindir)/run_f90_examples.sh ; \
$(SED_I) -e 's|check_PROGRAMS|$(check_PROGRAMS)|g ; s|TESTOUTDIR|$(TESTOUTDIR)|g ; s|TESTMPIRUN|$(TESTMPIRUN)|g ; s|SED_CMD|$(SED)|g ; s|ENABLE_BURST_BUFFER|$(ENABLE_BURST_BUFFER)|g ; s|ENABLE_NETCDF4|$(ENABLE_NETCDF4)|g' $(DESTDIR)/$(example_execbindir)/run_f90_examples.sh ; \
fi

.PHONY: ptest ptests ptest2 ptest3 ptest4 ptest6 ptest8 ptest10
Expand Down
2 changes: 1 addition & 1 deletion src/packaging/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ pkgconfig_DATA = pnetcdf.pc
# GNU autoconf allows DESTDIR variable when running 'make install' which will
# prepend it before all installation names.
install-data-hook:
$(SED_I) -e 's|INSTALL_PREFIX|$(DESTDIR)$(prefix)|g ; s|INSTALL_EXEC_PREFIX|$(DESTDIR)$(exec_prefix)|g' $(DESTDIR)$(libdir)/pkgconfig/pnetcdf.pc
$(SED_I) -e 's|INSTALL_PREFIX|$(prefix)|g ; s|INSTALL_EXEC_PREFIX|$(exec_prefix)|g' $(DESTDIR)$(libdir)/pkgconfig/pnetcdf.pc


2 changes: 1 addition & 1 deletion src/utils/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ dist-hook:
# GNU autoconf allows DESTDIR variable when running 'make install' which will
# prepend it before all installation names.
install-exec-hook:
$(SED_I) -e 's|INSTALL_PREFIX|$(DESTDIR)$(prefix)|g ; s|INSTALL_EXEC_PREFIX|$(DESTDIR)$(exec_prefix)|g' $(DESTDIR)$(bindir)/pnetcdf-config
$(SED_I) -e 's|INSTALL_PREFIX|$(prefix)|g ; s|INSTALL_EXEC_PREFIX|$(exec_prefix)|g' $(DESTDIR)$(bindir)/pnetcdf-config
chmod +x $(DESTDIR)$(bindir)/pnetcdf-config

45 changes: 28 additions & 17 deletions test/tst_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,35 @@
# Exit immediately if a command exits with a non-zero status.
set -e

# This requires one command-line option, the installation path
# echo all commands (used for debugging)
# set -x

# This shell script requires one or two command-line options: prefx_path and
# optinal destdir_path
if [ "x$1" = x ] ; then
echo "Usage: $0 /pnetcdf/install/path"
echo "Usage: $0 prefx_path [destdir_path]"
exit 1
fi

installation_path=$1
# Note command "make install prefix=/path/of/install DESTDIR=/path/to/dest"
# does not install the library. It copies all install files into folder
# "$DESTDIR/$prefix", so one can cd to $DESTDIR and pack the folder $prefix
# there into a tar ball.

# check if folder installation_path exists
if [ ! -d $installation_path ]; then
echo "Error: folder $installation_path cannot be found"
exit 1
fi
prefx_path=$1
destdir_path=$2

# remove trailing '/' character
# Note on Mac OSX, realpath does not support option -s
# Ideally, -s should be used to avoid expanding a symlink
installation_path=$(realpath $installation_path)
prefx_path=$(echo "$prefx_path" | sed 's:/*$::')
if [ "x$destdir_path" != x ] ; then
destdir_path=$(echo "$destdir_path" | sed 's:/*$::')
fi

installation_path=$destdir_path$prefx_path

# echo "prefx_path=$prefx_path"
# echo "destdir_path=$destdir_path"
# echo "installation_path=$installation_path"

# check if pnetcdf_version exists in the install folder
if [ ! -x $installation_path/bin/pnetcdf_version ]; then
Expand All @@ -45,20 +56,20 @@ if [ ! -x $installation_path/bin/pnetcdf-config ]; then
else
# check if --prefix is correctly reflecting the install path
prefixdir=`$installation_path/bin/pnetcdf-config --prefix`
if [ $prefixdir != $installation_path ] ; then
echo "Error: expecting '$installation_path' from 'pnetcdf-config --prefix' but got $prefixdir"
if [ $prefixdir != $prefx_path ] ; then
echo "Error: expecting '$prefx_path' from 'pnetcdf-config --prefix' but got $prefixdir"
exit 1
fi
# check if --libdir is correctly reflecting the install path
libdir=`$installation_path/bin/pnetcdf-config --libdir`
if [ $libdir != $installation_path/lib ] ; then
echo "Error: expecting '$installation_path/lib' from 'pnetcdf-config --libdir' but got $libdir"
if [ $libdir != $prefx_path/lib ] ; then
echo "Error: expecting '$prefx_path/lib' from 'pnetcdf-config --libdir' but got $libdir"
exit 1
fi
# check if --includedir is correctly reflecting the install path
incdir=`$installation_path/bin/pnetcdf-config --includedir`
if [ $incdir != $installation_path/include ] ; then
echo "Error: expecting '$installation_path/include' from 'pnetcdf-config --includedir' but got $incdir"
if [ $incdir != $prefx_path/include ] ; then
echo "Error: expecting '$prefx_path/include' from 'pnetcdf-config --includedir' but got $incdir"
exit 1
fi
fi
Expand Down