Hamlib  4.3
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
Cross-compiling Hamlib on Linux for MS Windows

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.

README.build-Windows

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

The build-w32.sh script

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

The build-w64.sh script

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