Commit 39a4656a9324422481517a6c7b38fd4dbdb3a81b

Authored by Jürgen Knödlseder
1 parent 9e8efd35

Make 'make distcheck' work

.gitignore
... ... @@ -10,6 +10,10 @@ inst/cta/test/*.fits
10 10 inst/cta/test/*.fits.gz
11 11 inst/cta/test/dev/*.fits
12 12 inst/spi/test/data/*.xml
  13 +inst/com/test/*.trs
  14 +inst/cta/test/*.trs
  15 +inst/lat/test/*.trs
  16 +inst/mwl/test/*.trs
13 17  
14 18 # Generated files
15 19 pyext/gammalib/*.py
... ... @@ -94,10 +98,10 @@ test/test_GVector
94 98 test/test_GXml
95 99 test/test_GXspec
96 100 test/test_GVO
97   -test/test_LAT
98   -test/test_MWL
99   -test/test_CTA
100   -test/test_COM
  101 +inst/lat/test/test_LAT
  102 +inst/mwl/test/test_MWL
  103 +inst/cta/test/test_CTA
  104 +inst/com/test/test_COM
101 105 test/region.reg
102 106 test/.samp
103 107 test/test_python.sh
... ...
configure.ac
... ... @@ -809,14 +809,17 @@ AC_SUBST(OPENMP_LIB_LDFLAGS)
809 809 # Python binding requires Python and either the files gammalib_wrap.cpp and #
810 810 # gammalib.py or swig to create these files. The following conditionals #
811 811 # are set: #
812   -# WITH_PYTHON - Python bindings will be built #
813   -# HAVE_SWIG - swig is available #
  812 +# WITH_PYTHON - Python bindings will be built #
  813 +# HAVE_SWIG - swig is available #
  814 +# HAVE_WRAPPERS - wrappers are available #
814 815 #############################################################################
815 816 # Initialise flags
816 817 enable_python="no"
817 818 has_python="no"
818 819 has_python_h="no"
819 820 has_swig="no"
  821 +has_wrappers="no"
  822 +build_wrappers="no"
820 823  
821 824 # Python binding enabled?
822 825 AC_ARG_ENABLE([python-binding],
... ... @@ -931,40 +934,58 @@ else
931 934  
932 935 # Do we have Python wrappers
933 936 has_wrappers="yes"
934   - AC_CHECK_FILES([pyext/gammalib/app_wrap.cpp pyext/gammalib/app.py
935   - pyext/gammalib/base_wrap.cpp pyext/gammalib/base.py
936   - pyext/gammalib/fits_wrap.cpp pyext/gammalib/fits.py
937   - pyext/gammalib/linalg_wrap.cpp pyext/gammalib/linalg.py
938   - pyext/gammalib/model_wrap.cpp pyext/gammalib/model.py
939   - pyext/gammalib/numerics_wrap.cpp pyext/gammalib/numerics.py
940   - pyext/gammalib/obs_wrap.cpp pyext/gammalib/obs.py
941   - pyext/gammalib/opt_wrap.cpp pyext/gammalib/opt.py
942   - pyext/gammalib/sky_wrap.cpp pyext/gammalib/sky.py
943   - pyext/gammalib/support_wrap.cpp pyext/gammalib/support.py
944   - pyext/gammalib/test_wrap.cpp pyext/gammalib/test.py
945   - pyext/gammalib/xml_wrap.cpp pyext/gammalib/xml.py
946   - pyext/gammalib/xspec_wrap.cpp pyext/gammalib/xspec.py
947   - pyext/gammalib/vo_wrap.cpp pyext/gammalib/vo.py],,
  937 + AC_CHECK_FILES([$srcdir/pyext/gammalib/app_wrap.cpp
  938 + $srcdir/pyext/gammalib/app.py
  939 + $srcdir/pyext/gammalib/base_wrap.cpp
  940 + $srcdir/pyext/gammalib/base.py
  941 + $srcdir/pyext/gammalib/fits_wrap.cpp
  942 + $srcdir/pyext/gammalib/fits.py
  943 + $srcdir/pyext/gammalib/linalg_wrap.cpp
  944 + $srcdir/pyext/gammalib/linalg.py
  945 + $srcdir/pyext/gammalib/model_wrap.cpp
  946 + $srcdir/pyext/gammalib/model.py
  947 + $srcdir/pyext/gammalib/numerics_wrap.cpp
  948 + $srcdir/pyext/gammalib/numerics.py
  949 + $srcdir/pyext/gammalib/obs_wrap.cpp
  950 + $srcdir/pyext/gammalib/obs.py
  951 + $srcdir/pyext/gammalib/opt_wrap.cpp
  952 + $srcdir/pyext/gammalib/opt.py
  953 + $srcdir/pyext/gammalib/sky_wrap.cpp
  954 + $srcdir/pyext/gammalib/sky.py
  955 + $srcdir/pyext/gammalib/support_wrap.cpp
  956 + $srcdir/pyext/gammalib/support.py
  957 + $srcdir/pyext/gammalib/test_wrap.cpp
  958 + $srcdir/pyext/gammalib/test.py
  959 + $srcdir/pyext/gammalib/xml_wrap.cpp
  960 + $srcdir/pyext/gammalib/xml.py
  961 + $srcdir/pyext/gammalib/xspec_wrap.cpp
  962 + $srcdir/pyext/gammalib/xspec.py
  963 + $srcdir/pyext/gammalib/vo_wrap.cpp
  964 + $srcdir/pyext/gammalib/vo.py],,
948 965 [has_wrappers="no"])
949   -if test "x$with_mwl" = "xyes"; then
950   - AC_CHECK_FILES([pyext/gammalib/mwl_wrap.cpp pyext/gammalib/mwl.py],,
951   - [has_wrappers="no"])
952   -fi
953   -if test "x$with_lat" = "xyes"; then
954   - AC_CHECK_FILES([pyext/gammalib/lat_wrap.cpp pyext/gammalib/lat.py],,
955   - [has_wrappers="no"])
956   -fi
957   -if test "x$with_cta" = "xyes"; then
958   - AC_CHECK_FILES([pyext/gammalib/cta_wrap.cpp pyext/gammalib/cta.py],,
959   - [has_wrappers="no"])
960   -fi
961   -if test "x$with_com" = "xyes"; then
962   - AC_CHECK_FILES([pyext/gammalib/com_wrap.cpp pyext/gammalib/com.py],,
963   - [has_wrappers="no"])
964   -fi
965   -if test "x$has_wrappers" = "xno"; then
966   - AC_MSG_WARN([Python wrapper(s) missing. Requires swig for wrapper generation.])
967   -fi
  966 + if test "x$with_mwl" = "xyes"; then
  967 + AC_CHECK_FILES([$srcdir/pyext/gammalib/mwl_wrap.cpp
  968 + $srcdir/pyext/gammalib/mwl.py],,
  969 + [has_wrappers="no"])
  970 + fi
  971 + if test "x$with_lat" = "xyes"; then
  972 + AC_CHECK_FILES([$srcdir/pyext/gammalib/lat_wrap.cpp
  973 + $srcdir/pyext/gammalib/lat.py],,
  974 + [has_wrappers="no"])
  975 + fi
  976 + if test "x$with_cta" = "xyes"; then
  977 + AC_CHECK_FILES([$srcdir/pyext/gammalib/cta_wrap.cpp
  978 + $srcdir/pyext/gammalib/cta.py],,
  979 + [has_wrappers="no"])
  980 + fi
  981 + if test "x$with_com" = "xyes"; then
  982 + AC_CHECK_FILES([$srcdir/pyext/gammalib/com_wrap.cpp
  983 + $srcdir/pyext/gammalib/com.py],,
  984 + [has_wrappers="no"])
  985 + fi
  986 + if test "x$has_wrappers" = "xno"; then
  987 + AC_MSG_WARN([Python wrapper(s) missing. Requires swig for wrapper generation.])
  988 + fi
968 989  
969 990 # Do we have wrappers or can we created wrappers?
970 991 can_wrappers="no"
... ... @@ -972,16 +993,22 @@ fi
972 993 can_wrappers="yes"
973 994 fi
974 995  
  996 + # Don't we have wrappers but we have swig
  997 + if [test "x$has_wrappers" = "xno" -a "x$has_swig" = "xyes"]; then
  998 + build_wrappers="yes"
  999 + fi
  1000 +
975 1001 # Signal if Python is enabled
976 1002 if [test "x$ac_enable_python_binding" = "xyes" -a "x$has_python" = "xyes" -a "x$has_python_h" = "xyes" -a "x$can_wrappers" = "xyes"]; then
977 1003 enable_python="yes"
978 1004 AC_DEFINE([HAVE_PYTHON], [1], [Define if Python bindings are built])
979 1005 fi
980   -
981 1006  
982 1007 fi
983   -AM_CONDITIONAL(HAVE_SWIG, test "x$has_swig" = "xyes")
984 1008 AM_CONDITIONAL(WITH_PYTHON, test "x$enable_python" = "xyes")
  1009 +AM_CONDITIONAL(HAVE_SWIG, test "x$has_swig" = "xyes")
  1010 +AM_CONDITIONAL(HAVE_WRAPPERS, test "x$has_wrappers" = "xyes")
  1011 +AM_CONDITIONAL(BUILD_WRAPPERS, test "x$build_wrappers" = "xyes")
985 1012  
986 1013 # Set Python environment
987 1014 if test "x$enable_python" = "xyes"; then
... ... @@ -1403,15 +1430,19 @@ if test "x$with_inst" = "xyes"; then
1403 1430 fi
1404 1431 if test "x$with_mwl" = "xyes"; then
1405 1432 AC_CONFIG_FILES([inst/mwl/Makefile])
  1433 + AC_CONFIG_FILES([inst/mwl/test/Makefile])
1406 1434 fi
1407 1435 if test "x$with_cta" = "xyes"; then
1408 1436 AC_CONFIG_FILES([inst/cta/Makefile])
  1437 + AC_CONFIG_FILES([inst/cta/test/Makefile])
1409 1438 fi
1410 1439 if test "x$with_lat" = "xyes"; then
1411 1440 AC_CONFIG_FILES([inst/lat/Makefile])
  1441 + AC_CONFIG_FILES([inst/lat/test/Makefile])
1412 1442 fi
1413 1443 if test "x$with_com" = "xyes"; then
1414 1444 AC_CONFIG_FILES([inst/com/Makefile])
  1445 + AC_CONFIG_FILES([inst/com/test/Makefile])
1415 1446 fi
1416 1447 AC_OUTPUT
1417 1448  
... ...
pyext/Makefile.am
... ... @@ -241,13 +241,15 @@ endif
241 241  
242 242 # Install the gammalib Python module
243 243 install-exec-local:
244   - $(PYTHON) setup.py install --prefix=$(prefix)
  244 + $(PYTHON) setup.py install --prefix=$(DESTDIR)$(prefix)
245 245  
246 246 # Uninstall the gammalib Python module
247 247 uninstall-local:
248   - rm -rf $(pyexecdir)/gammalib
249   - rm -rf $(pyexecdir)/gammalib-@VERSION@*
250   - rm -rf $(datarootdir)/gammalib
  248 + rm -rf $(DESTDIR)$(pyexecdir)/gammalib/*.py
  249 + rm -rf $(DESTDIR)$(pyexecdir)/gammalib/*.pyc
  250 + rm -rf $(DESTDIR)$(pyexecdir)/gammalib/*.so
  251 + rm -rf $(DESTDIR)$(pyexecdir)/gammalib-@VERSION@*.egg-info
  252 + rm -rf $(DESTDIR)$(datarootdir)/gammalib
251 253  
252 254 # Set files to be removed in 'make clean'
253 255 CLEANFILES = $(CLEAN_FILES) $(DEPFILES)
... ... @@ -255,8 +257,9 @@ CLEANFILES = $(CLEAN_FILES) $(DEPFILES)
255 257 # Files to be removed in build directory
256 258 clean-local:
257 259 rm -rf build
258   - rm -rf $(builddir)/gammalib/__init__.py?
259   - rm -rf $(builddir)/gammalib/_*.so
  260 + rm -rf $(builddir)/gammalib/*.py
260 261 rm -rf $(builddir)/gammalib/*.pyc
  262 + rm -rf $(builddir)/gammalib/*_wrap.cpp
  263 + rm -rf $(builddir)/gammalib/_*.so
261 264  
262 265 endif # WITH_PYTHON
... ...
pyext/setup.py.in
... ... @@ -43,6 +43,13 @@ if is_build:
43 43 else:
44 44 print('Python extension module installation:')
45 45  
  46 +# Set prefix
  47 +prefix = '@prefix@'
  48 +if (len(sys.argv) >= 3):
  49 + if (sys.argv[2].find('--prefix') != -1):
  50 + start = sys.argv[2].find('=') + 1
  51 + prefix = sys.argv[2][start:]
  52 +
46 53 # Darwin MacPorts kluge: Remove -L/opt/local/lib path from LDSHARED as this
47 54 # overrides the GammaLib settings. Otherwise, MacPorts libraries would be
48 55 # used instead of the libraries selected by GammaLib
... ... @@ -73,8 +80,8 @@ runtime_library_dirs = ['../src/.libs']
73 80 libraries = ['gamma']
74 81  
75 82 # Add install directory to runtime library path
76   -if os.path.exists('@prefix@/lib'):
77   - runtime_library_dirs.append('@prefix@/lib')
  83 +if os.path.exists(prefix+'/lib'):
  84 + runtime_library_dirs.append(prefix+'/lib')
78 85  
79 86 # Add cfitsio library only if available
80 87 if '@WITH_CFITSIO_TRUE@' != '#':
... ... @@ -196,7 +203,7 @@ for module in inst_modules:
196 203 py_modules.append(pkg_name+'.'+module)
197 204  
198 205 # Set data files to install.
199   -data_files=[('@prefix@/share/gammalib/swig', install_files)]
  206 +data_files=[(prefix+'/share/gammalib/swig', install_files)]
200 207  
201 208 # Setup
202 209 setup(name='@PACKAGE_NAME@',
... ...
test/Makefile.am
... ... @@ -19,6 +19,9 @@
19 19 # #
20 20 #############################################################################
21 21  
  22 +# Set sub directories
  23 +SUBDIRS = reports
  24 +
22 25 # Optional instrument specific tests
23 26 if WITH_INST_MWL
24 27 INST_MWL = $(top_builddir)/inst/mwl/test/test_MWL
... ... @@ -190,7 +193,6 @@ test_GObservation_CPPFLAGS = @CPPFLAGS@
190 193 test_GObservation_LDADD = $(top_builddir)/src/libgamma.la
191 194  
192 195 # Add Valgrind rule
193   -#
194 196 valgrind:
195 197 @if type valgrind >/dev/null 2>&1; then \
196 198 cd .. ; \
... ... @@ -207,3 +209,13 @@ valgrind:
207 209 else \
208 210 echo "valgrind not found in PATH."; \
209 211 fi
  212 +
  213 +# Files to be removed in build directory
  214 +clean-local:
  215 + rm -rf $(builddir)/*.fits
  216 + rm -rf $(builddir)/*.log
  217 + rm -rf $(builddir)/*.html
  218 + rm -rf $(builddir)/*.xml
  219 + rm -rf $(builddir)/*.reg
  220 + rm -rf $(builddir)/*.dat
  221 + rm -rf $(builddir)/reports/*.xml
... ...