![]() |
Hamlib 4.6.3
|
This page contains the scripts/README.build-Windows
instructions and the scripts/build-w32.sh
and scripts/build-w64.h
files that describe cross-compiling Hamlib for MS Windows 32 and 64 bit versions on Debian GNU/Linux.
This file is a HOWTO for the cross-compiling of Windows 32 and 64 bit 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 $HOME/builds for the Windows build and all operations are done from there unless otherwise noted. Under Linux you need at least the following packages: mingw-w64 cross-compiler zip create the archive tofrodos convert to DOS text format (CR/LF) groff convert nroff manual pages to HTML 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. 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/ and unzip the archive in $HOME/builds. 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. 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. Build for Windows 32/64, cross-compile on Linux: ================================================ 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 $HOME/Downloads/hamlib-4.2~git-???????-20210214.tar.gz 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-4.2~git or: $ build-w64.sh hamlib-4.2~git Release Info ============ The structure of the archive is: $ tree -d . |-- bin |-- doc |-- include | `-- hamlib |-- lib |-- gcc `-- msvc 8 directories The bin/ directory is where the executables and DLL files are placed. Header files are under include/Hamlib/ and compiler specific files are under lib/*. HTML documents for the .EXE programs are in doc/ while text documents (READMEs and such) are in the main archive directory. The doc/ directory contains the classic Unix manual pages converted to HTML. The embedded README.w[32|64]-bin.txt file generated by the build-w[32|64].sh script describes setting the PATH environment variable in Windows 2000, Windows XP, and Windows 7. 73, Nate, N0NB
001: #!/bin/sh 002: 003: # Builds Hamlib 4.x W32 binary distribution. 004: 005: # A script to build a set of W32 binary DLLs and executables from a Hamlib 006: # source tarball. This script assumes that the Hamlib source tarball has been 007: # extracted to the directory specified in $BUILD_DIR and that libusb-1.x.y has 008: # also been extracted to $BUILD_DIR. 009: 010: # See README.build-Windows for complete details. 011: 012: 013: # Set this to a desired directory 014: BUILD_DIR=~/builds 015: 016: # Set this to LibUSB archive extracted in $BUILD_DIR 017: LIBUSB_VER=libusb-1.0.24 018: 019: # Set to the correct HOST_ARCH= line for your MinGW installation 020: HOST_ARCH=i686-w64-mingw32 021: 022: # Set to the strip name for your version of MinGW 023: HOST_ARCH_STRIP=i686-w64-mingw32-strip 024: 025: # Set to the dlltool name for your version of MinGW 026: HOST_ARCH_DLLTOOL=i686-w64-mingw32-dlltool 027: 028: # Error return codes. See /usr/include/sysexits.h 029: EX_USAGE=64 030: EX_NOINPUT=66 031: 032: 033: # Pass name of Hamlib archive extracted in $BUILD_DIR 034: if test $# -ne 1 035: then 036: echo 037: echo "Usage: $(basename $0) hamlib-version" 038: echo "See README.build-Windows for more information." 039: echo 040: 041: exit ${EX_USAGE} 042: fi 043: 044: # Make sure the Hamlib archive is where we expect 045: if test -d ${BUILD_DIR}/$1 046: then 047: echo 048: echo "Building W32 binaries in ${BUILD_DIR}/$1" 049: echo 050: 051: cd ${BUILD_DIR}/$1 052: else 053: echo 054: echo "Build directory, ${BUILD_DIR}/$1 not found!" 055: echo "Check path for $1 or correct the version number." 056: echo 057: 058: exit ${EX_NOINPUT} 059: fi 060: 061: RELEASE=$(/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[4\./ {print $2;exit}' ./configure.ac) 062: HL_FILENAME=hamlib-w32-${RELEASE} 063: INST_DIR=$(pwd)/mingw32-inst 064: ZIP_DIR=$(pwd)/${HL_FILENAME} 065: LIBUSB_1_0_BIN_PATH=${BUILD_DIR}/${LIBUSB_VER} 066: 067: 068: # Create W32 specific README.w32-bin file 069: cat > README.w32-bin <<END_OF_README 070: What is it? 071: =========== 072: 073: This ZIP archive or Windows installer contains a build of Hamlib-$RELEASE 074: cross-compiled for MS Windows 32 bit using MinGW under Debian GNU/Linux 10 075: (nice, heh!). 076: 077: This software is copyrighted. The library license is LGPL, and the *.EXE files 078: licenses are GPL. Hamlib comes WITHOUT ANY WARRANTY. See the LICENSE.txt, 079: COPYING.txt, and COPYING.LIB.txt files. 080: 081: Supporting documentation in the form of Unix manual pages have also been 082: included after being converted to HTML. 083: 084: 085: Installation and Configuration 086: ============================== 087: 088: Extract the ZIP archive into a convenient location, C:\Program Files is a 089: reasonable choice. 090: 091: Make sure *all* the .DLL files are in your PATH (leave them in the bin 092: directory and set the PATH). To set the PATH environment variable in Windows 093: 2000, Windows XP, and Windows 7 (need info on Vista and Windows 8/10) do the 094: following: 095: 096: * W2k/XP: Right-click on "My Computer" 097: Win7: Right-click on "Computer" 098: 099: * W2k/XP: Click the "Advanced" tab of the "System Properties" dialog 100: Win7: Click the "Advanced system settings" link in the System dialog 101: 102: * Click the "Environment Variables" button of the pop-up dialog 103: 104: * Select "Path" in the "System variables" box of the "Environment Variables" 105: dialog 106: 107: NB: If you are not the administrator, system policy may not allow editing 108: the path variable. The complete path to an executable file will need to be 109: given to run one of the Hamlib programs. 110: 111: * Click the Edit button 112: 113: * Now add the Hamlib path in the "Variable Value:" edit box. Be sure to put 114: a semi-colon ';' after the last path before adding the Hamlib path (NB. The 115: entire path is highlighted and will be erased upon typing a character so 116: click in the box to unselect the text first. The PATH is important!!) 117: Append the Hamlib path, e.g. C:\Program Files\hamlib-w32-$RELEASE\bin 118: 119: * Click OK for all three dialog boxes to save your changes. 120: 121: 122: Testing with the Hamlib Utilities 123: ================================= 124: 125: To continue, be sure you have read the README.betatester file, especially the 126: "Testing Hamlib" section. The primary means of testing is by way of the 127: rigctl utility for radios, the rotctl utility for rotators and the ampctl 128: utility for amplifiers. Each is a command line program that is interactive 129: or can act on a single command and exit. 130: 131: Documentation for each utility can be found as an HTML file in the doc 132: directory. 133: 134: In short, the command syntax is of the form: 135: 136: rigctl -m 1020 -r COM1 -vvvvv 137: 138: -m -> Radio model 1020, or Yaesu FT-817 (use 'rigctl -l' for a list) 139: -r -> Radio device, in this case COM1 140: -v -> Verbosity level. For testing four or five v characters are required. 141: Five 'v's set a debug level of TRACE which generates a lot of screen 142: output showing communication to the radio and values of important 143: variables. These traces are vital information for Hamlib rig backend 144: development. 145: 146: To run rigctl or rotctl open a cmd window (Start|Run|enter 'cmd' in the 147: dialog). If text scrolls off the screen, you can scroll back with the mouse. 148: To copy output text into a mailer or editor (I recommend Notepad++, a free 149: editor also licensed under the GPL), highlight the text as a rectangle in the 150: cmd window, press <Enter> (or right-click the window icon in the upper left 151: corner and select Edit, then Copy), and paste it into your editor with Ctl-V 152: (or Edit|Paste from the typical GUI menu). 153: 154: All feedback is welcome to the mail address below. 155: 156: 157: Uninstall 158: ========= 159: 160: To uninstall, simply delete the Hamlib directory. You may wish to edit the 161: PATH as above to remove the Hamlib bin path, if desired. 162: 163: 164: Information for w32 Programmers 165: ================================= 166: 167: The DLL has a cdecl interface. 168: 169: There is a libhamlib-4.def definition file for MS Visual C++/Visual Studio in 170: lib/msvc. Refer to the sample commands below to generate a local 171: libhamlib-4.lib file for use with the VC++/VS linker. 172: 173: Simply #include <hamlib/rig.h> (add directory to include path), include 174: libhamlib-4.lib in your project and you are done. Note: VC++/VS cannot 175: compile all the Hamlib code, but the API defined by rig.h has been made MSVC 176: friendly :-) 177: 178: As the source code for the library DLLs is licensed under the LGPL, your 179: program is not considered a "derivative work" when using the published Hamlib 180: API and normal linking to the front-end library, and may be of a license of 181: your choosing. 182: 183: As of 08 Sep 2022 a .lib file is generated using the MinGW dlltool utility. 184: If this file does not work for your project, follow the steps in the following 185: section: 186: 187: For linking the library with MS Visual C++ 2003, from the directory you 188: installed Hamlib run the following commands to generate the libhamlib-4.lib 189: file needed for linking with your MSVC project: 190: 191: cd lib\msvc 192: c:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\link.exe /lib /machine:i386 /def:libhamlib-4.def 193: 194: To do the same for Visual Studio 2017: 195: 196: cd lib\msvc 197: 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 198: 199: For VS 2019: 200: 201: cd lib\msvc 202: 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 203: 204: NOTE: feedback is requested on the previous two command examples! 205: 206: The published Hamlib API may be found at: 207: 208: http://hamlib.sourceforge.net/manuals/4.1/index.html 209: 210: 211: Thank You! 212: ========== 213: 214: Patches, feedback, and contributions are welcome. 215: 216: Please report problems or success to hamlib-developer@lists.sourceforge.net 217: 218: Cheers, 219: Stephane Fillod - F8CFE 220: Mike Black - W9MDB 221: Nate Bargmann - N0NB 222: http://www.hamlib.org 223: 224: END_OF_README 225: 226: 227: # Configure and build hamlib for i686-w64-mingw32, with libusb-1.0 228: 229: ./configure --host=${HOST_ARCH} \ 230: --prefix=${INST_DIR} \ 231: --without-cxx-binding \ 232: --disable-static \ 233: CPPFLAGS="-I${LIBUSB_1_0_BIN_PATH}/include" \ 234: LDFLAGS="-L${LIBUSB_1_0_BIN_PATH}/MinGW32/dll" 235: 236: 237: make -j 4 install 238: 239: mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include ${ZIP_DIR}/doc 240: cp -a src/libhamlib.def ${ZIP_DIR}/lib/msvc/libhamlib-4.def 241: todos ${ZIP_DIR}/lib/msvc/libhamlib-4.def 242: cp -a ${INST_DIR}/include/hamlib ${ZIP_DIR}/include/. 243: todos ${ZIP_DIR}/include/hamlib/*.h 244: 245: # C++ binding is useless on w32 because of ABI 246: for f in *class.h 247: do 248: rm ${ZIP_DIR}/include/hamlib/${f} 249: done 250: 251: for f in AUTHORS ChangeLog COPYING COPYING.LIB LICENSE README.md README.betatester README.w32-bin THANKS 252: do 253: cp -a ${f} ${ZIP_DIR}/${f}.txt 254: todos ${ZIP_DIR}/${f}.txt 255: done 256: 257: # Generate HTML documents from nroff formatted man files 258: for f in doc/man1/*.1 doc/man7/*.7 259: do 260: /usr/bin/groff -mandoc -Thtml >${f}.html ${f} 261: cp -a ${f}.html ${ZIP_DIR}/doc/. 262: done 263: 264: cd ${BUILD_DIR}/$1 265: 266: # Copy build files into specific locations for Zip file 267: for f in *.exe 268: do 269: cp -a ${INST_DIR}/bin/${f} ${ZIP_DIR}/bin/. 270: done 271: 272: cp -a ${INST_DIR}/bin/libhamlib-?.dll ${ZIP_DIR}/bin/. 273: cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc/. 274: 275: # NB: Strip Hamlib DLLs and EXEs 276: ${HOST_ARCH_STRIP} ${ZIP_DIR}/bin/*.exe ${ZIP_DIR}/bin/*hamlib-*.dll 277: 278: # Copy needed third party DLLs 279: cp -a /usr/i686-w64-mingw32/lib/libwinpthread-1.dll ${ZIP_DIR}/bin/. 280: cp -a ${LIBUSB_1_0_BIN_PATH}/MinGW32/dll/libusb-1.0.dll ${ZIP_DIR}/bin/libusb-1.0.dll 281: 282: # Required for MinGW with GCC 6.3 (Debian 9) 283: FILE="/usr/lib/gcc/i686-w64-mingw32/6.3-posix/libgcc_s_sjlj-1.dll" 284: if test -f "$FILE" 285: then 286: cp -a ${FILE} ${ZIP_DIR}/bin/. 287: fi 288: 289: # Required for MinGW with GCC 8.3 (Debian 10) 290: FILE="/usr/lib/gcc/i686-w64-mingw32/8.3-posix/libgcc_s_sjlj-1.dll" 291: if test -f "$FILE" 292: then 293: cp -a ${FILE} ${ZIP_DIR}/bin/. 294: fi 295: 296: # Required for MinGW with GCC 10 (Debian 11) 297: FILE="/usr/lib/gcc/i686-w64-mingw32/10-posix/libgcc_s_dw2-1.dll" 298: if test -f "$FILE" 299: then 300: cp -a ${FILE} ${ZIP_DIR}/bin/. 301: fi 302: 303: # Required for MinGW with GCC 12 (Debian 12) 304: FILE="/usr/lib/gcc/i686-w64-mingw32/12-posix/libgcc_s_dw2-1.dll" 305: if test -f "$FILE" 306: then 307: cp -a ${FILE} ${ZIP_DIR}/bin/. 308: fi 309: 310: # Generate .lib file for MSVC 311: ${HOST_ARCH_DLLTOOL} --input-def ${ZIP_DIR}/lib/msvc/libhamlib-4.def --output-lib ${ZIP_DIR}/lib/msvc/libhamlib-4.lib 312: 313: /usr/bin/zip -r ${HL_FILENAME}.zip $(basename ${ZIP_DIR}) 314:
001: #!/bin/sh 002: 003: # Builds Hamlib 4.x W64 binary distribution. 004: 005: # A script to build a set of W64 binary DLLs and executables from a Hamlib 006: # source tarball. This script assumes that the Hamlib source tarball has been 007: # extracted to the directory specified in $BUILD_DIR and that libusb-1.x.y has 008: # also been extracted to $BUILD_DIR. 009: 010: # See README.build-Windows for complete details. 011: 012: 013: # Set this to a desired directory 014: BUILD_DIR=~/builds 015: 016: # Set this to LibUSB archive extracted in $BUILD_DIR 017: LIBUSB_VER=libusb-1.0.24 018: 019: # Set to the correct HOST_ARCH= line for your MinGW installation 020: HOST_ARCH=x86_64-w64-mingw32 021: 022: # Set to the strip name for your version of MinGW 023: HOST_ARCH_STRIP=x86_64-w64-mingw32-strip 024: 025: # Set to the dlltool name for your version of MinGW 026: HOST_ARCH_DLLTOOL=x86_64-w64-mingw32-dlltool 027: 028: # Error return codes. See /usr/include/sysexits.h 029: EX_USAGE=64 030: EX_NOINPUT=66 031: 032: 033: # Pass name of Hamlib archive extracted in $BUILD_DIR 034: if test $# -ne 1 035: then 036: echo 037: echo "Usage: $(basename $0) hamlib-version" 038: echo "See README.build-Windows for more information." 039: echo 040: 041: exit ${EX_USAGE} 042: fi 043: 044: # Make sure the Hamlib archive is where we expect 045: if test -d ${BUILD_DIR}/$1 046: then 047: echo 048: echo "Building W64 binaries in ${BUILD_DIR}/$1" 049: echo 050: 051: cd ${BUILD_DIR}/$1 052: else 053: echo 054: echo "Build directory, ${BUILD_DIR}/$1 not found!" 055: echo "Check path for $1 or correct the version number." 056: echo 057: 058: exit ${EX_NOINPUT} 059: fi 060: 061: RELEASE=$(/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[4\./ {print $2;exit}' ./configure.ac) 062: HL_FILENAME=hamlib-w64-${RELEASE} 063: INST_DIR=$(pwd)/mingw64-inst 064: ZIP_DIR=$(pwd)/${HL_FILENAME} 065: LIBUSB_1_0_BIN_PATH=${BUILD_DIR}/${LIBUSB_VER} 066: 067: 068: # Create W64 specific README.w64-bin file 069: cat > README.w64-bin <<END_OF_README 070: What is it? 071: =========== 072: 073: This ZIP archive or Windows installer contains a build of Hamlib-$RELEASE 074: cross-compiled for MS Windows 64 bit using MinGW under Debian GNU/Linux 10 075: (nice, heh!). 076: 077: This software is copyrighted. The library license is LGPL, and the *.EXE files 078: licenses are GPL. Hamlib comes WITHOUT ANY WARRANTY. See the LICENSE.txt, 079: COPYING.txt, and COPYING.LIB.txt files. 080: 081: Supporting documentation in the form of Unix manual pages have also been 082: included after being converted to HTML. 083: 084: 085: Installation and Configuration 086: ============================== 087: 088: Extract the ZIP archive into a convenient location, C:\Program Files is a 089: reasonable choice. 090: 091: Make sure *all* the .DLL files are in your PATH (leave them in the bin 092: directory and set the PATH). To set the PATH environment variable in Windows 093: 2000, Windows XP, and Windows 7 (need info on Vista and Windows 8/10) do the 094: following: 095: 096: * W2k/XP: Right-click on "My Computer" 097: Win7: Right-click on "Computer" 098: 099: * W2k/XP: Click the "Advanced" tab of the "System Properties" dialog 100: Win7: Click the "Advanced system settings" link in the System dialog 101: 102: * Click the "Environment Variables" button of the pop-up dialog 103: 104: * Select "Path" in the "System variables" box of the "Environment Variables" 105: dialog 106: 107: NB: If you are not the administrator, system policy may not allow editing 108: the path variable. The complete path to an executable file will need to be 109: given to run one of the Hamlib programs. 110: 111: * Click the Edit button 112: 113: * Now add the Hamlib path in the "Variable Value:" edit box. Be sure to put 114: a semi-colon ';' after the last path before adding the Hamlib path (NB. The 115: entire path is highlighted and will be erased upon typing a character so 116: click in the box to unselect the text first. The PATH is important!!) 117: Append the Hamlib path, e.g. C:\Program Files\hamlib-w64-$RELEASE\bin 118: 119: * Click OK for all three dialog boxes to save your changes. 120: 121: 122: Testing with the Hamlib Utilities 123: ================================= 124: 125: To continue, be sure you have read the README.betatester file, especially the 126: "Testing Hamlib" section. The primary means of testing is by way of the 127: rigctl utility for radios, the rotctl utility for rotators and the ampctl 128: utility for amplifiers. Each is a command line program that is interactive 129: or can act on a single command and exit. 130: 131: Documentation for each utility can be found as an HTML file in the doc 132: directory. 133: 134: In short, the command syntax is of the form: 135: 136: rigctl -m 1020 -r COM1 -vvvvv 137: 138: -m -> Radio model 1020, or Yaesu FT-817 (use 'rigctl -l' for a list) 139: -r -> Radio device, in this case COM1 140: -v -> Verbosity level. For testing four or five v characters are required. 141: Five 'v's set a debug level of TRACE which generates a lot of screen 142: output showing communication to the radio and values of important 143: variables. These traces are vital information for Hamlib rig backend 144: development. 145: 146: To run rigctl or rotctl open a cmd window (Start|Run|enter 'cmd' in the 147: dialog). If text scrolls off the screen, you can scroll back with the mouse. 148: To copy output text into a mailer or editor (I recommend Notepad++, a free 149: editor also licensed under the GPL), highlight the text as a rectangle in the 150: cmd window, press <Enter> (or right-click the window icon in the upper left 151: corner and select Edit, then Copy), and paste it into your editor with Ctl-V 152: (or Edit|Paste from the typical GUI menu). 153: 154: All feedback is welcome to the mail address below. 155: 156: 157: Uninstall 158: ========= 159: 160: To uninstall, simply delete the Hamlib directory. You may wish to edit the 161: PATH as above to remove the Hamlib bin path, if desired. 162: 163: 164: Information for w64 Programmers 165: ================================= 166: 167: The DLL has a cdecl interface. 168: 169: There is a libhamlib-4.def definition file for MS Visual C++/Visual Studio in 170: lib/msvc. Refer to the sample commands below to generate a local 171: libhamlib-4.lib file for use with the VC++/VS linker. 172: 173: Simply #include <hamlib/rig.h> (add directory to include path), include 174: libhamlib-4.lib in your project and you are done. Note: VC++/VS cannot 175: compile all the Hamlib code, but the API defined by rig.h has been made MSVC 176: friendly :-) 177: 178: As the source code for the library DLLs is licensed under the LGPL, your 179: program is not considered a "derivative work" when using the published Hamlib 180: API and normal linking to the front-end library, and may be of a license of 181: your choosing. 182: 183: As of 08 Sep 2022 a .lib file is generated using the MinGW dlltool utility. 184: If this file does not work for your project, follow the steps in the following 185: section: 186: 187: For linking the library with MS Visual C++ 2003, from the directory you 188: installed Hamlib run the following commands to generate the libhamlib-4.lib 189: file needed for linking with your MSVC project: 190: 191: cd lib\msvc 192: c:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\link.exe /lib /machine:amd64 /def:libhamlib-4.def 193: 194: To do the same for Visual Studio 2017: 195: 196: cd lib\msvc 197: c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x86\bin\link.exe /lib /machine:i386 /def:libhamlib-4.def 198: 199: and for VS 2019: 200: 201: cd lib\msvc 202: 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 203: 204: NOTE: feedback is requested on the previous two command examples as these do 205: not appear to be correct to generate a 64 bit libhamlib-4.lib file! 206: 207: For VS 2022: 208: 209: cd lib/msvc 210: c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\Hostx64\x86\lib.exe /lib /machine:i386 /def:libhamlib-4.def 211: 212: The published Hamlib API may be found at: 213: 214: http://hamlib.sourceforge.net/manuals/4.1/index.html 215: 216: 217: Thank You! 218: ========== 219: 220: Patches, feedback, and contributions are welcome. 221: 222: Please report problems or success to hamlib-developer@lists.sourceforge.net 223: 224: Cheers, 225: Stephane Fillod - F8CFE 226: Mike Black - W9MDB 227: Nate Bargmann - N0NB 228: http://www.hamlib.org 229: 230: END_OF_README 231: 232: 233: # Configure and build hamlib for x86_64-w64-mingw32, with libusb-1.0 234: 235: ./configure --host=${HOST_ARCH} \ 236: --prefix=${INST_DIR} \ 237: --without-cxx-binding \ 238: --disable-static \ 239: CPPFLAGS="-I${LIBUSB_1_0_BIN_PATH}/include" \ 240: LDFLAGS="-L${LIBUSB_1_0_BIN_PATH}/MinGW64/dll" 241: 242: 243: make -j 4 install 244: 245: mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include ${ZIP_DIR}/doc 246: cp -a src/libhamlib.def ${ZIP_DIR}/lib/msvc/libhamlib-4.def 247: todos ${ZIP_DIR}/lib/msvc/libhamlib-4.def 248: cp -a ${INST_DIR}/include/hamlib ${ZIP_DIR}/include/. 249: todos ${ZIP_DIR}/include/hamlib/*.h 250: 251: # C++ binding is useless on w64 because of ABI 252: for f in *class.h 253: do 254: rm ${ZIP_DIR}/include/hamlib/${f} 255: done 256: 257: for f in AUTHORS ChangeLog COPYING COPYING.LIB LICENSE README.md README.betatester README.w64-bin THANKS 258: do 259: cp -a ${f} ${ZIP_DIR}/${f}.txt 260: todos ${ZIP_DIR}/${f}.txt 261: done 262: 263: # Generate HTML documents from nroff formatted man files 264: for f in doc/man1/*.1 doc/man7/*.7 265: do 266: /usr/bin/groff -mandoc -Thtml >${f}.html ${f} 267: cp -a ${f}.html ${ZIP_DIR}/doc/. 268: done 269: 270: cd ${BUILD_DIR}/$1 271: 272: # Copy build files into specific locations for Zip file 273: for f in *.exe 274: do 275: cp -a ${INST_DIR}/bin/${f} ${ZIP_DIR}/bin/. 276: done 277: 278: cp -a ${INST_DIR}/bin/libhamlib-?.dll ${ZIP_DIR}/bin/. 279: cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc/. 280: 281: # NB: Strip Hamlib DLLs and EXEs 282: ${HOST_ARCH_STRIP} ${ZIP_DIR}/bin/*.exe ${ZIP_DIR}/bin/*hamlib-*.dll 283: 284: # Copy needed third party DLLs 285: cp -a /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll ${ZIP_DIR}/bin/. 286: cp -a ${LIBUSB_1_0_BIN_PATH}/MinGW64/dll/libusb-1.0.dll ${ZIP_DIR}/bin/libusb-1.0.dll 287: 288: # Required for MinGW with GCC 6.3 (Debian 9) 289: FILE="/usr/lib/gcc/i686-w64-mingw32/6.3-posix/libgcc_s_sjlj-1.dll" 290: if test -f "$FILE" 291: then 292: cp -a ${FILE} ${ZIP_DIR}/bin/. 293: fi 294: 295: # Required for MinGW with GCC 8.3 (Debian 10) 296: FILE="/usr/lib/gcc/i686-w64-mingw32/8.3-posix/libgcc_s_sjlj-1.dll" 297: if test -f "$FILE" 298: then 299: cp -a ${FILE} ${ZIP_DIR}/bin/. 300: fi 301: 302: # Required for MinGW with GCC 10 (Debian 11) 303: FILE="/usr/lib/gcc/i686-w64-mingw32/10-posix/libgcc_s_dw2-1.dll" 304: if test -f "$FILE" 305: then 306: cp -a ${FILE} ${ZIP_DIR}/bin/. 307: fi 308: 309: # Required for MinGW with GCC 12 (Debian 12) 310: FILE="/usr/lib/gcc/i686-w64-mingw32/12-posix/libgcc_s_dw2-1.dll" 311: if test -f "$FILE" 312: then 313: cp -a ${FILE} ${ZIP_DIR}/bin/. 314: fi 315: 316: # Generate .lib file for MSVC 317: ${HOST_ARCH_DLLTOOL} --input-def ${ZIP_DIR}/lib/msvc/libhamlib-4.def --output-lib ${ZIP_DIR}/lib/msvc/libhamlib-4.lib 318: 319: /usr/bin/zip -r ${HL_FILENAME}.zip $(basename ${ZIP_DIR}) 320: