kopia lustrzana https://github.com/Hamlib/Hamlib
Add helper scripts/ directory
The scripts/ directory will contain helper scripts for building Hamlib binary releases for Win32 and possibly other target platforms. EAch script should be accompanied by a companion README file with information on the script and build requirements. Initial release of build-win32.sh for building Win32 DLLs and EXEs for use with MS VC++.Hamlib-1.2.14
rodzic
2b27a8a029
commit
a4d84e3338
|
@ -0,0 +1,75 @@
|
|||
|
||||
This file is a HOWTO for the cross-compiling of Win32 binary DLLs built from
|
||||
a tarball generated by 'make dist' in a Git checkout. The resulting DLLs
|
||||
are built with a cdecl interface compatible with MS VC++.
|
||||
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
In these steps the release or daily snapshot tarball is unpacked in ~/builds
|
||||
for the Win32 build and all operations are done from there unless otherwise
|
||||
noted.
|
||||
|
||||
Under Linux you need the mingw32 package to cross-compile it, an internal
|
||||
copy of libltdl (configured and built as below), zip to create the archive,
|
||||
the tofrodos or dos2unix package installed to convert to DOS text format,
|
||||
and Wine plus the free MVC++Toolkit available from:
|
||||
|
||||
http://uploading.com/files/HNH73WB3/VCToolkitSetup%28v1.01%29%282004.07.06%29.zip.html
|
||||
|
||||
to create the Win32 .LIB file (unzip and then install it with Wine in the
|
||||
usual way).
|
||||
|
||||
NB: Debian Squeeze and later users will need at least the mingw32-runtime
|
||||
3.15 package as the 3.13 package is broken and can manually install the
|
||||
Ubuntu version from:
|
||||
|
||||
http://packages.ubuntu.com/maverick/devel/mingw32-runtime
|
||||
|
||||
Finally, the Win32 version of libusb must be available for the USB backends to
|
||||
be built. Download the latest libusb-win32-bin-1.2.4.0.zip from:
|
||||
|
||||
https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.4.0/
|
||||
|
||||
and unzip the archive in ~/builds/libusb-win32-bin-1.2.4.0 and then copy the
|
||||
following into libusb-win32-bin-1.2.4.0/lib/pkgconfig/libusb.pc (the
|
||||
pkgconfig directory will need to be created):
|
||||
|
||||
---------------CUT-----------------------------
|
||||
prefix=/home/USER/builds/libusb-win32-bin-1.2.4.0
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/lib/gcc
|
||||
bindir=${exec_prefix}/bin
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: libusb
|
||||
Description: USB access library
|
||||
Version: 1.2.4.0
|
||||
Libs: -L${libdir} -L${bindir} -lusb
|
||||
Cflags: -I${includedir}
|
||||
---------------CUT-----------------------------
|
||||
|
||||
Any version from 1.2.3.0 has been known to work.
|
||||
|
||||
|
||||
Build for Win32, cross-compile on Linux:
|
||||
========================================
|
||||
|
||||
Extract the Hamlib tarball into ~/builds (if you prefer another directory
|
||||
be sure to edit the BUILD_DIR variable in the build-win32.sh script):
|
||||
|
||||
$ tar xvfz ~/Downloads/hamlib-1.2.14~git-72c52d6-20110618.tar.gz
|
||||
|
||||
Invoke the build-win32.sh script (it requires a Bash shell) with the name
|
||||
of the directory/Hamlib version to build (you need not cd into the hamlib
|
||||
directory, although it won't hurt. The script uses absolute paths):
|
||||
|
||||
build-win32.sh hamlib-1.2.14~git
|
||||
|
||||
Note: At this time (18 Jun 2011) the build will fail on Debian Unstable due
|
||||
to a libtool version mismatch between libtool 2.2.6b included in the
|
||||
mingw32/gcc-mingw32 packages and the later libtool 2.4 installed on Unstable
|
||||
and Testing. Users of Debian Stable (Squeeze) and Ubuntu 10.10 (Maverick)
|
||||
should be able to build the Win32 DLLs.
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
#!/bin/bash
|
||||
|
||||
# A script to build a set of Win32 binary DLLs from a Hamlib tarball.
|
||||
# This script assumes that the Hamlib tarball has been extracted to the
|
||||
# directory specified in $build_dir and that libusb-win32-bin-1.x.y.z has also
|
||||
# been extracted to $build_dir and a libusb.pc file has been created. The
|
||||
# MS VC++Toolkit must also be installed.
|
||||
#
|
||||
# See README.build-win32 for complete details.
|
||||
|
||||
|
||||
# Set this to a desired directory
|
||||
BUILD_DIR=~/builds
|
||||
|
||||
# Set this to LibUSB archive extracted in $BUILD_DIR
|
||||
LIBUSB_VER=libusb-win32-bin-1.2.4.0
|
||||
|
||||
|
||||
# Error return codes. See /usr/include/sysexits.h
|
||||
EX_USAGE=64
|
||||
EX_NOINPUT=66
|
||||
|
||||
|
||||
# Pass name of Hamlib archive extracted in $BUILD_DIR
|
||||
if [ $# -ne 1 ]; then
|
||||
echo -e "\nUsage: `basename $0` hamlib-version\n"
|
||||
echo -e "See README.build-win32 for more information.\n"
|
||||
exit $EX_USAGE
|
||||
fi
|
||||
|
||||
# Make sure the Hamlib archive is where we expect
|
||||
if [ -d ${BUILD_DIR}/$1 ]; then
|
||||
echo -e "\nBuilding Win32 binaries in ${BUILD_DIR}/$1\n\n"
|
||||
cd ${BUILD_DIR}/$1
|
||||
else
|
||||
echo -e "\nBuild directory, ${BUILD_DIR}/$1 not found!\nCheck path for $1 or correct the version number.\n"
|
||||
exit $EX_NOINPUT
|
||||
fi
|
||||
|
||||
RELEASE=`/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[1\./ {print $2}' ./configure.ac`
|
||||
INST_DIR=`pwd`/mingw-inst
|
||||
ZIP_DIR=`pwd`/hamlib-win32-${RELEASE}
|
||||
LIBUSB_WIN32_BIN_PATH=${BUILD_DIR}/${LIBUSB_VER}
|
||||
|
||||
# Create Win32 specific README.win32_bin file
|
||||
cat > README.win32-bin <<END_OF_README
|
||||
This ZIP archive contains a build of Hamlib-$RELEASE
|
||||
cross-compiled for Win32 using MinGW under Debian GNU/Linux (nice, heh!).
|
||||
The DLL has a cdecl interface for MS VC++.
|
||||
|
||||
This material is copyrighted. The library license is LGPL, and the *.EXE
|
||||
files licenses are GPL. Hamlib comes WITHOUT ANY WARRANTY. See LICENSE.txt
|
||||
COPYING.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.
|
||||
|
||||
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@lists.sourceforge.net
|
||||
|
||||
Cheers,
|
||||
Stephane Fillod - F8CFE
|
||||
Nate Bargmann - N0NB
|
||||
http://www.hamlib.org
|
||||
|
||||
END_OF_README
|
||||
|
||||
# Import internal ./libltdl and build it for mingw32
|
||||
libtoolize --ltdl
|
||||
cd libltdl; ./configure --host=i586-mingw32msvc && make; cd ..
|
||||
|
||||
# Configure and build hamlib for mingw32, with libusb-win32
|
||||
|
||||
./configure --disable-static \
|
||||
--host=i586-mingw32msvc \
|
||||
--prefix=`pwd`/mingw-inst \
|
||||
--without-rpc-backends \
|
||||
--without-cxx-binding \
|
||||
PKG_CONFIG_LIBDIR=${LIBUSB_WIN32_BIN_PATH}/lib/pkgconfig
|
||||
|
||||
make install
|
||||
|
||||
mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include
|
||||
cp -a src/libhamlib.def ${ZIP_DIR}/lib/msvc/libhamlib-2.def; todos ${ZIP_DIR}/lib/msvc/libhamlib-2.def
|
||||
cp -a ${INST_DIR}/include/hamlib ${ZIP_DIR}/include/.; todos ${ZIP_DIR}/include/hamlib/*.h
|
||||
|
||||
# C++ binding is useless on win32 because of ABI
|
||||
rm ${ZIP_DIR}/include/hamlib/{rig,rot}class.h
|
||||
|
||||
for f in AUTHORS ChangeLog README README.betatester LICENSE COPYING COPYING.LIB README.win32-bin THANKS ; do \
|
||||
cp -a ${f} ${ZIP_DIR}/${f}.txt ; todos ${ZIP_DIR}/${f}.txt ; done
|
||||
|
||||
# Copy build files into specific locations for Zip file
|
||||
cp -a ${INST_DIR}/bin/{rigctld.exe,rigctl.exe,rigmem.exe,rigsmtr.exe,rigswr.exe,rotctld.exe,rotctl.exe} ${ZIP_DIR}/bin/.
|
||||
cp -a ${INST_DIR}/lib/hamlib/hamlib-*.dll ${ZIP_DIR}/bin/.
|
||||
cp -a ${INST_DIR}/bin/libhamlib-?.dll ${ZIP_DIR}/bin/.
|
||||
cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc/.
|
||||
|
||||
# NB: Do not strip libusb0.dll
|
||||
i586-mingw32msvc-strip ${ZIP_DIR}/bin/*.exe ${ZIP_DIR}/bin/*hamlib-*.dll
|
||||
cp -a ${LIBUSB_WIN32_BIN_PATH}/bin/x86/libusb0_x86.dll ${ZIP_DIR}/bin/libusb0.dll
|
||||
|
||||
# Need VC++ free toolkit installed (default Wine directory installation shown)
|
||||
( cd ${ZIP_DIR}/lib/msvc/ && wine ~/.wine/drive_c/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003/bin/link.exe /lib /machine:i386 /def:libhamlib-2.def )
|
||||
zip -r hamlib-win32-${RELEASE}-`date +%Y%m%d`.zip `basename ${ZIP_DIR}`
|
||||
|
||||
|
Ładowanie…
Reference in New Issue