From 27505fb46dd85670a02bdc1f24ed029ccaa4b3f0 Mon Sep 17 00:00:00 2001 From: Stephane Fillod Date: Sun, 22 May 2011 23:23:46 +0200 Subject: [PATCH] New Makefile target 'dist-win32' for automated build --- Makefile.am | 53 ++++++++++++++++++++++++++++-- README.release | 26 +++------------ README_VB | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+), 25 deletions(-) create mode 100644 README_VB diff --git a/Makefile.am b/Makefile.am index b3b16df4a..5ca88b849 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = hamlib.pc EXTRA_DIST = PLAN TODO LICENSE hamlib.m4 hamlib.pc.in README.developer \ - README.betatester README.win32 hamlib.spec + README.betatester README.win32 README_VB hamlib.spec # BINDINGS_LIST subdirs are no longer built SUBDIRS = macros include lib $(subdirs) src @BACKEND_LIST@ @ROT_BACKEND_LIST@ \ @@ -20,9 +20,56 @@ DIST_SUBDIRS = macros include lib $(subdirs) src c++ bindings tests doc \ flexradio sartek lowe rft rs tapr kit skanti prm80 wj racal tuner \ gs232a heathkit spid ars m2 -rpm: Makefile - make dist +rpm: Makefile dist $(RPMBUILD) -ta $(PACKAGE)-$(VERSION).tar.gz rm $(PACKAGE)-$(VERSION).tar.gz ACLOCAL_AMFLAGS = -I macros + +# Hack for generating the win32 binaries + +.PHONY: dist-win32 + +distdirw32="$(distdir)-win32" +# FIXME: get libusb-win32 path from configure +libusb_win32_bin_path=$(top_builddir)/../libusb-win32-bin-1.2.4.0 +msvc_toolkit_path=~/.wine/drive_c/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003 +zipdir=hamlib-win32-$(VERSION) + +# aka unix2dos +TODOS=todos + +dist-win32: + @# Import internal ./libltdl and build it for mingw32 + mkdir -p $(distdirw32)/_build $(distdirw32)/_inst + @# Configure and build hamlib for mingw32, with libusb-win32 + @# FIXME: Need to forge a file libusb.pc + $(am__cd) $(distdirw32)/_build \ + && ( test -d libltdl || ( libtoolize --ltdl && \ + $(am__cd) libltdl && ./configure --host=i586-mingw32msvc && make ) ) \ + && ../../$(top_srcdir)/configure --disable-static \ + --host=i586-mingw32msvc \ + --prefix=`pwd`/../_inst \ + --without-rpc-backends \ + PKG_CONFIG_LIBDIR=../../$(libusb_win32_bin_path)/lib/pkgconfig \ + && make $(AM_MAKEFLAGS) install + mkdir -p $(zipdir)/bin $(zipdir)/lib/msvc $(zipdir)/lib/gcc $(zipdir)/include + cp -a $(distdirw32)/_build/src/libhamlib.def $(zipdir)/lib/msvc/libhamlib-@ABI_VERSION@.def + cp -a $(distdirw32)/_inst/include/hamlib $(zipdir)/include/. + $(TODOS) $(zipdir)/lib/msvc/libhamlib-@ABI_VERSION@.def $(zipdir)/include/hamlib/*.h + @# C++ binding is useless on win32 because of its ABI + rm -f $(zipdir)/include/hamlib/{rig,rot}class.h + for f in README README.betatester LICENSE COPYING.LIB README_VB ; do \ + cp -a $(top_srcdir)/$${f} $(zipdir)/$${f}.txt && $(TODOS) $(zipdir)/$${f}.txt ; done + cp -a $(distdirw32)/_inst/bin/{libhamlib-@ABI_VERSION@.dll,rigctld.exe,rigctl.exe,rigmem.exe,rigsmtr.exe,rigswr.exe,rotctld.exe,rotctl.exe} $(zipdir)/bin/. + cp -a $(distdirw32)/_inst/lib/hamlib/hamlib-*.dll $(zipdir)/bin/. + cp -a $(distdirw32)/_inst/lib/libhamlib.dll.a $(zipdir)/lib/gcc + @# NB: Do no strip libusb0.dll + i586-mingw32msvc-strip $(zipdir)/bin/*.exe $(zipdir)/bin/*hamlib-*.dll + cp -a ${libusb_win32_bin_path}/bin/x86/libusb0_x86.dll $(zipdir)/bin/libusb0.dll + @# Need VC++ free toolkit installed somewhere (TODO: or dlltool is enough?) + $(am__cd) $(zipdir)/lib/msvc/ && \ + wine $(msvc_toolkit_path)/bin/link.exe /lib /machine:i386 /def:libhamlib-@ABI_VERSION@.def || true + zip -r hamlib-win32-$(VERSION).zip $(zipdir) + rm -rf $(distdirw32) + diff --git a/README.release b/README.release index 2e20e2b47..a795c5d11 100644 --- a/README.release +++ b/README.release @@ -47,31 +47,12 @@ Releasing Hamlib: make dist * Build Windows DLL from previous tarball, and .LIB, then create .zip file - Rem: under Linux, you need the package mingw32 to cross-compile it, + Rem: under Linux, you need the package mingw32(+zip) to cross-compile it, and an internal copy of libltdl (configured and built), and free MVC++Toolkit to create .lib file: - # Import internal ./libltdl and build it for mingw32 - libtoolize --ltdl - ( cd libltdl; ./configure --host=i586-mingw32msvc && make ) - # Configure and build hamlib for mingw32 - ./configure --disable-static \ - --host=i586-mingw32msvc \ - --prefix=/tmp/mingw-inst \ - --without-rpc-backends \ - PKG_CONFIG_LIBDIR= ac_cv_path_PKG_CONFIG=no - make install - new_ver="x.y.z" - mkdir -p /tmp/mingw-inst/hamlib-${new_ver}/lib/msvc /tmp/mingw-inst/hamlib-${new_ver}/lib/gcc - cp src/libhamlib.def /tmp/mingw-inst/hamlib-${new_ver}/lib/msvc/libhamlib-2.def - cd /tmp/mingw-inst/hamlib-${new_ver}/lib/msvc/ - unix2dos *.def - wine /media/sda1/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003/bin/link.exe /lib /machine:i386 /def:libhamlib-2.def - cd ../.. - unix2dos include/hamlib/*.h - cp lib/libhamlib.dll.a /tmp/mingw-inst/hamlib-${new_ver}/lib/gcc - zip -r hamlib-win32-${new_ver}.zip hamlib-win32-${new_ver} + make distwin32 - Edit Release, i386, .zip + Upload & edit Properties: select Windows * Build Windows DLL with stdcall convention: Ditto but with HAMLIB_API set to __stdcall in include/hamlib/rig_dll.h before re-compiling. @@ -85,6 +66,7 @@ Releasing Hamlib: - Click Add File button - Click Choose File button - Click Upload + - Click on (i) icon, select appropriate OS for "Default Download" * Update http://www.hamlib.org Wiki - Download section diff --git a/README_VB b/README_VB new file mode 100644 index 000000000..92a53c92b --- /dev/null +++ b/README_VB @@ -0,0 +1,88 @@ +This file originates from a mail by Michael Benz who did the work. +It explains how to proceed to have the VB Wrapper used with +VB.NET 2002 with Framework 1.1 (others not tested) + +In the newer VB Modules (.BAS) don't exist anymore. So they were replaced by the +Classes (.VB) +The Wrapper is not in final Condition, many DLL Function are still not covered now, +but it will be a good start. + +To Import the "Wrapper" use the Folder "Project" and "Import existing Element" +Now import the Class "Hamlib.VB". It alsough seems to import into Sharpdevelop, +so anybody can try it out for free! +http://www.icsharpcode.net/OpenSource/SD/Default.aspx + +This Class contains Your Enumeration as well as the DLLImport to get Access to the +Hamlib DLL. + +Covered are: + - Init Rig with Comport and Speed + - set/ get Frequency + - set/get Mode + - set/get VFO + - get Riginfo + + -rig_debug_level_e not verified (Function is Void, VB Dokumentation +sais this is not possible to be marshaled, but Compiler is still accapting this) + + +To get access to the Class you have to add something like this in your Main Class + Dim RigLib As RigControll = New RigControll 'get Acces to RigLib Klass + + + +here is an Example how to use the Class: + +Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click + 'Dim tokenlookup As String = "rig_pathname" + 'Dim tokenlookup As Object = "serial_speed" + 'Dim Info As String + Dim Frequenz As Double + Dim ZeichenOut As String + Dim TokenPointer As System.Int32 + Dim VFO As Integer + Dim Mode As RigControll.RMode_t + Dim Bandbreite As Long + ' Dim RigLib As RigControll = New RigControll + + Button3.Enabled() = True + Button2.Enabled() = False + + +RigLib.rig_set_debug(RigControll.rig_debug_level_e.RIG_DEBUG_TRACE) + myrig = RigLib.rig_init(RigNumber.Text) + + TBmyrig.Text = myrig.ToString 'convert myrig to String + + TokenPointer = RigLib.rig_token_lookup(myrig, "rig_pathname") + TBZeichen.Text = RigLib.rig_set_conf(myrig, TokenPointer, ComboBox2.Text) + Token.Text = TokenPointer + + TokenPointer = RigLib.rig_token_lookup(myrig, "serial_speed") + TBZeichen.Text = RigLib.rig_set_conf(myrig, TokenPointer, ComboBox3.Text) + Token.Text = TokenPointer + + RigLib.rig_open(myrig) + TB_Riginfo.Text = RigLib.rig_get_info(myrig) + + RigLib.rig_get_vfo(myrig, VFO) + TextBox8.Text = VFO.ToString + + RigLib.rig_get_freq(myrig, VFO, Frequenz) + TextBox2.Text() = Frequenz + + RigLib.rig_get_mode(myrig, VFO, Mode, Bandbreite) + TextBox3.Text = [Enum].GetName(GetType(RigControll.RMode_t), Mode) + TextBox4.Text = Bandbreite + + End Sub + ++++++++++++++++++++++++++++++++++ + +kind Regard + +Michael + +PS: For help, patches, report, please use send mail at + hamlib-developer@lists.sourceforge.net mailing list + or http://sourceforge.net/projects/hamlib/