Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have you thought about making a homebrew cask? #118

Open
zellyn opened this issue Aug 17, 2021 · 2 comments
Open

Have you thought about making a homebrew cask? #118

zellyn opened this issue Aug 17, 2021 · 2 comments

Comments

@zellyn
Copy link

zellyn commented Aug 17, 2021

It would be lovely to have a homebrew cask that can install this.

@marcopovitch
Copy link

there is one (currently version 3.9.3.0_4) :

brew install gnuradio

more info at : https://wiki.gnuradio.org/index.php/InstallingGR

@zebrapurring
Copy link

Here's my current approach to create an application based on the Homebrew installation:

#!/bin/sh

set -eu

app_path="${1:-"/Applications/GNURadio.app"}"

FORMULA_NAME="gnuradio"

# Create application directories
mkdir -p "$app_path/Contents/MacOS"
mkdir -p "$app_path/Contents/Resources"

# Download icons
curl -s -o "$app_path/Contents/Resources/gnuradio.icns" "https://raw.githubusercontent.com/ktemkin/gnuradio-for-mac-without-macports/560d51574f876f8a44829ba416737dfa965953b5/gnuradio.icns"

# Link current Homebrew installation
if ! brew list --formula "$FORMULA_NAME" > /dev/null 2>&1; then
    echo "GNURadio installation not found, please install with Homebrew first:" >&2
    echo "$ brew install $FORMULA_NAME" >&2
    exit 1
fi
installed_version="$(brew list --formulae --versions | grep "^$FORMULA_NAME " | cut -d " " -f 2 | cut -d "_" -f 1)"
ln -sf "$(brew --prefix "$FORMULA_NAME")/bin/gnuradio-companion" "$app_path/Contents/MacOS"

# Create application manifest
cat > "$app_path/Contents/Info.plist" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>CFBundleGetInfoString</key>
  <string>GNURadio</string>
  <key>CFBundleExecutable</key>
  <string>gnuradio-companion</string>
  <key>CFBundleIdentifier</key>
  <string>org.gnuradio.gnuradio-companion</string>
  <key>CFBundleName</key>
  <string>GNURadio</string>
  <key>CFBundleIconFile</key>
  <string>gnuradio.icns</string>
  <key>CFBundleShortVersionString</key>
  <string>$installed_version</string>
  <key>CFBundleInfoDictionaryVersion</key>
  <string>6.0</string>
  <key>CFBundlePackageType</key>
  <string>APPL</string>
  <key>CFBundleDocumentTypes</key>
  <array>
    <dict>
      <key>CFBundleTypeExtensions</key>
      <array>
        <string>grc</string>
        <string>GRC</string>
        <string>grc.xml</string>
        <string>GRC.XML</string>
      </array>
      <key>CFBundleTypeIconFile</key>
      <string>gnuradio.icns</string>
      <key>CFBundleTypeMIMETypes</key>
      <array>
        <string>application/gnuradio-grc</string>
      </array>
      <key>CFBundleTypeName</key>
      <string>GNU Radio Companion Flow Graph</string>
      <key>CFBundleTypeOSTypes</key>
      <array>
        <string>GRC </string>
      </array>
      <key>CFBundleTypeRole</key>
      <string>Editor</string>
      <key>LSIsAppleDefaultForType</key>
      <true />
      <key>LSItemContentTypes</key>
      <array>
        <string>org.gnuradio.grc</string>
      </array>
    </dict>
  </array>
  <key>UTExportedTypeDeclarations</key>
  <array>
    <dict>
      <key>UTTypeConformsTo</key>
      <array>
        <string>public.xml</string>
      </array>
      <key>UTTypeDescription</key>
      <string>GNU Radio Companion Flow Graph</string>
      <key>UTTypeIconFile</key>
      <string>gnuradio.icns</string>
      <key>UTTypeIdentifier</key>
      <string>org.gnuradio.grc</string>
      <key>UTTypeReferenceURL</key>
      <string>http://www.gnuradio.org/</string>
      <key>UTTypeTagSpecification</key>
      <dict>
        <key>com.apple.ostype</key>
        <string>GRC </string>
        <key>public.filename-extension</key>
        <array>
          <string>grc</string>
          <string>GRC</string>
          <string>grc.xml</string>
          <string>GRC.XML</string>
        </array>
        <key>public.mime-type</key>
        <array>
          <string>application/gnuradio-grc</string>
        </array>
      </dict>
    </dict>
  </array>
</dict>
</plist>
EOF

echo "Done! You can now open the new application at $app_path"

If you upgrade GNURadio, you just need to re-run the script to update the version in the manifest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants