2020-05-05 11:52:34 +00:00
|
|
|
#!/bin/sh
|
2011-06-20 01:12:35 +00:00
|
|
|
|
2020-05-04 10:22:57 +00:00
|
|
|
# Builds Hamlib 4.x W32 binary distribution.
|
2012-10-07 13:31:10 +00:00
|
|
|
|
2021-02-14 19:38:15 +00:00
|
|
|
# A script to build a set of W32 binary DLLs and executables from a Hamlib
|
|
|
|
# source tarball. This script assumes that the Hamlib source tarball has been
|
|
|
|
# extracted to the directory specified in $BUILD_DIR and that libusb-1.x.y has
|
|
|
|
# also been extracted to $BUILD_DIR.
|
2020-05-04 10:22:57 +00:00
|
|
|
|
|
|
|
# See README.build-Windows for complete details.
|
2011-06-20 01:12:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Set this to a desired directory
|
|
|
|
BUILD_DIR=~/builds
|
|
|
|
|
|
|
|
# Set this to LibUSB archive extracted in $BUILD_DIR
|
2020-01-10 21:58:16 +00:00
|
|
|
LIBUSB_VER=libusb-1.0.22
|
2011-06-20 01:12:35 +00:00
|
|
|
|
2020-05-04 10:22:57 +00:00
|
|
|
# Set to the correct HOST_ARCH= line for your minGW installation
|
2013-10-31 03:29:50 +00:00
|
|
|
HOST_ARCH=i686-w64-mingw32
|
|
|
|
|
|
|
|
# Set to the strip name for your version of minGW
|
|
|
|
HOST_ARCH_STRIP=i686-w64-mingw32-strip
|
2011-06-20 01:12:35 +00:00
|
|
|
|
|
|
|
# Error return codes. See /usr/include/sysexits.h
|
|
|
|
EX_USAGE=64
|
|
|
|
EX_NOINPUT=66
|
|
|
|
|
|
|
|
|
|
|
|
# Pass name of Hamlib archive extracted in $BUILD_DIR
|
2021-02-14 19:38:15 +00:00
|
|
|
if test $# -ne 1
|
|
|
|
then
|
2020-06-02 13:47:17 +00:00
|
|
|
echo
|
|
|
|
echo "Usage: $(basename $0) hamlib-version"
|
|
|
|
echo "See README.build-Windows for more information."
|
|
|
|
echo
|
|
|
|
|
2020-05-05 11:52:34 +00:00
|
|
|
exit ${EX_USAGE}
|
2011-06-20 01:12:35 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Make sure the Hamlib archive is where we expect
|
2021-02-14 19:38:15 +00:00
|
|
|
if test -d ${BUILD_DIR}/$1
|
|
|
|
then
|
2020-06-02 13:47:17 +00:00
|
|
|
echo
|
|
|
|
echo "Building W32 binaries in ${BUILD_DIR}/$1"
|
|
|
|
echo
|
|
|
|
|
2020-05-05 11:52:34 +00:00
|
|
|
cd ${BUILD_DIR}/$1
|
2011-06-20 01:12:35 +00:00
|
|
|
else
|
2020-06-02 13:47:17 +00:00
|
|
|
echo
|
|
|
|
echo "Build directory, ${BUILD_DIR}/$1 not found!"
|
|
|
|
echo "Check path for $1 or correct the version number."
|
|
|
|
echo
|
|
|
|
|
2020-05-05 11:52:34 +00:00
|
|
|
exit ${EX_NOINPUT}
|
2011-06-20 01:12:35 +00:00
|
|
|
fi
|
|
|
|
|
2020-05-04 10:22:57 +00:00
|
|
|
RELEASE=$(/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[4\./ {print $2;exit}' ./configure.ac)
|
2018-07-30 02:56:55 +00:00
|
|
|
HL_FILENAME=hamlib-w32-${RELEASE}
|
2020-05-04 10:22:57 +00:00
|
|
|
INST_DIR=$(pwd)/mingw32-inst
|
|
|
|
ZIP_DIR=$(pwd)/${HL_FILENAME}
|
2018-07-30 02:56:55 +00:00
|
|
|
LIBUSB_1_0_BIN_PATH=${BUILD_DIR}/${LIBUSB_VER}
|
2011-06-20 01:12:35 +00:00
|
|
|
|
2011-06-21 02:35:06 +00:00
|
|
|
|
2018-07-30 02:56:55 +00:00
|
|
|
# Create W32 specific README.w32-bin file
|
|
|
|
cat > README.w32-bin <<END_OF_README
|
2011-06-21 02:35:06 +00:00
|
|
|
What is it?
|
|
|
|
===========
|
|
|
|
|
2012-10-07 13:31:10 +00:00
|
|
|
This ZIP archive or Windows installer contains a build of Hamlib-$RELEASE
|
2020-05-05 11:52:34 +00:00
|
|
|
cross-compiled for MS Windows 32 bit using MinGW under Debian GNU/Linux 10
|
2020-05-04 10:22:57 +00:00
|
|
|
(nice, heh!).
|
2011-06-21 02:35:06 +00:00
|
|
|
|
2018-07-30 02:56:55 +00:00
|
|
|
This software is copyrighted. The library license is LGPL, and the *.EXE files
|
|
|
|
licenses are GPL. Hamlib comes WITHOUT ANY WARRANTY. See the LICENSE.txt,
|
|
|
|
COPYING.txt, and COPYING.LIB.txt files.
|
2011-06-21 02:35:06 +00:00
|
|
|
|
2020-05-04 10:22:57 +00:00
|
|
|
Supporting documentation in the form of Unix manual pages have also been
|
|
|
|
included after being converted to HTML.
|
2013-04-27 03:37:16 +00:00
|
|
|
|
2011-06-21 02:35:06 +00:00
|
|
|
|
|
|
|
Installation and Configuration
|
|
|
|
==============================
|
|
|
|
|
|
|
|
Extract the ZIP archive into a convenient location, C:\Program Files is a
|
|
|
|
reasonable choice.
|
|
|
|
|
|
|
|
Make sure *all* the .DLL files are in your PATH (leave them in the bin
|
2018-07-30 02:56:55 +00:00
|
|
|
directory and set the PATH). To set the PATH environment variable in Windows
|
|
|
|
2000, Windows XP, and Windows 7 (need info on Vista and Windows 8/10) do the
|
|
|
|
following:
|
2012-10-07 13:31:10 +00:00
|
|
|
|
|
|
|
* W2k/XP: Right-click on "My Computer"
|
|
|
|
Win7: Right-click on "Computer"
|
|
|
|
|
|
|
|
* W2k/XP: Click the "Advanced" tab of the "System Properties" dialog
|
|
|
|
Win7: Click the "Advanced system settings" link in the System dialog
|
|
|
|
|
|
|
|
* Click the "Environment Variables" button of the pop-up dialog
|
2011-06-21 02:35:06 +00:00
|
|
|
|
|
|
|
* Select "Path" in the "System variables" box of the "Environment Variables"
|
|
|
|
dialog
|
2012-10-07 13:31:10 +00:00
|
|
|
|
|
|
|
NB: If you are not the administrator, system policy may not allow editing
|
2018-07-30 02:56:55 +00:00
|
|
|
the path variable. The complete path to an executable file will need to be
|
|
|
|
given to run one of the Hamlib programs.
|
2012-10-07 13:31:10 +00:00
|
|
|
|
2011-06-21 02:35:06 +00:00
|
|
|
* Click the Edit button
|
2012-10-07 13:31:10 +00:00
|
|
|
|
|
|
|
* Now add the Hamlib path in the "Variable Value:" edit box. Be sure to put
|
2011-06-21 02:35:06 +00:00
|
|
|
a semi-colon ';' after the last path before adding the Hamlib path (NB. The
|
|
|
|
entire path is highlighted and will be erased upon typing a character so
|
|
|
|
click in the box to unselect the text first. The PATH is important!!)
|
2020-05-05 11:52:34 +00:00
|
|
|
Append the Hamlib path, e.g. C:\Program Files\hamlib-w32-4.0~git\bin
|
2012-10-07 13:31:10 +00:00
|
|
|
|
2011-06-21 02:35:06 +00:00
|
|
|
* Click OK for all three dialog boxes to save your changes.
|
|
|
|
|
|
|
|
|
|
|
|
Testing with the Hamlib Utilities
|
|
|
|
=================================
|
|
|
|
|
2018-07-30 02:56:55 +00:00
|
|
|
To continue, be sure you have read the README.betatester file, especially the
|
2020-05-04 10:22:57 +00:00
|
|
|
"Testing Hamlib" section. The primary means of testing is by way of the
|
|
|
|
rigctl utility for radios and rotctl utility for rotators. Each is a command
|
|
|
|
line program that is interactive or can act on a single command and exit.
|
2011-06-20 01:12:35 +00:00
|
|
|
|
2018-07-30 02:56:55 +00:00
|
|
|
Documentation for each utility can be found as an HTML file in the doc
|
|
|
|
directory.
|
2011-06-21 02:35:06 +00:00
|
|
|
|
|
|
|
In short, the command syntax is of the form:
|
|
|
|
|
|
|
|
rigctl -m 120 -r COM1 -vvvvv
|
|
|
|
|
2012-10-07 13:31:10 +00:00
|
|
|
-m -> Radio model 120, or Yaesu FT-817 (use 'rigctl -l' for a list)
|
2011-06-21 02:35:06 +00:00
|
|
|
-r -> Radio device, in this case COM1
|
|
|
|
-v -> Verbosity level. For testing four or five v characters are required.
|
2012-10-07 13:31:10 +00:00
|
|
|
Five 'v's set a debug level of TRACE which generates a lot of screen
|
2011-06-21 02:35:06 +00:00
|
|
|
output showing communication to the radio and values of important
|
2011-06-21 18:38:39 +00:00
|
|
|
variables. These traces are vital information for Hamlib rig backend
|
|
|
|
development.
|
2011-06-21 02:35:06 +00:00
|
|
|
|
2018-07-30 02:56:55 +00:00
|
|
|
To run rigctl or rotctl open a cmd window (Start|Run|enter 'cmd' in the
|
2020-05-04 10:22:57 +00:00
|
|
|
dialog). If text scrolls off the screen, you can scroll back with the mouse.
|
2018-07-30 02:56:55 +00:00
|
|
|
To copy output text into a mailer or editor (I recommend Notepad++, a free
|
|
|
|
editor also licensed under the GPL), highlight the text as a rectangle in the
|
|
|
|
cmd window, press <Enter> (or right-click the window icon in the upper left
|
|
|
|
corner and select Edit, then Copy), and paste it into your editor with Ctl-V
|
|
|
|
(or Edit|Paste from the typical GUI menu).
|
2011-06-21 02:35:06 +00:00
|
|
|
|
|
|
|
All feedback is welcome to the mail address below.
|
|
|
|
|
|
|
|
|
2012-10-07 13:31:10 +00:00
|
|
|
Uninstall
|
|
|
|
=========
|
|
|
|
|
|
|
|
To uninstall, simply delete the Hamlib directory. You may wish to edit the
|
|
|
|
PATH as above to remove the Hamlib bin path, if desired.
|
|
|
|
|
|
|
|
|
2018-07-30 02:56:55 +00:00
|
|
|
Information for w32 Programmers
|
2011-06-21 02:35:06 +00:00
|
|
|
=================================
|
2011-06-20 01:12:35 +00:00
|
|
|
|
2020-05-05 11:52:34 +00:00
|
|
|
The DLL has a cdecl interface.
|
|
|
|
|
|
|
|
There is a libhamlib-4.def definition file for MS Visual C++/Visual Studio in
|
|
|
|
lib/msvc. Refer to the sample commands below to generate a local
|
|
|
|
libhamlib-4.lib file for use with the VC++/VS linker.
|
|
|
|
|
|
|
|
Simply #include <hamlib/rig.h> (add directory to include path), include
|
|
|
|
libhamlib-4.lib in your project and you are done. Note: VC++/VS cannot
|
|
|
|
compile all the Hamlib code, but the API defined by rig.h has been made MSVC
|
|
|
|
friendly :-)
|
2011-06-21 18:38:39 +00:00
|
|
|
|
|
|
|
As the source code for the library DLLs is licensed under the LGPL, your
|
2018-07-30 02:56:55 +00:00
|
|
|
program is not considered a "derivative work" when using the published Hamlib
|
|
|
|
API and normal linking to the front-end library, and may be of a license of
|
2020-05-05 11:52:34 +00:00
|
|
|
your choosing.
|
|
|
|
|
|
|
|
For linking the library with MS Visual C++ 2003, from the directory you
|
|
|
|
installed Hamlib run the following commands to generate the libhamlib-4.lib
|
|
|
|
file needed for linking with your MSVC project:
|
|
|
|
|
|
|
|
cd lib\msvc
|
|
|
|
c:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\link.exe /lib /machine:i386 /def:libhamlib-4.def
|
|
|
|
|
|
|
|
To do the same for Visual Studio 2017:
|
|
|
|
|
|
|
|
cd lib\msvc
|
|
|
|
c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Tools\MSVC\14.16.27023\bin\Hostx64\x86\bin\link.exe /lib /machine:i386 /def:libhamlib-4.def
|
|
|
|
|
|
|
|
and for VS 2019:
|
|
|
|
|
|
|
|
cd lib\msvc
|
|
|
|
c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x86\bin\link.exe /lib /machine:i386 /def:libhamlib-4.def
|
|
|
|
|
|
|
|
NOTE: feedback is requested on the previous two command examples!
|
|
|
|
|
|
|
|
The published Hamlib API may be found at:
|
2011-06-21 18:38:39 +00:00
|
|
|
|
2021-02-14 19:38:15 +00:00
|
|
|
http://hamlib.sourceforge.net/manuals/4.1/index.html
|
2020-05-04 10:22:57 +00:00
|
|
|
|
2011-06-21 02:35:06 +00:00
|
|
|
|
|
|
|
Thank You!
|
|
|
|
==========
|
|
|
|
|
2011-06-20 01:12:35 +00:00
|
|
|
Patches, feedback, and contributions are welcome.
|
|
|
|
|
2011-06-21 02:35:06 +00:00
|
|
|
Please report problems or success to hamlib-developer@lists.sourceforge.net
|
2011-06-20 01:12:35 +00:00
|
|
|
|
|
|
|
Cheers,
|
|
|
|
Stephane Fillod - F8CFE
|
|
|
|
Nate Bargmann - N0NB
|
|
|
|
http://www.hamlib.org
|
|
|
|
|
|
|
|
END_OF_README
|
|
|
|
|
2011-06-21 02:35:06 +00:00
|
|
|
|
2020-05-04 10:22:57 +00:00
|
|
|
# Configure and build hamlib for i686-w64-mingw32, with libusb-1.0
|
2011-06-20 01:12:35 +00:00
|
|
|
|
2013-10-31 03:29:50 +00:00
|
|
|
./configure --host=${HOST_ARCH} \
|
2018-07-30 02:56:55 +00:00
|
|
|
--prefix=${INST_DIR} \
|
2011-06-20 01:12:35 +00:00
|
|
|
--without-cxx-binding \
|
2013-10-31 03:29:50 +00:00
|
|
|
--disable-static \
|
2018-07-30 02:56:55 +00:00
|
|
|
CPPFLAGS="-I${LIBUSB_1_0_BIN_PATH}/include" \
|
|
|
|
LDFLAGS="-L${LIBUSB_1_0_BIN_PATH}/MinGW32/dll"
|
2013-10-31 03:29:50 +00:00
|
|
|
|
2011-06-20 01:12:35 +00:00
|
|
|
|
2020-04-18 16:48:24 +00:00
|
|
|
make -j 4 install
|
2011-06-20 01:12:35 +00:00
|
|
|
|
2018-07-30 02:56:55 +00:00
|
|
|
mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include ${ZIP_DIR}/doc
|
2021-02-14 19:38:15 +00:00
|
|
|
cp -a src/libhamlib.def ${ZIP_DIR}/lib/msvc/libhamlib-4.def
|
|
|
|
todos ${ZIP_DIR}/lib/msvc/libhamlib-4.def
|
|
|
|
cp -a ${INST_DIR}/include/hamlib ${ZIP_DIR}/include/.
|
|
|
|
todos ${ZIP_DIR}/include/hamlib/*.h
|
2011-06-20 01:12:35 +00:00
|
|
|
|
2018-07-30 02:56:55 +00:00
|
|
|
# C++ binding is useless on w32 because of ABI
|
2021-02-14 19:38:15 +00:00
|
|
|
for f in *class.h
|
|
|
|
do
|
2020-05-05 11:52:34 +00:00
|
|
|
rm ${ZIP_DIR}/include/hamlib/${f}
|
|
|
|
done
|
2011-06-20 01:12:35 +00:00
|
|
|
|
2021-02-14 19:38:15 +00:00
|
|
|
for f in AUTHORS ChangeLog COPYING COPYING.LIB LICENSE README README.betatester README.w32-bin THANKS
|
|
|
|
do
|
|
|
|
cp -a ${f} ${ZIP_DIR}/${f}.txt
|
|
|
|
todos ${ZIP_DIR}/${f}.txt
|
|
|
|
done
|
2011-06-20 01:12:35 +00:00
|
|
|
|
2018-07-30 02:56:55 +00:00
|
|
|
# Generate HTML documents from nroff formatted man files
|
2021-02-14 19:38:15 +00:00
|
|
|
for f in doc/man1/*.1 doc/man7/*.7
|
|
|
|
do
|
2018-07-30 02:56:55 +00:00
|
|
|
/usr/bin/groff -mandoc -Thtml >${f}.html ${f}
|
2021-02-14 19:38:15 +00:00
|
|
|
cp -a ${f}.html ${ZIP_DIR}/doc/.
|
|
|
|
done
|
2011-06-21 18:38:39 +00:00
|
|
|
|
|
|
|
cd ${BUILD_DIR}/$1
|
|
|
|
|
2011-06-20 01:12:35 +00:00
|
|
|
# Copy build files into specific locations for Zip file
|
2021-02-14 19:38:15 +00:00
|
|
|
for f in *.exe
|
|
|
|
do
|
2020-05-05 11:52:34 +00:00
|
|
|
cp -a ${INST_DIR}/bin/${f} ${ZIP_DIR}/bin/.
|
|
|
|
done
|
|
|
|
|
2011-06-20 01:12:35 +00:00
|
|
|
cp -a ${INST_DIR}/bin/libhamlib-?.dll ${ZIP_DIR}/bin/.
|
|
|
|
cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc/.
|
|
|
|
|
2013-10-31 03:29:50 +00:00
|
|
|
# NB: Strip Hamlib DLLs and EXEs
|
|
|
|
${HOST_ARCH_STRIP} ${ZIP_DIR}/bin/*.exe ${ZIP_DIR}/bin/*hamlib-*.dll
|
|
|
|
|
|
|
|
# Copy needed third party DLLs
|
|
|
|
cp -a /usr/i686-w64-mingw32/lib/libwinpthread-1.dll ${ZIP_DIR}/bin/.
|
2018-07-30 02:56:55 +00:00
|
|
|
cp -a ${LIBUSB_1_0_BIN_PATH}/MinGW32/dll/libusb-1.0.dll ${ZIP_DIR}/bin/libusb-1.0.dll
|
2013-12-11 02:05:00 +00:00
|
|
|
|
2020-05-05 11:52:34 +00:00
|
|
|
# Required for MinGW with GCC 6.3 (Debian 9)
|
2020-04-19 03:44:02 +00:00
|
|
|
FILE="/usr/lib/gcc/i686-w64-mingw32/6.3-posix/libgcc_s_sjlj-1.dll"
|
2021-02-14 19:38:15 +00:00
|
|
|
if test -f "$FILE"
|
|
|
|
then
|
2020-05-05 11:52:34 +00:00
|
|
|
cp -a ${FILE} ${ZIP_DIR}/bin/.
|
2020-04-18 16:48:24 +00:00
|
|
|
fi
|
|
|
|
|
2020-05-05 11:52:34 +00:00
|
|
|
# Required for MinGW with GCC 8.3 (Debian 10)
|
2020-04-19 03:44:02 +00:00
|
|
|
FILE="/usr/lib/gcc/i686-w64-mingw32/8.3-posix/libgcc_s_sjlj-1.dll"
|
2021-02-14 19:38:15 +00:00
|
|
|
if test -f "$FILE"
|
|
|
|
then
|
2020-05-05 11:52:34 +00:00
|
|
|
cp -a ${FILE} ${ZIP_DIR}/bin/.
|
2020-04-18 16:48:24 +00:00
|
|
|
fi
|
2011-06-20 01:12:35 +00:00
|
|
|
|
2020-05-05 11:52:34 +00:00
|
|
|
/usr/bin/zip -r ${HL_FILENAME}.zip $(basename ${ZIP_DIR})
|