Skip to content

Instantly share code, notes, and snippets.

@Rotron
Forked from sigsergv/building gqrx with brew.md
Created February 10, 2019 23:01
Show Gist options
  • Save Rotron/312616805a8397fea6f4f0fa315e1f8c to your computer and use it in GitHub Desktop.
Save Rotron/312616805a8397fea6f4f0fa315e1f8c to your computer and use it in GitHub Desktop.

Revisions

  1. @sigsergv sigsergv revised this gist Nov 15, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -127,7 +127,7 @@ Now convert `gqrx.dmg` to a redistributable package, first step:
    Before the next step you need to get script `fix-deps.py`, it's in the same gist below, or you can just download it using this commands:

    ```
    curl -L -o fix-deps.py https://gist.github.com/sigsergv/82925dc88e351078d42b/raw/11c483920d633ddc652320918e31d78dcf88111e/fix-deps.py
    curl -L -o fix-deps.py https://gist.github.com/sigsergv/82925dc88e351078d42b/raw/e3b69c3710730ecd27e8bfb144fa44f954afa8bb/fix-deps.py
    chmod +x fix-deps.py
    ```

  2. @sigsergv sigsergv revised this gist Nov 15, 2015. 2 changed files with 20 additions and 4 deletions.
    21 changes: 18 additions & 3 deletions building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -118,10 +118,25 @@ Now create file `gqrx.app/Contents/Info.plist` with the following content:
    </plist>
    ```

    And create redistributable file `gqrx.dmg`:
    Now convert `gqrx.dmg` to a redistributable package, first step:

    ```
    ~/Qt/5.5/clang_64/bin/macdeployqt gqrx.app -dmg -verbose=3 2> macdeployqt.log
    ~/Qt/5.5/clang_64/bin/macdeployqt gqrx.app -verbose=3 2> macdeployqt.log
    ```

    At the end you should get file `gqrx.dmg` that contains redistributable version of gqrx.app.
    Before the next step you need to get script `fix-deps.py`, it's in the same gist below, or you can just download it using this commands:

    ```
    curl -L -o fix-deps.py https://gist.github.com/sigsergv/82925dc88e351078d42b/raw/11c483920d633ddc652320918e31d78dcf88111e/fix-deps.py
    chmod +x fix-deps.py
    ```

    Execute it (in the durectory `~/gqrx-osx/build`!):

    ```
    ./fix-deps.py
    ```

    You should see a few lines of text followed by text `Finished!`, if you don't see `Finished!` then something gone wrong.

    At the end you should get file `gqrx.app` that doesn't contain any non-system external dependencies.
    3 changes: 2 additions & 1 deletion fix-deps.py
    Original file line number Diff line number Diff line change
    @@ -73,4 +73,5 @@ def iteration(pass_num):

    for x in range(30):
    if iteration(x+1) == 0:
    break
    print 'Finished!'
    break
  3. @sigsergv sigsergv revised this gist Nov 15, 2015. 1 changed file with 76 additions and 0 deletions.
    76 changes: 76 additions & 0 deletions fix-deps.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,76 @@
    #!/usr/bin/python

    import os
    import subprocess
    import re
    import shutil
    from pprint import pprint as pp

    OTR_RE = re.compile('^\t([^ ]+) (.+)')
    SPLIT = re.compile('[\n\r]+')
    LP_RE = re.compile('@loader_path/(.+)$')
    FPREFIX = 'gqrx.app/Contents/Frameworks/'
    LIB_PATHS = ['/usr/local/opt/boost/lib/']

    lib_deps = {}

    def iteration(pass_num):
    print '\nFixing dependencied, pass: {0}'.format(pass_num)
    for root, dirs, files in os.walk(FPREFIX):
    for fn in files:
    if not fn.endswith('.dylib'):
    continue
    lib_path = os.path.join(root, fn)

    deps = []

    output = subprocess.check_output(['otool', '-L', lib_path])
    for line in SPLIT.split(output):
    mo = OTR_RE.match(line)
    if mo is None:
    continue

    d = mo.group(1)

    if d.startswith('/System/') or d.startswith('/usr/lib') or d.startswith('@executable_path'):
    continue

    deps.append(d)

    lib_deps[lib_path.replace(FPREFIX, '')] = deps

    counter = 0

    for lib_name, deps in lib_deps.iteritems():
    for d in deps:
    mo = LP_RE.match(d)
    if mo is None:
    continue

    counter += 1

    lib = mo.group(1)
    new_fn = os.path.join(FPREFIX, lib)
    missing = lib_deps.get(lib, None) is None
    if missing:
    print 'Library `{0}` is missing, trying to fix'.format(lib)
    for p in LIB_PATHS:
    fn = os.path.join(p, lib)
    if os.path.exists(fn):
    print ' found {0}, copy to {1}'.format(fn, new_fn)
    shutil.copy(fn, new_fn)
    os.chmod(new_fn, 0o644)

    # fix ID
    cmd = ['install_name_tool', '-id', '@executable_path/../Frameworks/{0}'.format(lib), new_fn]
    subprocess.check_output(cmd)
    else:
    print 'File `{0}`: referense to shared library broken: `{1}`, trying to fix'.format(os.path.join(FPREFIX, lib_name), lib)
    cmd = ['install_name_tool', '-change', '@loader_path/{0}'.format(lib), '@executable_path/../Frameworks/{0}'.format(lib), \
    os.path.join(FPREFIX, lib_name)]
    subprocess.check_output(cmd)
    return counter

    for x in range(30):
    if iteration(x+1) == 0:
    break
  4. @sigsergv sigsergv revised this gist Nov 15, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -31,6 +31,7 @@ Install Qt 5.5 Opensource:

    I have checked Qt version 5.3 and I think any 5.* version will do, btw.

    Also make sure that you don't have qt installed via homebrew, it will break build and introduce weird compile errors.

    ### cmake

  5. @sigsergv sigsergv revised this gist Nov 15, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -120,7 +120,7 @@ Now create file `gqrx.app/Contents/Info.plist` with the following content:
    And create redistributable file `gqrx.dmg`:

    ```
    ~/Qt/5.5/clang_64/bin/macdeployqt gqrx.app -dmg
    ~/Qt/5.5/clang_64/bin/macdeployqt gqrx.app -dmg -verbose=3 2> macdeployqt.log
    ```

    At the end you should get file `gqrx.dmg` that contains redistributable version of gqrx.app.
  6. @sigsergv sigsergv revised this gist Nov 15, 2015. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -23,13 +23,13 @@ Actually you need just Command Line Tools, you can find that dmg package here: h

    ### Qt5

    Install Qt 5.3 Opensource:
    Install Qt 5.5 Opensource:

    * go to [official page](http://www.qt.io/download-open-source/);
    * click “Download Now” button and download .dmg package;
    * open and install Qt 5.3 into `$HOME/Qt`
    * open and install Qt 5.5 into `$HOME/Qt`

    I have not checked other Qt versions, btw.
    I have checked Qt version 5.3 and I think any 5.* version will do, btw.


    ### cmake
    @@ -65,7 +65,7 @@ cd ~/gqrx-osx
    git clone https://github.com/csete/gqrx.git
    mkdir build
    cd build
    export Qt5_DIR=~/Qt/5.3/clang_64/lib/cmake/Qt5
    export Qt5_DIR=~/Qt/5.5/clang_64/lib/cmake/Qt5
    cmake ../gqrx
    make
    ```
    @@ -120,7 +120,7 @@ Now create file `gqrx.app/Contents/Info.plist` with the following content:
    And create redistributable file `gqrx.dmg`:

    ```
    ~/Qt/5.3/clang_64/bin/macdeployqt gqrx.app -dmg
    ~/Qt/5.5/clang_64/bin/macdeployqt gqrx.app -dmg
    ```

    At the end you should get file `gqrx.dmg` that contains redistributable version of gqrx.app.
  7. @sigsergv sigsergv revised this gist Nov 15, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ Install [using instructions](http://brew.sh) from official homebrew site.

    https://developer.apple.com/xcode/download/

    Actually you need Command Line Tools only, you can find that dmg package here: https://developer.apple.com/downloads/ (apple id required).
    Actually you need just Command Line Tools, you can find that dmg package here: https://developer.apple.com/downloads/ (apple id required).


    ### Qt5
  8. @sigsergv sigsergv revised this gist Nov 15, 2015. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,13 @@ Didn't check other versions.

    Install [using instructions](http://brew.sh) from official homebrew site.

    ### Install XCode

    https://developer.apple.com/xcode/download/

    Actually you need Command Line Tools only, you can find that dmg package here: https://developer.apple.com/downloads/ (apple id required).


    ### Qt5

    Install Qt 5.3 Opensource:
  9. @sigsergv sigsergv revised this gist Nov 14, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -46,6 +46,8 @@ If you have troubles here try to install Cheetah manually:
    pip install Cheetah
    ```

    Thanks to https://github.com/chleggett/homebrew-gqrx .

    ## Compiling gqrx

    Download gqrx itself:
  10. @sigsergv sigsergv revised this gist Nov 14, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -94,7 +94,7 @@ Now create file `gqrx.app/Contents/Info.plist` with the following content:
    <string>APPL</string>

    <key>CFBundleGetInfoString</key>
    <string>Created by Qt/QMake</string>
    <string>Created by Qt/CMake</string>

    <key>CFBundleSignature</key>
    <string>????</string>
    @@ -108,6 +108,8 @@ Now create file `gqrx.app/Contents/Info.plist` with the following content:
    </plist>
    ```

    And create redistributable file `gqrx.dmg`:

    ```
    ~/Qt/5.3/clang_64/bin/macdeployqt gqrx.app -dmg
    ```
  11. @sigsergv sigsergv revised this gist Nov 14, 2015. 1 changed file with 36 additions and 1 deletion.
    37 changes: 36 additions & 1 deletion building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -69,11 +69,46 @@ At this moment you have compiled working version of gqrx in the directory `src`,

    If you want standalone .app file without any external dependencies, execute this magic:


    ```
    mkdir -p gqrx.app/Contents/MacOS gqrx.app/Contents/Resources
    echo 'APPL????' > gqrx.app/Contents/Resources/PkgInfo
    echo 'APPL????' > gqrx.app/Contents/PkgInfo
    cp ../gqrx/resources/icons/gqrx.icns gqrx.app/Contents/Resources
    cp src/gqrx gqrx.app/Contents/MacOS
    ```

    Now create file `gqrx.app/Contents/Info.plist` with the following content:

    ```xml
    <?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>NSPrincipalClass</key>
    <string>NSApplication</string>

    <key>CFBundleIconFile</key>
    <string>gqrx.icns</string>

    <key>CFBundlePackageType</key>
    <string>APPL</string>

    <key>CFBundleGetInfoString</key>
    <string>Created by Qt/QMake</string>

    <key>CFBundleSignature</key>
    <string>????</string>

    <key>CFBundleExecutable</key>
    <string>gqrx</string>

    <key>CFBundleIdentifier</key>
    <string>dk.gqrx</string>
    </dict>
    </plist>
    ```

    ```
    ~/Qt/5.3/clang_64/bin/macdeployqt gqrx.app -dmg
    ```

  12. @sigsergv sigsergv revised this gist Nov 14, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -75,4 +75,6 @@ echo 'APPL????' > gqrx.app/Contents/Resources/PkgInfo
    cp ../gqrx/resources/icons/gqrx.icns gqrx.app/Contents/Resources
    cp src/gqrx gqrx.app/Contents/MacOS
    ~/Qt/5.3/clang_64/bin/macdeployqt gqrx.app -dmg
    ```
    ```

    At the end you should get file `gqrx.dmg` that contains redistributable version of gqrx.app.
  13. @sigsergv sigsergv revised this gist Nov 14, 2015. 2 changed files with 7 additions and 1 deletion.
    7 changes: 7 additions & 0 deletions building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -69,3 +69,10 @@ At this moment you have compiled working version of gqrx in the directory `src`,

    If you want standalone .app file without any external dependencies, execute this magic:

    ```
    mkdir -p gqrx.app/Contents/MacOS gqrx.app/Contents/Resources
    echo 'APPL????' > gqrx.app/Contents/Resources/PkgInfo
    cp ../gqrx/resources/icons/gqrx.icns gqrx.app/Contents/Resources
    cp src/gqrx gqrx.app/Contents/MacOS
    ~/Qt/5.3/clang_64/bin/macdeployqt gqrx.app -dmg
    ```
    1 change: 0 additions & 1 deletion sdfsd.txt
    Original file line number Diff line number Diff line change
    @@ -1 +0,0 @@
    sdfsdfsdf
  14. @sigsergv sigsergv revised this gist Nov 14, 2015. 2 changed files with 21 additions and 3 deletions.
    23 changes: 20 additions & 3 deletions building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ Install Qt 5.3 Opensource:

    * go to [official page](http://www.qt.io/download-open-source/);
    * click “Download Now” button and download .dmg package;
    * open and install Qt 5.3
    * open and install Qt 5.3 into `$HOME/Qt`

    I have not checked other Qt versions, btw.

    @@ -40,7 +40,13 @@ brew tap chleggett/gr-osmosdr
    brew install gr-osmosdr
    ```

    ### gqrx
    If you have troubles here try to install Cheetah manually:

    ```
    pip install Cheetah
    ```

    ## Compiling gqrx

    Download gqrx itself:

    @@ -50,5 +56,16 @@ cd ~/gqrx-osx
    git clone https://github.com/csete/gqrx.git
    mkdir build
    cd build
    export Qt5_DIR=~/Qt/5.3/clang_64/lib/cmake/Qt5
    cmake ../gqrx
    ```
    make
    ```

    At this moment you have compiled working version of gqrx in the directory `src`, you can start it from the terminal:

    ```
    ./src/gqrx
    ```

    If you want standalone .app file without any external dependencies, execute this magic:

    1 change: 1 addition & 0 deletions sdfsd.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    sdfsdfsdf
  15. @sigsergv sigsergv revised this gist Nov 14, 2015. 1 changed file with 42 additions and 1 deletion.
    43 changes: 42 additions & 1 deletion building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -4,10 +4,51 @@ This document describes how to compile GQRX using native OSX Qt 5 and libraries

    ## Requierements

    Skip any part if you have corresponding component already installed.

    ### Mac OS X 10.10 Yosemite

    Didn't check other versions.

    ### homebrew

    Install [using instructions](http://brew.sh) from official homebrew site.

    ### Qt5

    Install
    Install Qt 5.3 Opensource:

    * go to [official page](http://www.qt.io/download-open-source/);
    * click “Download Now” button and download .dmg package;
    * open and install Qt 5.3

    I have not checked other Qt versions, btw.


    ### cmake

    ```
    brew install cmake
    ```

    ### osmosdr

    Open terminal and execute the following commands:

    ```
    brew tap chleggett/gr-osmosdr
    brew install gr-osmosdr
    ```

    ### gqrx

    Download gqrx itself:

    ```
    mkdir ~/gqrx-osx
    cd ~/gqrx-osx
    git clone https://github.com/csete/gqrx.git
    mkdir build
    cd build
    cmake ../gqrx
    ```
  16. @sigsergv sigsergv revised this gist Nov 14, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -4,5 +4,10 @@ This document describes how to compile GQRX using native OSX Qt 5 and libraries

    ## Requierements

    ### homebrew

    Install [using instructions](http://brew.sh) from official homebrew site.

    ### Qt5

    Install
  17. @sigsergv sigsergv revised this gist Nov 14, 2015. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,8 @@
    ## Overview

    This document describes how to compile GQRX using native OSX Qt 5 and libraries from brew.
    This document describes how to compile GQRX using native OSX Qt 5 and libraries from brew.

    ## Requierements

    ### Qt5

  18. @sigsergv sigsergv created this gist Nov 14, 2015.
    3 changes: 3 additions & 0 deletions building gqrx with brew.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    ## Overview

    This document describes how to compile GQRX using native OSX Qt 5 and libraries from brew.