Re: Stumped at creating Win32 zip file
Stephane Fillod <f8cfe <at> free.fr>
2011-04-05 21:11:57 GMT
Mar, Apr 05, 2011, Nate Bargmann skribis:
> I seem to have gotten the cross compilation working for a test release
> of 1.2.13.1 which contains cherry-picked Win32 fixes in my local
> repository (I've not yet pushed them to SF). I am getting stumped when
> I get to the point of creating the Zip archive in README.release. Using
> the command in the file I am only getting files under
> /tmp/mingw-inst/hamlib-1.2.13.1/ into the archive and not the other
> files as with the Win32 archive Stephane uploaded to Source Forge.
> Also, many files are in different locations in the downloadable archive
> versus my build directory and the binaries are stripped which is not
> mentioned in the release document. I note that I ended up with
> bin/libhamlib++-2.dll and bin/libhamlib-1.dll files while the SF archive
> has bin/libhamlib-2.dll. I also do not have bin/libusb0.dll anywhere.
> Then there are other files which can be copied manually.
>
> My goal is to make README.release usable by anyone wanting to create a
> local Win32 build from Linux and to facilitate a daily Win32 zip file
> along with the other daily snapshots as well. Stephane, please help
> fill in the missing steps.
You guessed it, the creation of the zip is done by hand-picking
(so-to-speak) the appropriate files, and copying them in right folder.
It goes a bit like the following patch (untested yet), which screams to
be put into a Makefile.am, and eventually fully autoconfiscated wrt
install dir:
diff --git a/README.release b/README.release
index 2e20e2b..19a3c6f 100644
--- a/README.release
+++ b/README.release
<at> <at> -47,31 +47,44 <at> <at> 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 and build hamlib for mingw32, with libusb-win32
+ prefix=/tmp/mingw-inst
+ # FIXME: Need to forge a file libusb.pc
+ libusb_win32_bin_path=/home/fillods/RA/rigctrl/libusb-win32-bin-1.m.n.o
./configure --disable-static \
--host=i586-mingw32msvc \
- --prefix=/tmp/mingw-inst \
+ --prefix=${prefix} \
--without-rpc-backends \
- PKG_CONFIG_LIBDIR= ac_cv_path_PKG_CONFIG=no
+ PKG_CONFIG_LIBDIR=${libusb_win32_bin_path}/lib/pkgconfig
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}
-
- Edit Release, i386, .zip
+ zipdir=`pwd`/hamlib-win32-${new_ver}/
+ mkdir -p ${zipdir}/bin ${zipdir}/lib/msvc ${zipdir}/lib/gcc ${zipdir}/include
+ cp -a src/libhamlib.def ${zipdir}/lib/msvc/libhamlib-2.def
+ cp -a ${prefix}/include/hamlib ${zipdir}/include/.
+ todos ${zipdir}/lib/msvc/libhamlib-2.def ${zipdir}/include/hamlib/*.h
+ # C++ binding is useless on win32 because of ABI
+ rm ${zipdir}/include/hamlib/{rig,rot}class.h
+ for f in README README.betatester LICENSE COPYING.LIB README_VB ; do \
+ cp -a ${f} ${zipdir}/${f}.txt ; todos ${zipdir}/${f}.txt ; done
+ cp -a
${prefix}/bin/{libhamlib-2.dll,rigctld.exe,rigctl.exe,rigmem.exe,rigsmtr.exe,rigswr.exe,rotctld.exe,rotctl.exe} ${zipdir}/bin/.
+ cp -a ${prefix}/lib/hamlib/hamlib-*.dll ${zipdir}/bin/.
+ cp -a ${prefix}/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
+ # Need VC++ free toolkit installed somewhere
+ ( cd ${zipdir}/lib/msvc/ &&
+ wine /media/wxp/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003/bin/link.exe /lib
/machine:i386 /def:libhamlib-2.def )
+ zip -r hamlib-win32-${new_ver}.zip ${zipdir}
+
+ 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.
BTW, the content of the attached README.txt (!= README) should be yanked
into README.win32 probably, which itself needs to be reworked.
Some files are missing from the git repo.
Rem: the prefix /tmp/mingw-inst/ is not that safe. Maybe it should be
better to relocate it in a subdir of the build dir?
It's been a well packed day, time for me to get my eyes sleeping
--
Stephane - F8CE
This ZIP archive contains the official version of Hamlib 1.2.13-1,
cross-compiled for Win32 using MinGW under Ubuntu/x86 (nice, he!).
The DLL has a cdecl interface.
This material is copyrighted. The license is LGPL, and it comes
WITHOUT ANY WARRANTY. See LICENSE.txt and COPYING.LIB.txt files.
Make sure *all* the .DLL are in your PATH, and you have read
the README.betatester file, especially the "testing Hamlib" section.
See README_VB.txt for how to use the wrapper file for VisualBasic.
Note: you must use the stdcall release for use with VisualBasic.
There's a .LIB import library for MS-VC++ in lib/msvc.
Simply #include <hamlib/rig.h> (add directory to include path),
include the .LIB in your project and you're done.
Note: MS-VC++ cannot compile all the Hamlib code, but the API rig.h
has been made MSVC friendly
Patches, feedback, and contributions are welcome.
Please report problems, success to hamlib-developer <at> lists.sourceforge.net
Cheers,
Stephane Fillod - F8CFE
http://hamlib.org
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 <at> lists.sourceforge.net mailing list
or http://sourceforge.net/projects/hamlib/
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Hamlib-developer mailing list
Hamlib-developer <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hamlib-developer