kopia lustrzana https://github.com/Hamlib/Hamlib
Bindings tweaks for Python and TCL
Remove execute bits for all test scripts and install them into doc/examples. Make sure check-py and check-tcl targets work. Set a conditional for Python3 or Python2 and install/test the correct script file. Use Makefile variables instead of configure substitutions wherever possible. Generate tcltest.tcl at make time to insert installation library path into the script so that tests pass.astyle-formatting
rodzic
965c1f15f9
commit
4f9085f8f5
|
@ -3,24 +3,29 @@
|
||||||
# more information on swig at http://www.swig.org
|
# more information on swig at http://www.swig.org
|
||||||
#
|
#
|
||||||
|
|
||||||
AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/bindings $(PYTHON_CPPFLAGS) @TCL_INCLUDE_SPEC@
|
AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/bindings $(PYTHON_CPPFLAGS) \
|
||||||
|
$(TCL_INCLUDE_SPEC)
|
||||||
|
|
||||||
AM_CFLAGS = -fno-strict-aliasing
|
AM_CFLAGS = -fno-strict-aliasing
|
||||||
|
|
||||||
SWGFILES = hamlib.swg ignore.swg rig.swg rotator.swg
|
SWGFILES = hamlib.swg ignore.swg rig.swg rotator.swg
|
||||||
|
|
||||||
SWGDEP=$(top_srcdir)/include/hamlib/rig.h $(top_srcdir)/include/hamlib/riglist.h \
|
SWGDEP = \
|
||||||
$(top_srcdir)/include/hamlib/rotator.h $(top_srcdir)/include/hamlib/rotlist.h \
|
$(top_srcdir)/include/hamlib/rig.h \
|
||||||
|
$(top_srcdir)/include/hamlib/riglist.h \
|
||||||
|
$(top_srcdir)/include/hamlib/rotator.h \
|
||||||
|
$(top_srcdir)/include/hamlib/rotlist.h \
|
||||||
$(SWGFILES)
|
$(SWGFILES)
|
||||||
|
|
||||||
EXTRA_DIST = $(SWGFILES) \
|
EXTRA_DIST = $(SWGFILES) \
|
||||||
Makefile.PL perltest.pl tcltest.tcl pytest.py py3test.py luatest.lua \
|
Makefile.PL perltest.pl tcltest.tcl.in pytest.py py3test.py \
|
||||||
README.python
|
luatest.lua README.python
|
||||||
|
|
||||||
noinst_SCRIPTS = perltest.pl tcltest.tcl pytest.py py3test.py hamlibvb.bas luatest.lua
|
exampledir = $(docdir)/examples
|
||||||
|
example_DATA =
|
||||||
|
|
||||||
BUILT_SOURCES=
|
BUILT_SOURCES =
|
||||||
MOSTLYCLEANFILES=
|
MOSTLYCLEANFILES =
|
||||||
|
|
||||||
|
|
||||||
if ENABLE_PERL
|
if ENABLE_PERL
|
||||||
|
@ -29,10 +34,11 @@ if ENABLE_PERL
|
||||||
|
|
||||||
BUILT_SOURCES += hamlibperl_wrap.c
|
BUILT_SOURCES += hamlibperl_wrap.c
|
||||||
MOSTLYCLEANFILES += hamlibperl_wrap.c Hamlib.pm Hamlib.bs Hamlib-pl.mk.old
|
MOSTLYCLEANFILES += hamlibperl_wrap.c Hamlib.pm Hamlib.bs Hamlib-pl.mk.old
|
||||||
|
example_DATA += perltest.pl
|
||||||
|
|
||||||
hamlibperl_wrap.c: hamlib.swg $(SWIGDEP)
|
hamlibperl_wrap.c: hamlib.swg $(SWIGDEP)
|
||||||
$(SWIG) -perl5 -shadow @AM_CPPFLAGS@ -I$(top_srcdir)/bindings -o $@ \
|
$(SWIG) -perl5 -shadow $(AM_CPPFLAGS) -I$(top_srcdir)/bindings \
|
||||||
`test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg
|
-o $@ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg
|
||||||
|
|
||||||
Hamlib-pl.mk: $(srcdir)/Makefile.PL
|
Hamlib-pl.mk: $(srcdir)/Makefile.PL
|
||||||
test -f Makefile.PL || $(LN_S) $(srcdir)/Makefile.PL Makefile.PL
|
test -f Makefile.PL || $(LN_S) $(srcdir)/Makefile.PL Makefile.PL
|
||||||
|
@ -81,9 +87,19 @@ if ENABLE_PYTHON
|
||||||
|
|
||||||
pyexec_ltlib = _Hamlib.la
|
pyexec_ltlib = _Hamlib.la
|
||||||
|
|
||||||
MOSTLYCLEANFILES+= hamlibpy_wrap.c Hamlib.py *.pyc
|
MOSTLYCLEANFILES += hamlibpy_wrap.c Hamlib.py *.pyc
|
||||||
BUILT_SOURCES += hamlibpy_wrap.c Hamlib.py
|
BUILT_SOURCES += hamlibpy_wrap.c Hamlib.py
|
||||||
|
|
||||||
|
# Set by AM_CONDITIONAL in configure.ac
|
||||||
|
if PYVER_3
|
||||||
|
pytest = py3test.py
|
||||||
|
else !PYVER_3
|
||||||
|
pytest = pytest.py
|
||||||
|
endif
|
||||||
|
# PYVER_3
|
||||||
|
|
||||||
|
example_DATA += $(pytest)
|
||||||
|
|
||||||
nodist_pyexec_PYTHON = Hamlib.py
|
nodist_pyexec_PYTHON = Hamlib.py
|
||||||
nodist__Hamlib_la_SOURCES = hamlibpy_wrap.c
|
nodist__Hamlib_la_SOURCES = hamlibpy_wrap.c
|
||||||
|
|
||||||
|
@ -95,7 +111,8 @@ _Hamlib_la_LTLIBRARIES = $(pyexec_ltlib)
|
||||||
all-py: $(pyexec_ltlib)
|
all-py: $(pyexec_ltlib)
|
||||||
|
|
||||||
check-py: all-py
|
check-py: all-py
|
||||||
$(srcdir)/pytest.py || echo "Python test failed" 1>&2
|
PYTHONPATH=$(builddir):$(builddir)/.libs $(PYTHON) $(srcdir)/$(pytest) \
|
||||||
|
|| echo "Python test failed" 1>&2
|
||||||
|
|
||||||
Hamlib.py: hamlibpy_wrap.c
|
Hamlib.py: hamlibpy_wrap.c
|
||||||
|
|
||||||
|
@ -116,24 +133,26 @@ if ENABLE_TCL
|
||||||
##########################################
|
##########################################
|
||||||
# Tcl binding
|
# Tcl binding
|
||||||
|
|
||||||
BUILT_SOURCES+= hamlibtcl_wrap.c
|
BUILT_SOURCES += hamlibtcl_wrap.c
|
||||||
MOSTLYCLEANFILES+= hamlibtcl_wrap.c pkgIndex.tcl
|
MOSTLYCLEANFILES += hamlibtcl_wrap.c pkgIndex.tcl tcltest.tcl
|
||||||
|
example_DATA += tcltest.tcl
|
||||||
|
|
||||||
tcl_ltlib = hamlibtcl.la
|
tcl_ltlib = hamlibtcl.la
|
||||||
|
|
||||||
tcldir = $(libdir)/tcl/Hamlib
|
tcldir = $(libdir)/tcl$(TCL_VERSION)/Hamlib
|
||||||
|
|
||||||
PKG_VER=@ABI_VERSION@.@ABI_REVISION@
|
PKG_VER = $(ABI_VERSION).$(ABI_REVISION)
|
||||||
DLL=hamlibtcl-$(PKG_VER)@TCL_SHLIB_SUFFIX@
|
DLL = hamlibtcl-$(PKG_VER)$(TCL_SHLIB_SUFFIX)
|
||||||
|
|
||||||
nodist_hamlibtcl_la_SOURCES = hamlibtcl_wrap.c
|
nodist_hamlibtcl_la_SOURCES = hamlibtcl_wrap.c
|
||||||
hamlibtcl_la_LDFLAGS = -no-undefined -module -release $(PKG_VER) -avoid-version @TCL_LIB_SPEC@
|
hamlibtcl_la_LDFLAGS = -no-undefined -module -release $(PKG_VER) -avoid-version
|
||||||
hamlibtcl_la_LIBADD = $(top_builddir)/src/libhamlib.la
|
hamlibtcl_la_LIBADD = $(top_builddir)/src/libhamlib.la $(TCL_LIB_SPEC)
|
||||||
|
|
||||||
hamlibtcl_ladir = $(tcldir)
|
hamlibtcl_ladir = $(tcldir)
|
||||||
hamlibtcl_la_DATA = pkgIndex.tcl
|
hamlibtcl_la_DATA = pkgIndex.tcl
|
||||||
|
|
||||||
# Install hamlibtcl.la into the tcltk/Hamlib directory set by $hamlibtcl_ladir
|
# Install hamlibtcl.la into the $(tcldir)/Hamlib directory
|
||||||
|
# set by $(hamlibtcl_ladir)
|
||||||
hamlibtcl_la_LTLIBRARIES = $(tcl_ltlib)
|
hamlibtcl_la_LTLIBRARIES = $(tcl_ltlib)
|
||||||
|
|
||||||
# Having the first occurance of 'hamlib' capitalized seemed to cause confusion
|
# Having the first occurance of 'hamlib' capitalized seemed to cause confusion
|
||||||
|
@ -142,13 +161,19 @@ pkgIndex.tcl: Makefile
|
||||||
echo 'package ifneeded hamlib $(PKG_VER) [list load [file join $$dir $(DLL)] Hamlib]' > pkgIndex.tcl
|
echo 'package ifneeded hamlib $(PKG_VER) [list load [file join $$dir $(DLL)] Hamlib]' > pkgIndex.tcl
|
||||||
|
|
||||||
hamlibtcl_wrap.c: hamlib.swg $(SWGDEP)
|
hamlibtcl_wrap.c: hamlib.swg $(SWGDEP)
|
||||||
$(SWIG) -tcl -pkgversion $(PKG_VER) @AM_CPPFLAGS@ -I$(top_srcdir)/bindings -o $@ \
|
$(SWIG) -tcl -pkgversion $(PKG_VER) $(AM_CPPFLAGS) -I$(top_srcdir)/bindings \
|
||||||
`test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg
|
-o $@ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg
|
||||||
|
|
||||||
all-tcl: pkgIndex.tcl $(tcl_ltlib)
|
do_subst = sed -e 's,[@]tcldir[@],$(tcldir),g'
|
||||||
|
|
||||||
|
tcltest.tcl: tcltest.tcl.in Makefile
|
||||||
|
$(do_subst) < $(srcdir)/tcltest.tcl.in > tcltest.tcl
|
||||||
|
|
||||||
|
all-tcl: pkgIndex.tcl $(tcl_ltlib) tcltest.tcl
|
||||||
|
|
||||||
check-tcl: all-tcl
|
check-tcl: all-tcl
|
||||||
TCLLIBPATH=$(builddir)/.libs $(srcdir)/tcltest.tcl || echo "Tcl test failed" 1>&2
|
TCLLIBPATH=$(builddir)/.libs tclsh $(builddir)/tcltest.tcl \
|
||||||
|
|| echo "Tcl test failed" 1>&2
|
||||||
|
|
||||||
install-tcl:
|
install-tcl:
|
||||||
clean-tcl:
|
clean-tcl:
|
||||||
|
@ -164,8 +189,9 @@ if ENABLE_LUA
|
||||||
|
|
||||||
luaexec_ltlib = Hamliblua.la
|
luaexec_ltlib = Hamliblua.la
|
||||||
|
|
||||||
MOSTLYCLEANFILES+= hamliblua_wrap.c
|
MOSTLYCLEANFILES += hamliblua_wrap.c
|
||||||
BUILT_SOURCES += hamliblua_wrap.c
|
BUILT_SOURCES += hamliblua_wrap.c
|
||||||
|
example_DATA += luatest.lua
|
||||||
|
|
||||||
nodist_luaexec_LUA = Hamlib.lua
|
nodist_luaexec_LUA = Hamlib.lua
|
||||||
nodist_Hamliblua_la_SOURCES = hamliblua_wrap.c
|
nodist_Hamliblua_la_SOURCES = hamliblua_wrap.c
|
||||||
|
@ -184,8 +210,8 @@ check-lua: all-lua
|
||||||
Hamlib.lua: hamliblua_wrap.c
|
Hamlib.lua: hamliblua_wrap.c
|
||||||
|
|
||||||
hamliblua_wrap.c: hamlib.swg $(SWGDEP)
|
hamliblua_wrap.c: hamlib.swg $(SWGDEP)
|
||||||
$(SWIG) -lua @AM_CPPFLAGS@ -I$(top_srcdir)/bindings -o $@ \
|
$(SWIG) -lua $(AM_CPPFLAGS) -I$(top_srcdir)/bindings \
|
||||||
`test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg
|
-o $@ `test -f hamlib.swg || echo '$(srcdir)/'`hamlib.swg
|
||||||
|
|
||||||
install-lua:
|
install-lua:
|
||||||
clean-lua:
|
clean-lua:
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
exec tclsh "$0" "$@"
|
exec tclsh "$0" "$@"
|
||||||
|
|
||||||
# Edit the path below to reflect installed Hamlib extension
|
# Edit the path below to reflect installed Hamlib extension
|
||||||
lappend ::auto_path /usr/local/lib/tcl/Hamlib
|
lappend ::auto_path @tcldir@
|
||||||
|
|
||||||
## Brute force loading
|
## Brute force loading
|
||||||
#load "/usr/local/lib/tcltk/Hamlib/hamlibtcl.so" Hamlib
|
#load "@tcldir@/hamlibtcl.so" Hamlib
|
||||||
|
|
||||||
## Preferred package loading
|
## Preferred package loading
|
||||||
package require hamlib
|
package require hamlib
|
30
configure.ac
30
configure.ac
|
@ -457,10 +457,10 @@ BINDING_LIB_TARGETS=""
|
||||||
dnl Check if cxx-binding not wanted, default is to build it
|
dnl Check if cxx-binding not wanted, default is to build it
|
||||||
|
|
||||||
# C++ binding
|
# C++ binding
|
||||||
AC_MSG_CHECKING([whether to build C++ binding and demo])
|
AC_MSG_CHECKING([whether to build C++ binding])
|
||||||
AC_ARG_WITH([cxx-binding],
|
AC_ARG_WITH([cxx-binding],
|
||||||
[AS_HELP_STRING([--without-cxx-binding],
|
[AS_HELP_STRING([--without-cxx-binding],
|
||||||
[do not build C++ binding and demo @<:@default=yes@:>@])],
|
[do not build C++ binding @<:@default=yes@:>@])],
|
||||||
[cf_with_cxx_binding=$withval],
|
[cf_with_cxx_binding=$withval],
|
||||||
[cf_with_cxx_binding=$cf_with_cxx])
|
[cf_with_cxx_binding=$cf_with_cxx])
|
||||||
AC_MSG_RESULT([$cf_with_cxx_binding])
|
AC_MSG_RESULT([$cf_with_cxx_binding])
|
||||||
|
@ -472,10 +472,10 @@ AS_IF([test x"${cf_with_cxx_binding}" = "xyes"],
|
||||||
dnl Check if perl-binding is wanted, default is to not build it
|
dnl Check if perl-binding is wanted, default is to not build it
|
||||||
|
|
||||||
# Perl binding
|
# Perl binding
|
||||||
AC_MSG_CHECKING([whether to build perl binding and demo])
|
AC_MSG_CHECKING([whether to build perl binding])
|
||||||
AC_ARG_WITH([perl-binding],
|
AC_ARG_WITH([perl-binding],
|
||||||
[AS_HELP_STRING([--with-perl-binding],
|
[AS_HELP_STRING([--with-perl-binding],
|
||||||
[build perl binding and demo @<:@default=no@:>@])],
|
[build perl binding @<:@default=no@:>@])],
|
||||||
[cf_with_perl_binding=$withval],
|
[cf_with_perl_binding=$withval],
|
||||||
[cf_with_perl_binding=no])
|
[cf_with_perl_binding=no])
|
||||||
AC_MSG_RESULT([$cf_with_perl_binding])
|
AC_MSG_RESULT([$cf_with_perl_binding])
|
||||||
|
@ -498,10 +498,10 @@ AM_CONDITIONAL([ENABLE_PERL], [test x"${cf_with_perl_binding}" = "xyes"])
|
||||||
|
|
||||||
dnl Check for python availability, so we can enable HamlibPy
|
dnl Check for python availability, so we can enable HamlibPy
|
||||||
# Python bindings
|
# Python bindings
|
||||||
AC_MSG_CHECKING([whether to build python binding and demo])
|
AC_MSG_CHECKING([whether to build python binding])
|
||||||
AC_ARG_WITH([python-binding],
|
AC_ARG_WITH([python-binding],
|
||||||
[AS_HELP_STRING([--with-python-binding],
|
[AS_HELP_STRING([--with-python-binding],
|
||||||
[build python binding and demo @<:@default=no@:>@])],
|
[build python binding @<:@default=no@:>@])],
|
||||||
[cf_with_python_binding=$withval],
|
[cf_with_python_binding=$withval],
|
||||||
[cf_with_python_binding=no])
|
[cf_with_python_binding=no])
|
||||||
AC_MSG_RESULT([$cf_with_python_binding])
|
AC_MSG_RESULT([$cf_with_python_binding])
|
||||||
|
@ -523,18 +523,23 @@ AS_IF([test x"${cf_with_python_binding}" = "xyes"],[
|
||||||
|
|
||||||
AM_CONDITIONAL([ENABLE_PYTHON], [test x"${cf_with_python_binding}" = "xyes"])
|
AM_CONDITIONAL([ENABLE_PYTHON], [test x"${cf_with_python_binding}" = "xyes"])
|
||||||
|
|
||||||
|
dnl Determine whether to install pytest.py or py3test.py to $(docdir)/examples
|
||||||
|
AM_PYTHON_CHECK_VERSION([${PYTHON}], [3.0], [pyver_3="yes"], [pyver_3="no"])
|
||||||
|
AM_CONDITIONAL([PYVER_3], [test x"${pyver_3}" = x"yes"])
|
||||||
|
|
||||||
|
|
||||||
# Tcl binding
|
# Tcl binding
|
||||||
AC_MSG_CHECKING([Whether to build Tcl bindings and demos])
|
AC_MSG_CHECKING([Whether to build Tcl bindings])
|
||||||
AC_ARG_WITH([tcl-binding],
|
AC_ARG_WITH([tcl-binding],
|
||||||
[AS_HELP_STRING([--with-tcl-binding],
|
[AS_HELP_STRING([--with-tcl-binding],
|
||||||
[build Tcl binding and demo @<:@default=no@:>@])],
|
[build Tcl binding @<:@default=no@:>@])],
|
||||||
[build_tcl=$withval],
|
[build_tcl=$withval],
|
||||||
[build_tcl=no])
|
[build_tcl=no])
|
||||||
AC_MSG_RESULT([$build_tcl])
|
AC_MSG_RESULT([$build_tcl])
|
||||||
|
|
||||||
dnl SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG from macros/tcl.m4
|
dnl SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG from macros/tcl.m4
|
||||||
AS_IF([test x"${build_tcl}" = "xyes"],[
|
AS_IF([test x"${build_tcl}" = "xyes"],[
|
||||||
|
dnl Search for and load tclConfig.sh.
|
||||||
SC_PATH_TCLCONFIG
|
SC_PATH_TCLCONFIG
|
||||||
SC_LOAD_TCLCONFIG
|
SC_LOAD_TCLCONFIG
|
||||||
|
|
||||||
|
@ -555,16 +560,19 @@ AS_IF([test x"${build_tcl}" = "xyes"],[
|
||||||
BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(tcl_ltlib)"])
|
BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(tcl_ltlib)"])
|
||||||
|
|
||||||
AM_CONDITIONAL([ENABLE_TCL], [test x"${build_tcl}" = "xyes"])
|
AM_CONDITIONAL([ENABLE_TCL], [test x"${build_tcl}" = "xyes"])
|
||||||
|
dnl These variables are set once tclConfig.sh is loaded.
|
||||||
|
AC_SUBST([TCL_VERSION])
|
||||||
AC_SUBST([TCL_LIB_SPEC])
|
AC_SUBST([TCL_LIB_SPEC])
|
||||||
AC_SUBST([TCL_INCLUDE_SPEC])
|
AC_SUBST([TCL_INCLUDE_SPEC])
|
||||||
AC_SUBST([TCL_SHLIB_SUFFIX])
|
AC_SUBST([TCL_SHLIB_SUFFIX])
|
||||||
|
|
||||||
|
|
||||||
dnl Check for lua availability, so we can enable HamlibLua
|
dnl Check for lua availability, so we can enable HamlibLua
|
||||||
# Lua bindings
|
# Lua bindings
|
||||||
AC_MSG_CHECKING([whether to build lua binding and demo])
|
AC_MSG_CHECKING([whether to build lua binding])
|
||||||
AC_ARG_WITH([lua-binding],
|
AC_ARG_WITH([lua-binding],
|
||||||
[AS_HELP_STRING([--with-lua-binding],
|
[AS_HELP_STRING([--with-lua-binding],
|
||||||
[build lua binding and demo @<:@default=no@:>@])],
|
[build lua binding @<:@default=no@:>@])],
|
||||||
[cf_with_lua_binding=$withval],
|
[cf_with_lua_binding=$withval],
|
||||||
[cf_with_lua_binding=no])
|
[cf_with_lua_binding=no])
|
||||||
AC_MSG_RESULT([$cf_with_lua_binding])
|
AC_MSG_RESULT([$cf_with_lua_binding])
|
||||||
|
@ -587,6 +595,7 @@ AS_IF([test x"${cf_with_lua_binding}" = "xyes"],[
|
||||||
|
|
||||||
AM_CONDITIONAL([ENABLE_LUA], [test x"${cf_with_lua_binding}" = "xyes"])
|
AM_CONDITIONAL([ENABLE_LUA], [test x"${cf_with_lua_binding}" = "xyes"])
|
||||||
|
|
||||||
|
|
||||||
dnl Only search for Swig if one or more bindings are enabled.
|
dnl Only search for Swig if one or more bindings are enabled.
|
||||||
AS_IF([test "x${BINDING_ALL}" != "x"],
|
AS_IF([test "x${BINDING_ALL}" != "x"],
|
||||||
[# macros/ax_pkg_swig.m4
|
[# macros/ax_pkg_swig.m4
|
||||||
|
@ -749,7 +758,6 @@ sartek/Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
c++/Makefile
|
c++/Makefile
|
||||||
bindings/Makefile
|
bindings/Makefile
|
||||||
bindings/hamlibvb.bas
|
|
||||||
tests/Makefile
|
tests/Makefile
|
||||||
doc/Makefile
|
doc/Makefile
|
||||||
doc/hamlib.cfg
|
doc/hamlib.cfg
|
||||||
|
|
Ładowanie…
Reference in New Issue