Hamlib  4.2
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

1 #!/bin/sh
2 
3 # Builds Hamlib 4.x W32 binary distribution.
4 
5 # A script to build a set of W32 binary DLLs and executables from a Hamlib
6 # source tarball. This script assumes that the Hamlib source tarball has been
7 # extracted to the directory specified in $BUILD_DIR and that libusb-1.x.y has
8 # also been extracted to $BUILD_DIR.
9 
10 # See README.build-Windows for complete details.
11 
12 
13 # Set this to a desired directory
14 BUILD_DIR=~/builds
15 
16 # Set this to LibUSB archive extracted in $BUILD_DIR
17 LIBUSB_VER=libusb-1.0.22
18 
19 # Set to the correct HOST_ARCH= line for your minGW installation
20 HOST_ARCH=i686-w64-mingw32
21 
22 # Set to the strip name for your version of minGW
23 HOST_ARCH_STRIP=i686-w64-mingw32-strip
24 
25 # Error return codes. See /usr/include/sysexits.h
26 EX_USAGE=64
27 EX_NOINPUT=66
28 
29 
30 # Pass name of Hamlib archive extracted in $BUILD_DIR
31 if test $# -ne 1
32 then
33  echo
34  echo "Usage: $(basename $0) hamlib-version"
35  echo "See README.build-Windows for more information."
36  echo
37 
38  exit ${EX_USAGE}
39 fi
40 
41 # Make sure the Hamlib archive is where we expect
42 if test -d ${BUILD_DIR}/$1
43 then
44  echo
45  echo "Building W32 binaries in ${BUILD_DIR}/$1"
46  echo
47 
48  cd ${BUILD_DIR}/$1
49 else
50  echo
51  echo "Build directory, ${BUILD_DIR}/$1 not found!"
52  echo "Check path for $1 or correct the version number."
53  echo
54 
55  exit ${EX_NOINPUT}
56 fi
57 
58 RELEASE=$(/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[4\./ {print $2;exit}' ./configure.ac)
59 HL_FILENAME=hamlib-w32-${RELEASE}
60 INST_DIR=$(pwd)/mingw32-inst
61 ZIP_DIR=$(pwd)/${HL_FILENAME}
62 LIBUSB_1_0_BIN_PATH=${BUILD_DIR}/${LIBUSB_VER}
63 
64 
65 # Create W32 specific README.w32-bin file
66 cat > README.w32-bin <<END_OF_README
67 What is it?
68 ===========
69 
70 This ZIP archive or Windows installer contains a build of Hamlib-$RELEASE
71 cross-compiled for MS Windows 32 bit using MinGW under Debian GNU/Linux 10
72 (nice, heh!).
73 
74 This software is copyrighted. The library license is LGPL, and the *.EXE files
75 licenses are GPL. Hamlib comes WITHOUT ANY WARRANTY. See the LICENSE.txt,
76 COPYING.txt, and COPYING.LIB.txt files.
77 
78 Supporting documentation in the form of Unix manual pages have also been
79 included after being converted to HTML.
80 
81 
82 Installation and Configuration
83 ==============================
84 
85 Extract the ZIP archive into a convenient location, C:\Program Files is a
86 reasonable choice.
87 
88 Make sure *all* the .DLL files are in your PATH (leave them in the bin
89 directory and set the PATH). To set the PATH environment variable in Windows
90 2000, Windows XP, and Windows 7 (need info on Vista and Windows 8/10) do the
91 following:
92 
93  * W2k/XP: Right-click on "My Computer"
94  Win7: Right-click on "Computer"
95 
96  * W2k/XP: Click the "Advanced" tab of the "System Properties" dialog
97  Win7: Click the "Advanced system settings" link in the System dialog
98 
99  * 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})

The build-w64.sh script

1 #!/bin/sh
2 
3 # Builds Hamlib 4.x W64 binary distribution.
4 
5 # A script to build a set of W64 binary DLLs and executables from a Hamlib
6 # source tarball. This script assumes that the Hamlib source tarball has been
7 # extracted to the directory specified in $BUILD_DIR and that libusb-1.x.y has
8 # also been extracted to $BUILD_DIR.
9 
10 # See README.build-Windows for complete details.
11 
12 
13 # Set this to a desired directory
14 BUILD_DIR=~/builds
15 
16 # Set this to LibUSB archive extracted in $BUILD_DIR
17 LIBUSB_VER=libusb-1.0.22
18 
19 # Set to the correct HOST_ARCH= line for your minGW installation
20 HOST_ARCH=x86_64-w64-mingw32
21 
22 # Set to the strip name for your version of minGW
23 HOST_ARCH_STRIP=x86_64-w64-mingw32-strip
24 
25 # Error return codes. See /usr/include/sysexits.h
26 EX_USAGE=64
27 EX_NOINPUT=66
28 
29 
30 # Pass name of Hamlib archive extracted in $BUILD_DIR
31 if test $# -ne 1
32 then
33  echo
34  echo "Usage: $(basename $0) hamlib-version"
35  echo "See README.build-Windows for more information."
36  echo
37 
38  exit ${EX_USAGE}
39 fi
40 
41 # Make sure the Hamlib archive is where we expect
42 if test -d ${BUILD_DIR}/$1
43 then
44  echo
45  echo "Building W64 binaries in ${BUILD_DIR}/$1"
46  echo
47 
48  cd ${BUILD_DIR}/$1
49 else
50  echo
51  echo "Build directory, ${BUILD_DIR}/$1 not found!"
52  echo "Check path for $1 or correct the version number."
53  echo
54 
55  exit ${EX_NOINPUT}
56 fi
57 
58 RELEASE=$(/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[4\./ {print $2;exit}' ./configure.ac)
59 HL_FILENAME=hamlib-w64-${RELEASE}
60 INST_DIR=$(pwd)/mingw64-inst
61 ZIP_DIR=$(pwd)/${HL_FILENAME}
62 LIBUSB_1_0_BIN_PATH=${BUILD_DIR}/${LIBUSB_VER}
63 
64 
65 # Create W64 specific README.w64-bin file
66 cat > README.w64-bin <<END_OF_README
67 What is it?
68 ===========
69 
70 This ZIP archive or Windows installer contains a build of Hamlib-$RELEASE
71 cross-compiled for MS Windows 64 bit using MinGW under Debian GNU/Linux 10
72 (nice, heh!).
73 
74 This software is copyrighted. The library license is LGPL, and the *.EXE files
75 licenses are GPL. Hamlib comes WITHOUT ANY WARRANTY. See the LICENSE.txt,
76 COPYING.txt, and COPYING.LIB.txt files.
77 
78 Supporting documentation in the form of Unix manual pages have also been
79 included after being converted to HTML.
80 
81 
82 Installation and Configuration
83 ==============================
84 
85 Extract the ZIP archive into a convenient location, C:\Program Files is a
86 reasonable choice.
87 
88 Make sure *all* the .DLL files are in your PATH (leave them in the bin
89 directory and set the PATH). To set the PATH environment variable in Windows
90 2000, Windows XP, and Windows 7 (need info on Vista and Windows 8/10) do the
91 following:
92 
93  * W2k/XP: Right-click on "My Computer"
94  Win7: Right-click on "Computer"
95 
96  * W2k/XP: Click the "Advanced" tab of the "System Properties" dialog
97  Win7: Click the "Advanced system settings" link in the System dialog
98 
99  * 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})