#!/bin/bash # Builds Hamlib 3.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. # # See README.build-win32 for complete details. # Set this to a desired directory BUILD_DIR=~/builds # Set this to LibUSB archive extracted in $BUILD_DIR LIBUSB_VER=libusb-1.0.20 # uncomment the correct HOST_ARCH= line for your minGW installation HOST_ARCH=i686-w64-mingw32 # Set to the strip name for your version of minGW HOST_ARCH_STRIP=i686-w64-mingw32-strip # Error return codes. See /usr/include/sysexits.h EX_USAGE=64 EX_NOINPUT=66 # Pass name of Hamlib archive extracted in $BUILD_DIR if [ $# -ne 1 ]; then echo -e "\nUsage: `basename $0` hamlib-version\n" echo -e "See README.build-win32 for more information.\n" exit ${EX_USAGE} fi # Make sure the Hamlib archive is where we expect if [ -d ${BUILD_DIR}/$1 ]; then echo -e "\nBuilding W32 binaries in ${BUILD_DIR}/$1\n\n" cd ${BUILD_DIR}/$1 else echo -e "\nBuild directory, ${BUILD_DIR}/$1 not found!\nCheck path for $1 or correct the version number.\n" exit ${EX_NOINPUT} fi RELEASE=`/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[3\./ {print $2;exit}' ./configure.ac` HL_FILENAME=hamlib-w32-${RELEASE} INST_DIR=`pwd`/mingw32-inst ZIP_DIR=`pwd`/${HL_FILENAME} LIBUSB_1_0_BIN_PATH=${BUILD_DIR}/${LIBUSB_VER} # Create W32 specific README.w32-bin file cat > README.w32-bin < Radio model 120, or Yaesu FT-817 (use 'rigctl -l' for a list) -r -> Radio device, in this case COM1 -v -> Verbosity level. For testing four or five v characters are required. Five 'v's set a debug level of TRACE which generates a lot of screen output showing communication to the radio and values of important variables. These traces are vital information for Hamlib rig backend development. To run rigctl or rotctl open a cmd window (Start|Run|enter 'cmd' in the dialog). If text scrolls off the screen, you can scroll back with the mouse. 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 (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). All feedback is welcome to the mail address below. 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. Information for w32 Programmers ================================= There is a .LIB import library for MS-VC++ in lib/msvc. Simply #include (add directory to include path), include the .LIB in your project and you are done. Note: MS-VC++ cannot compile all the Hamlib code, but the API defined by rig.h has been made MSVC friendly :-) As the source code for the library DLLs is licensed under the LGPL, your 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 your choosing. The published Hamlib API may be found at: http://hamlib.sourceforge.net/manuals/3.0.1/index.html Thank You! ========== Patches, feedback, and contributions are welcome. Please report problems or success to hamlib-developer@lists.sourceforge.net Cheers, Stephane Fillod - F8CFE Nate Bargmann - N0NB http://www.hamlib.org END_OF_README # Configure and build hamlib for mingw32, with libusb-win32 ./configure --host=${HOST_ARCH} \ --prefix=${INST_DIR} \ --without-cxx-binding \ --disable-static \ CPPFLAGS="-I${LIBUSB_1_0_BIN_PATH}/include" \ LDFLAGS="-L${LIBUSB_1_0_BIN_PATH}/MinGW32/dll" make 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-2.def; todos ${ZIP_DIR}/lib/msvc/libhamlib-2.def cp -a ${INST_DIR}/include/hamlib ${ZIP_DIR}/include/.; todos ${ZIP_DIR}/include/hamlib/*.h cp -a doc/Hamlib_design.png ${ZIP_DIR}/doc cp -a doc/hamlib.html ${ZIP_DIR}/doc # C++ binding is useless on w32 because of ABI rm ${ZIP_DIR}/include/hamlib/{rig,rot}class.h 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; do \ /usr/bin/groff -mandoc -Thtml >${f}.html ${f} cp -a ${f}.html ${ZIP_DIR}/doc/. ; done cd ${BUILD_DIR}/$1 # Copy build files into specific locations for Zip file cp -a ${INST_DIR}/bin/{rigctld.exe,rigctl.exe,rigmem.exe,rigsmtr.exe,rigswr.exe,rotctld.exe,rotctl.exe} ${ZIP_DIR}/bin/. cp -a ${INST_DIR}/bin/libhamlib-?.dll ${ZIP_DIR}/bin/. cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc/. # 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/. cp -a ${LIBUSB_1_0_BIN_PATH}/MinGW32/dll/libusb-1.0.dll ${ZIP_DIR}/bin/libusb-1.0.dll # Required for MinGW with GCC 4.9 cp -a /usr/lib/gcc/i686-w64-mingw32/4.9-posix/libgcc_s_sjlj-1.dll ${ZIP_DIR}/bin/libgcc_s_sjlj-1.dll ## Need VC++ free toolkit installed (default Wine directory installation shown) ( cd ${ZIP_DIR}/lib/msvc/ && wine ~/.wine/drive_c/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003/bin/link.exe /lib /machine:i386 /def:libhamlib-2.def ) /usr/bin/zip -r ${HL_FILENAME}.zip `basename ${ZIP_DIR}`