From: drowe67 Date: Sun, 30 Aug 2015 10:27:14 +0000 (+0000) Subject: Mark, VK5QI, patches for compiling on OSX, Thanks Mark X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=43113ef85371f811c66c176a122169bd617d75f4;p=freetel-svn-tracking.git Mark, VK5QI, patches for compiling on OSX, Thanks Mark git-svn-id: https://svn.code.sf.net/p/freetel/code@2291 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/freedv-dev/README.osx b/freedv-dev/README.osx new file mode 100644 index 00000000..52dc2f56 --- /dev/null +++ b/freedv-dev/README.osx @@ -0,0 +1,112 @@ +Building under OSX is similar to building under linux, but there are some additional steps that need to be performed to produce a working app-bundle. + +For the following instructions, I'm assuming you will be placing everything in: +/Users//Dev/ + +1/ DEPENDENCIES +Using Macports, most of the appropriate dependencies can be installed by: + +$ sudo port install subversion git libtool libsamplerate sox portaudio dylibbundler cmake + +It should be fairly similar using HomeBrew, but you will need to replace all the /opt/ paths in the following instructions. + +1.1/ HAMLIB +First, we will need to build hamlib from source, as we need hamlib to be statically compiled (Macports won't do this..) + +$ git clone git://git.code.sf.net/p/hamlib/code hamlib-code +$ cd hamlib-code + +You will now need to edit line 12 of autogen.sh, to change "libtoolize" to "glibtoolize" + +$ ./autogen.sh +$ ./configure --disable-shared --prefix /Users//Dev/hamlib +$ make +$ make install + +You should now have an installation of hamlib in ~/Dev/hamlib + +Just in case you have hamlib installed via Macports, it may be a good idea to run +$ sudo port deactivate hamlib + +1.2/ WXWIDGETS +To be able to produce an appbundle, we need wxWidgets to be build statically. Again, Macports won't do this out of the box. + +Edit the wxWidgets-3.0 port file using: +$ sudo port edit wxWidgets-3.0 + +and add the following to the bottom of the file: + +variant static description { build a static version of the libraries with some other options... } { + configure.args-append --enable-std_iostreams + configure.args-append --disable-shared + configure.args-delete --with-sdl + configure.args-delete --with-opengl + set installtype release-static +} + +Now you can build and install a static variant of wxWidgets with: +$ sudo port install wxWidgets-3.0 +static + +Note: This will probably break anything else which is using wxWidgets. Once you have finished building FreeDV, you may +want to go back to the dynamically compiled version using: +$ sudo port install wxWidgets-3.0 + +HomeBrew Users: Anyone know how to do the above? + +1.3/ CODEC2 LIBRARIES +The FreeDV CMake procedure will automatically checkout and compile Codec2. +If you want to build and install your own copy (i.e. for access to the command-line tools), you can do so: + +$ wget http://files.freedv.org/codec2/codec2-0.4.tar.gz +or +$ svn checkout https://svn.code.sf.net/p/freetel/code/codec2-dev/ + +$ cd codec2-0.4 +or +cd codec2-dev +$ mkdir build_osx && cd build_osx +$ cmake ../ && make +$ sudo make install + +3/ BUILDING FREEDV +Get the FreeDV source by either: + +Getting the current 'stable' release (1.0): +$ wget http://files.freedv.org/freedv/freedv-1.0.tar.gz +$ tar -xzf freedv-1.0.tar.gz + +or + +Checking the latest revision out from SVN: +$ svn checkout https://svn.code.sf.net/p/freetel/code/freedv-dev/ + +$ cd freedv-1.0 +or +$ cd freedv-dev + +At the moment we will need to apply a few patches: + +patch src/dlg_ptt.cpp dlg_ptt_OSX.patch +patch src/CMakeLists.txt cmake_OSX.patch + +$ mkdir build_osx && cd build_osx + +Assuming you are intending on building Codec2 as part of the build process, run: + +$ cmake -DWXCONFIG=/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/lib/wx/config/osx_cocoa-unicode-static-3.0 -DCMAKE_EXE_LINKER_FLAGS="-L/opt/local/lib" -DHAMLIB_INCLUDE_DIR=../../hamlib/include -DHAMLIB_LIBRARY=../../hamlib/lib/libhamlib.a ../ + +Then, build FreeDV: +$ make + +The build process will create an appbundle (FreeDV.app) and a compressed disk image (FreeDV.dmg) in ./build_osx/src +Move these to wherever you want, and run! + +Happy DVing! + +Acknowledgements: +A big thank you to Mooneer Salem, K6AQ, for walking me through this process, and figuring out how to solve the wxWidgets and Hamlib issues. + +Please e-mail any corrections to either the digitalvoice google group list, or myself, at: +vk5qi(at)rfhead.net +Mark Jessop VK5QI + diff --git a/freedv-dev/README.txt b/freedv-dev/README.txt index c844400c..4dd42094 100644 --- a/freedv-dev/README.txt +++ b/freedv-dev/README.txt @@ -2,19 +2,24 @@ Building and installing on Linux ================================== +To build codec2, the build-essential and cmake packages will be required. +If they are not already installed, you can install them by typing + + $ sudo apt-get install build-essential cmake + Quickstart 1 ----------- Builds static versions of wxWidgets, portaudio, codec2-dev, which are commonly missing on many Linux systems, or of the wrong (older) version. -1/ Assuming the fdmdv2-dev source is checked out into ~/fdmdv2-dev: +1/ Assuming the freedv-dev source is checked out into ~/freedv-dev: - $ sudo apt-get install libgtk2.0-dev libhamlib-dev libsamplerate-dev libasound2-dev libao-dev libgsm1-dev - $ cd fdmdv2-dev + $ sudo apt-get install libgtk2.0-dev libhamlib-dev libsamplerate-dev libasound2-dev libao-dev libgsm1-dev libsndfile-dev + $ cd freedv-dev $ mkdir build_linux $ cd build_linux - $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE ~/fdmdv2-dev + $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE ~/freedv-dev ../ $ make 2/ Then you can configure FreeDV using your local codec-dev, something like: @@ -35,7 +40,7 @@ Quickstart 2 1/ Assuming you have all the dependant libraries: - $ cd /path/to/fdmdv2 + $ cd /path/to/freedv $ mkdir build_linux $ cd build_linux $ cmake ../ (defaults to /usr/local, use CMAKE_INSTALL_PREFIX to override) @@ -61,7 +66,7 @@ Quickstart 2 4/ Build WxWidgets - $ cd /path/to/fdmdv2-dev + $ cd /path/to/freedv-dev $ mkdir build_windows $ cd build_windows $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE .. -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-Ubuntu-mingw32.cmake -DCMAKE_BUILD_TYPE=Debug @@ -82,7 +87,7 @@ Quickstart 2 ==================================== The windows build is similar to linux and follows the same basic workflow, -however, while codec2 and FreeDV (fdmdv2) build well on windows, some of the +however, while codec2 and FreeDV (freedv) build well on windows, some of the dependencies do not. For that reson current windows releases are cross-compiled from linux. @@ -114,7 +119,7 @@ NOTE: This forces "USE_STATIC_WXWIDGETS" to be true internally regarless of the value set manually. (from any directory, but empty directory outside of the source is prefered.) -$ cmake -DBOOTSTRAP_WXWIDGETS=TRUE /path/to/fdmdv2 +$ cmake -DBOOTSTRAP_WXWIDGETS=TRUE /path/to/freedv $ make (wxWidgets is downloaded and built) $ cmake . diff --git a/freedv-dev/src/CMakeLists.txt b/freedv-dev/src/CMakeLists.txt index 56e6255b..01f39750 100644 --- a/freedv-dev/src/CMakeLists.txt +++ b/freedv-dev/src/CMakeLists.txt @@ -42,3 +42,22 @@ if(FREEDV_STATIC_DEPS) endif(FREEDV_STATIC_DEPS) install(TARGETS freedv RUNTIME DESTINATION bin) + +# Custom commands to build OSX images. +if(APPLE) + add_custom_command( + TARGET freedv + POST_BUILD + COMMAND mkdir ARGS -p FreeDV.app/Contents/MacOS + COMMAND mkdir ARGS -p FreeDV.app/Contents/Resources/English.lproj + COMMAND cp ARGS ${CMAKE_CURRENT_SOURCE_DIR}/info.plist FreeDV.app/Contents + COMMAND cp ARGS ${CMAKE_CURRENT_SOURCE_DIR}/freedv.icns FreeDV.app/Contents/Resources + COMMAND echo ARGS -n "APPL????" > FreeDV.app/Contents/PkgInfo + COMMAND cp ARGS freedv FreeDV.app/Contents/MacOS/FreeDV + COMMAND dylibbundler ARGS -od -b -x FreeDV.app/Contents/MacOS/FreeDV -d FreeDV.app/Contents/libs -p @executable_path/../libs/ + COMMAND mkdir dist_tmp + COMMAND cp -r FreeDV.app dist_tmp + COMMAND hdiutil create -srcfolder dist_tmp/ -volname FreeDV -format UDZO ./FreeDV.dmg + COMMAND rm -rf dist_tmp + ) +endif(APPLE) diff --git a/freedv-dev/src/dlg_ptt.cpp b/freedv-dev/src/dlg_ptt.cpp index 2643c1d6..7c9d5d47 100644 --- a/freedv-dev/src/dlg_ptt.cpp +++ b/freedv-dev/src/dlg_ptt.cpp @@ -25,7 +25,7 @@ #ifdef __WIN32__ #include #endif -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__WXOSX__) #include #include #endif @@ -105,7 +105,7 @@ ComPortsDlg::ComPortsDlg(wxWindow* parent, wxWindowID id, const wxString& title, staticBoxSizer31->Add(m_listCtrlPorts, 1, wxALIGN_CENTER, 0); #endif -#ifdef __WXGTK__ +#if defined(__WXOSX__) || defined(__WXGTK__) wxBoxSizer* bSizer83; bSizer83 = new wxBoxSizer(wxHORIZONTAL); @@ -257,12 +257,16 @@ void ComPortsDlg::populatePortList() m_listCtrlPorts->Append(aStr); m_cbSerialPort->Append(aStr); #endif -#ifdef __WXGTK__ +#if defined(__WXGTK__) || defined(__WXOSX__) m_cbSerialPort->Clear(); m_cbCtlDevicePath->Clear(); -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__WXOSX__) glob_t gl; +#ifdef __FreeBSD__ if(glob("/dev/tty*", GLOB_MARK, NULL, &gl)==0) { +#else + if(glob("/dev/tty.*", GLOB_MARK, NULL, &gl)==0) { +#endif for(unsigned int i=0; iAppend(gl.gl_pathv[i]); m_cbCtlDevicePath->Append(gl.gl_pathv[i]); @@ -323,7 +329,7 @@ void ComPortsDlg::ExchangeData(int inout) #ifdef __WXMSW__ m_listCtrlPorts->SetStringSelection(str); #endif -#ifdef __WXGTK__ +#if defined(__WXOSX__) || defined(__WXGTK__) m_cbCtlDevicePath->SetValue(str); #endif m_rbUseRTS->SetValue(wxGetApp().m_boolUseRTS); @@ -354,7 +360,7 @@ void ComPortsDlg::ExchangeData(int inout) #ifdef __WXMSW__ wxGetApp().m_strRigCtrlPort = m_listCtrlPorts->GetStringSelection(); #endif -#ifdef __WXGTK__ +#if defined(__WXGTK__) || defined(__WXOSX__) wxGetApp().m_strRigCtrlPort = m_cbCtlDevicePath->GetValue(); #endif wxGetApp().m_boolUseRTS = m_rbUseRTS->GetValue(); diff --git a/freedv-dev/src/freedv.icns b/freedv-dev/src/freedv.icns new file mode 100644 index 00000000..5190e795 Binary files /dev/null and b/freedv-dev/src/freedv.icns differ diff --git a/freedv-dev/src/info.plist b/freedv-dev/src/info.plist new file mode 100644 index 00000000..8f0d4c34 --- /dev/null +++ b/freedv-dev/src/info.plist @@ -0,0 +1,104 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + freedv + CFBundleIconFile + + CFBundleIdentifier + org.freedv.freedv + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + FreeDV + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + 10.5 + NSHumanReadableCopyright + Copyright © 2012 FreeDV. All rights reserved. + + CFBundleIconFile + freedv + NSPrincipalClass + NSApplication + + + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + freedv + CFBundleIconFile + + CFBundleIdentifier + org.freedv.freedv + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + FreeDV + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + 10.5 + NSHumanReadableCopyright + Copyright © 2012 FreeDV. All rights reserved. + + NSPrincipalClass + NSApplication + + + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + freedv + CFBundleIconFile + + CFBundleIdentifier + org.freedv.freedv + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + FreeDV + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + 10.5 + NSHumanReadableCopyright + Copyright © 2012 FreeDV. All rights reserved. + + NSPrincipalClass + NSApplication + + \ No newline at end of file