Mark, VK5QI, patches for compiling on OSX, Thanks Mark
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 30 Aug 2015 10:27:14 +0000 (10:27 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 30 Aug 2015 10:27:14 +0000 (10:27 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2291 01035d8c-6547-0410-b346-abe4f91aad63

freedv-dev/README.osx [new file with mode: 0644]
freedv-dev/README.txt
freedv-dev/src/CMakeLists.txt
freedv-dev/src/dlg_ptt.cpp
freedv-dev/src/freedv.icns [new file with mode: 0644]
freedv-dev/src/info.plist [new file with mode: 0644]

diff --git a/freedv-dev/README.osx b/freedv-dev/README.osx
new file mode 100644 (file)
index 0000000..52dc2f5
--- /dev/null
@@ -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/<yourusername>/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/<your-username-here>/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
+
index c844400cd0f190f3be9081d14a32cdfc2ab31743..4dd420948a0e36372e1511ef6f2c4fc723d33e1f 100644 (file)
@@ -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 .
index 56e6255bc728e045836ba80f22b18ab7d0b2aecf..01f39750a38fc1fa4f0ed54ccc811cbb779043a4 100644 (file)
@@ -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)
index 2643c1d6474f7057bddebf612bacb4bc6eabffc8..7c9d5d4756b6e12cb0bacb761151fee50458023c 100644 (file)
@@ -25,7 +25,7 @@
 #ifdef __WIN32__
 #include <wx/msw/registry.h>
 #endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__WXOSX__)
 #include <glob.h>
 #include <string.h>
 #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; i<gl.gl_pathc; i++) {
                        if(gl.gl_pathv[i][strlen(gl.gl_pathv[i])-1]=='/')
                                continue;
@@ -278,8 +282,10 @@ void ComPortsDlg::populatePortList()
                                continue;
 
                        /* Exclude initial-state and lock-state devices */
+#ifndef __WXOSX__
                        if(strchr(gl.gl_pathv[i], '.') != NULL)
                                continue;
+#endif
 
                        m_cbSerialPort->Append(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 (file)
index 0000000..5190e79
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 (file)
index 0000000..8f0d4c3
--- /dev/null
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>en</string>
+       <key>CFBundleExecutable</key>
+       <string>freedv</string>
+       <key>CFBundleIconFile</key>
+       <string></string>
+       <key>CFBundleIdentifier</key>
+       <string>org.freedv.freedv</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleName</key>
+       <string>FreeDV</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleShortVersionString</key>
+       <string>1.0</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>1</string>
+       <key>LSMinimumSystemVersion</key>
+       <string>10.5</string>
+       <key>NSHumanReadableCopyright</key>
+       <string>Copyright © 2012 FreeDV. All rights reserved.</string>
+       <!--<key>NSMainNibFile</key>
+       <string>MainMenu</string>-->
+       <key>CFBundleIconFile</key>
+       <string>freedv</string>
+       <key>NSPrincipalClass</key>
+       <string>NSApplication</string>
+</dict>
+</plist>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>en</string>
+       <key>CFBundleExecutable</key>
+       <string>freedv</string>
+       <key>CFBundleIconFile</key>
+       <string></string>
+       <key>CFBundleIdentifier</key>
+       <string>org.freedv.freedv</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleName</key>
+       <string>FreeDV</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleShortVersionString</key>
+       <string>1.0</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>1</string>
+       <key>LSMinimumSystemVersion</key>
+       <string>10.5</string>
+       <key>NSHumanReadableCopyright</key>
+       <string>Copyright © 2012 FreeDV. All rights reserved.</string>
+       <!--<key>NSMainNibFile</key>
+       <string>MainMenu</string>-->
+       <key>NSPrincipalClass</key>
+       <string>NSApplication</string>
+</dict>
+</plist>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>en</string>
+       <key>CFBundleExecutable</key>
+       <string>freedv</string>
+       <key>CFBundleIconFile</key>
+       <string></string>
+       <key>CFBundleIdentifier</key>
+       <string>org.freedv.freedv</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleName</key>
+       <string>FreeDV</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleShortVersionString</key>
+       <string>1.0</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>1</string>
+       <key>LSMinimumSystemVersion</key>
+       <string>10.5</string>
+       <key>NSHumanReadableCopyright</key>
+       <string>Copyright © 2012 FreeDV. All rights reserved.</string>
+       <!--<key>NSMainNibFile</key>
+       <string>MainMenu</string>-->
+       <key>NSPrincipalClass</key>
+       <string>NSApplication</string>
+</dict>
+</plist>
\ No newline at end of file