From bbb4354f2be8f9559f933516661b9e1bd43d1cef Mon Sep 17 00:00:00 2001 From: Nate Bargmann Date: Sun, 14 Feb 2021 13:38:15 -0600 Subject: [PATCH] Update the Windows build scripts and README Attempt to make these a bit more readable for future inclusion into the Doxygen generated documentation. --- scripts/README.build-Windows | 51 +++++++++++++++++------------------ scripts/build-w32.sh | 50 ++++++++++++++++++++-------------- scripts/build-w64.sh | 52 ++++++++++++++++++++---------------- 3 files changed, 84 insertions(+), 69 deletions(-) diff --git a/scripts/README.build-Windows b/scripts/README.build-Windows index 9385a5640..4369976e3 100644 --- a/scripts/README.build-Windows +++ b/scripts/README.build-Windows @@ -8,30 +8,30 @@ with MS VC++. Prerequisites ============= -In these steps the release or daily snapshot tarball is unpacked in ~/builds -for the Windows build and all operations are done from there unless -otherwise noted. +In these steps the release or daily snapshot tarball is unpacked in +$HOME/builds for the Windows build and all operations are done from there +unless otherwise noted. -Under Linux you need at least the mingw-w64 package to cross-compile it, 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: +Under Linux you need at least the following packages: -http://uploading.com/files/HNH73WB3/VCToolkitSetup%28v1.01%29%282004.07.06%29.zip.html +mingw-w64 cross-compiler +zip create the archive +tofrodos convert to DOS text format (CR/LF) +groff convert nroff manual pages to HTML -to create the Windows .LIB file (unzip and then install it with Wine in the -usual way). +On Debian 8 (Jessie) and later versions the mingw-w64 package works and is +being used to build the daily Windows 32/64 snapshots and stable releases. +The release and daily snapshots are built in a Debian 10 (Buster) virtual +machine. -On Debian Jesse the mingw-w64 package works and is being used to build -the daily Windows 32/64 snapshots and releases. - -Finally, the Windows version of libusb 1.0 must be available for the USB backends -to be built. Download the latest libusb-1.0 from: +Finally, the Windows version of libusb 1.0 must be available for the USB +backends to be built. Download the latest libusb-1.0 from: https://sourceforge.net/projects/libusb/files/libusb-1.0/ -:nd unzip the archive in ~/builds +and unzip the archive in $HOME/builds. -Libusb 1.0.20 is known to work. Presumably any 1.X.X version should work. +libusb 1.0.20 is known to work. Presumably, any 1.X.X version should work. Several variables may need to be set differently at the top of the script file depending on your system. @@ -40,28 +40,27 @@ The script now relies on a pair of environment variables to locate the needed libusb files. The script generates HTML documents for the included .EXE files using groff -to convert the nroff formatted man pages. On Debian and derivatives, the groff -package is likely already installed. +to convert the nroff formatted man pages. Build for Windows 32/64, cross-compile on Linux: ================================================ -Extract the Hamlib tarball into ~/builds (if you prefer another directory +Extract the Hamlib tarball into $HOME/builds (if you prefer another directory be sure to edit the BUILD_DIR variable in the build-w[32|64].sh script): - $ tar xvfz ~/Downloads/hamlib-3.3~git-???????-20180527.tar.gz + $ tar xvfz $HOME/Downloads/hamlib-4.2~git-???????-20210214.tar.gz -Invoke the build-w[32|64].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 build-w[32|64].sh script uses absolute -paths): +Invoke the build-w[32|64].sh script (either requires a Bourne compatible +shell, e.g. bash, dash, etc.) with the name of the directory/Hamlib version to +build (you need not cd into the hamlib directory, although it won't hurt. The +build-w[32|64].sh script uses absolute paths): - $ build-w32.sh hamlib-3.3~git + $ build-w32.sh hamlib-4.2~git or: - $ build-w64.sh hamlib-3.3~git + $ build-w64.sh hamlib-4.2~git Release Info diff --git a/scripts/build-w32.sh b/scripts/build-w32.sh index 5e98d3fb4..0f60eedc6 100755 --- a/scripts/build-w32.sh +++ b/scripts/build-w32.sh @@ -2,11 +2,10 @@ # Builds Hamlib 4.x W32 binary distribution. -# A script to build a set of W32 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-1.x.y has also been extracted to -# $BUILD_DIR. The MS VC++ Toolkit must also be installed and working with -# Wine. +# 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. # See README.build-Windows for complete details. @@ -29,7 +28,8 @@ EX_NOINPUT=66 # Pass name of Hamlib archive extracted in $BUILD_DIR -if [ $# -ne 1 ]; then +if test $# -ne 1 +then echo echo "Usage: $(basename $0) hamlib-version" echo "See README.build-Windows for more information." @@ -39,7 +39,8 @@ if [ $# -ne 1 ]; then fi # Make sure the Hamlib archive is where we expect -if [ -d ${BUILD_DIR}/$1 ]; then +if test -d ${BUILD_DIR}/$1 +then echo echo "Building W32 binaries in ${BUILD_DIR}/$1" echo @@ -196,9 +197,7 @@ NOTE: feedback is requested on the previous two command examples! The published Hamlib API may be found at: -http://hamlib.sourceforge.net/manuals/3.0.1/index.html - -(The 4.0 API/ABI is changed and new documentation will be forthcoming.) +http://hamlib.sourceforge.net/manuals/4.1/index.html Thank You! @@ -229,26 +228,35 @@ END_OF_README make -j 4 install mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include ${ZIP_DIR}/doc -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 +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 # C++ binding is useless on w32 because of ABI -for f in *class.h ; do \ +for f in *class.h +do rm ${ZIP_DIR}/include/hamlib/${f} done -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 +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 # Generate HTML documents from nroff formatted man files -for f in doc/man1/*.1 doc/man7/*.7; do \ +for f in doc/man1/*.1 doc/man7/*.7 +do /usr/bin/groff -mandoc -Thtml >${f}.html ${f} - cp -a ${f}.html ${ZIP_DIR}/doc/. ; done + cp -a ${f}.html ${ZIP_DIR}/doc/. +done cd ${BUILD_DIR}/$1 # Copy build files into specific locations for Zip file -for f in *.exe ; do \ +for f in *.exe +do cp -a ${INST_DIR}/bin/${f} ${ZIP_DIR}/bin/. done @@ -264,13 +272,15 @@ cp -a ${LIBUSB_1_0_BIN_PATH}/MinGW32/dll/libusb-1.0.dll ${ZIP_DIR}/bin/libusb-1. # Required for MinGW with GCC 6.3 (Debian 9) FILE="/usr/lib/gcc/i686-w64-mingw32/6.3-posix/libgcc_s_sjlj-1.dll" -if test -f "$FILE"; then +if test -f "$FILE" +then cp -a ${FILE} ${ZIP_DIR}/bin/. fi # Required for MinGW with GCC 8.3 (Debian 10) FILE="/usr/lib/gcc/i686-w64-mingw32/8.3-posix/libgcc_s_sjlj-1.dll" -if test -f "$FILE"; then +if test -f "$FILE" +then cp -a ${FILE} ${ZIP_DIR}/bin/. fi diff --git a/scripts/build-w64.sh b/scripts/build-w64.sh index 06d02c0ad..9567414e5 100755 --- a/scripts/build-w64.sh +++ b/scripts/build-w64.sh @@ -2,11 +2,10 @@ # Builds Hamlib 4.x W64 binary distribution. -# A script to build a set of W64 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-1.x.y has also been extracted to -# $BUILD_DIR. The MS VC++ Toolkit must also be installed and working with -# Wine. +# A script to build a set of W64 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. # See README.build-Windows for complete details. @@ -29,7 +28,8 @@ EX_NOINPUT=66 # Pass name of Hamlib archive extracted in $BUILD_DIR -if [ $# -ne 1 ]; then +if test $# -ne 1 +then echo echo "Usage: $(basename $0) hamlib-version" echo "See README.build-Windows for more information." @@ -39,7 +39,8 @@ if [ $# -ne 1 ]; then fi # Make sure the Hamlib archive is where we expect -if [ -d ${BUILD_DIR}/$1 ]; then +if test -d ${BUILD_DIR}/$1 +then echo echo "Building W64 binaries in ${BUILD_DIR}/$1" echo @@ -70,9 +71,6 @@ This ZIP archive or Windows installer contains a build of Hamlib-$RELEASE cross-compiled for MS Windows 64 bit using MinGW under Debian GNU/Linux 10 (nice, heh!). -NB: This Windows 64 bit release is EXPERIMENTAL! Please report bugs, -failures, and success to the Hamlib mailing list below. - 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. @@ -200,9 +198,7 @@ not appear to be correct to generate a 64 bit libhamlib-4.lib file! The published Hamlib API may be found at: -http://hamlib.sourceforge.net/manuals/3.0.1/index.html - -(The 4.0 API/ABI is changed and new documentation will be forthcoming.) +http://hamlib.sourceforge.net/manuals/4.1/index.html Thank You! @@ -233,27 +229,35 @@ END_OF_README make -j 4 install mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include ${ZIP_DIR}/doc -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 +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 # C++ binding is useless on w64 because of ABI -for f in *class.h ; do \ +for f in *class.h +do rm ${ZIP_DIR}/include/hamlib/${f} done -for f in AUTHORS ChangeLog COPYING COPYING.LIB LICENSE README README.betatester README.w64-bin THANKS ; do \ - cp -a ${f} ${ZIP_DIR}/${f}.txt ; todos ${ZIP_DIR}/${f}.txt +for f in AUTHORS ChangeLog COPYING COPYING.LIB LICENSE README README.betatester README.w64-bin THANKS +do + cp -a ${f} ${ZIP_DIR}/${f}.txt + todos ${ZIP_DIR}/${f}.txt done # Generate HTML documents from nroff formatted man files -for f in doc/man1/*.1 doc/man7/*.7 ; do \ +for f in doc/man1/*.1 doc/man7/*.7 +do /usr/bin/groff -mandoc -Thtml >${f}.html ${f} - cp -a ${f}.html ${ZIP_DIR}/doc/. ; done + cp -a ${f}.html ${ZIP_DIR}/doc/. +done cd ${BUILD_DIR}/$1 # Copy build files into specific locations for Zip file -for f in *.exe ; do \ +for f in *.exe +do cp -a ${INST_DIR}/bin/${f} ${ZIP_DIR}/bin/. done @@ -269,13 +273,15 @@ cp -a ${LIBUSB_1_0_BIN_PATH}/MinGW64/dll/libusb-1.0.dll ${ZIP_DIR}/bin/libusb-1. # Required for MinGW with GCC 6.3 (Debian 9) FILE="/usr/lib/gcc/i686-w64-mingw32/6.3-posix/libgcc_s_sjlj-1.dll" -if test -f "$FILE"; then +if test -f "$FILE" +then cp -a ${FILE} ${ZIP_DIR}/bin/. fi # Required for MinGW with GCC 8.3 (Debian 10) FILE="/usr/lib/gcc/i686-w64-mingw32/8.3-posix/libgcc_s_sjlj-1.dll" -if test -f "$FILE"; then +if test -f "$FILE" +then cp -a ${FILE} ${ZIP_DIR}/bin/. fi