Compile macOS using homebrew: Difference between revisions

From Strawberry Music Player Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
Compile on macOS using homebrew
Compile on macOS using homebrew


This guide is currently not maintained and might no longer work.


== Install xcode tools and brew package manager ==
Homebrew is generally unsuitable for building strawberry since its missing several gstreamer plugins, specific macdeployqt patches and specific Qt and gstreamer modifications and patches.


    xcode-select --install
Since Homebrew refuse enable certain gstreamer plugins and have been generally unwilling to accept patches, we can not give support for building strawberry with homebrew. This guide is provided as is, outdated and without any support. If you want access to the Wiki for editing, please e-mail us or contact us on the forum.
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


== Install dependencies through brew ==
If you want support, consider donating for getting access to the official signed binaries of strawberry.


    brew install pkg-config cmake ninja meson bison flex wget create-dmg gettext boost protobuf protobuf-c ccache
    brew install glib glib-openssl glib-utils glib-networking gdk-pixbuf gobject-introspection orc
    brew install libffi openssl gnutls sqlite fftw libmtp libplist libsoup libxml2
    brew install libogg libvorbis flac wavpack opus speex mpg123 lame twolame taglib chromaprint libbs2b libcdio libopenmpt faad2 faac fdk-aac musepack game-music-emu
    brew install qt6


Homebrew is missing several gstreamer plugins, so we build gstreamer from source.
== Install xcode tools and brew package manager ==


     wget https://files.strawberrymusicplayer.org/patches/gstreamer.rb
     xcode-select --install
    wget https://files.strawberrymusicplayer.org/patches/gst-plugins-base.rb
     /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    wget https://files.strawberrymusicplayer.org/patches/gst-plugins-good.rb
     wget https://files.strawberrymusicplayer.org/patches/gst-plugins-bad.rb
    wget https://files.strawberrymusicplayer.org/patches/gst-plugins-ugly.rb
    wget https://files.strawberrymusicplayer.org/patches/gst-libav.rb
    mv gstreamer.rb gst-plugins-{base,good,bad,ugly}.rb gst-libav.rb /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/


    export HOMEBREW_NO_INSTALL_FROM_API=1
== Install dependencies through brew ==
 
    brew install --build-from-source gstreamer
    brew install --build-from-source gst-plugins-base
    brew install --build-from-source gst-plugins-good
    brew install --build-from-source gst-plugins-bad
    brew install --build-from-source gst-plugins-ugly
    brew install --build-from-source gst-libav


    brew install pkg-config cmake ninja meson bison flex wget create-dmg gettext boost protobuf protobuf-c
    brew install glib glib-openssl glib-networking gdk-pixbuf gobject-introspection orc
    brew install libffi openssl sqlite fftw libmtp libplist libxml2 libsoup
    brew install libogg libvorbis flac wavpack opus speex mpg123 lame twolame taglib chromaprint libebur128 libbs2b libcdio libopenmpt faad2 faac fdk-aac musepack game-music-emu
    brew install qt6 gstreamer


== Set environment variables ==
== Set environment variables ==


for Intel x86_64:
     export GIO_EXTRA_MODULES=$(brew --prefix)/lib/gio/modules
 
     export GST_PLUGIN_SCANNER=$(brew --prefix)/opt/gstreamer/libexec/gstreamer-1.0/gst-plugin-scanner
     export GIO_EXTRA_MODULES=/usr/local/lib/gio/modules
     export GST_PLUGIN_PATH=$(brew --prefix)/lib/gstreamer-1.0
     export GST_PLUGIN_SCANNER=/usr/local/opt/gstreamer/libexec/gstreamer-1.0/gst-plugin-scanner
     export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-1.0
 
for Apple Silicon:
 
    export GIO_EXTRA_MODULES=/opt/homebrew/lib/gio/modules
    export GST_PLUGIN_SCANNER=/opt/homebrew/opt/gstreamer/libexec/gstreamer-1.0/gst-plugin-scanner
    export GST_PLUGIN_PATH=/opt/homebrew/lib/gstreamer-1.0


== Prepare build ==
== Prepare build ==
Line 53: Line 33:
     mkdir -p ~/build
     mkdir -p ~/build
     cd ~/build
     cd ~/build
     git clone https://github.com/strawberrymusicplayer/strawberry
     git clone --recursive https://github.com/strawberrymusicplayer/strawberry
     cd strawberry
     cd strawberry
     mkdir build
     mkdir build
Line 62: Line 42:
== Configure build ==
== Configure build ==


for Intel x86_64:
     cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$(brew --prefix)/opt/qt6/lib/cmake -DBUILD_WITH_QT6=ON -DUSE_BUNDLE=ON -DENABLE_SPARKLE=OFF -DICU_ROOT=$(brew --prefix)/opt/icu4c -DPROTOBUF_INCLUDE_DIRS=$(brew --prefix)/include -DENABLE_DBUS=OFF
 
     cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/opt/qt6/lib/cmake -DBUILD_WITH_QT6=ON -DUSE_BUNDLE=ON -DENABLE_SPARKLE=OFF -DICU_ROOT=/usr/local/opt/icu4c -DENABLE_DBUS=OFF -DPROTOBUF_INCLUDE_DIRS=/usr/local/include


for Apple Silicon:
    cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt6/lib/cmake -DBUILD_WITH_QT6=ON -DUSE_BUNDLE=ON -DENABLE_SPARKLE=OFF -DICU_ROOT=/usr/local/opt/icu4c


== Build ==
== Build ==


     make -j$(nproc)
     make -j 4
     make install
     make install


== Remove problematic unneeded plugins ==
== Remove problematic unneeded plugins ==


     sudo rm -rf /usr/local/opt/qt6/share/qt/plugins/virtualkeyboard /usr/local/opt/qt6/share/qt/plugins/platforminputcontexts
     sudo rm -rf $(brew --prefix)/opt/qt6/share/qt/plugins/virtualkeyboard $(brew --prefix)/opt/qt6/share/qt/plugins/platforminputcontexts
     sudo rm -f /usr/local/Cellar/qt/*/share/qt/plugins/imageformats/libqpdf.dylib
     sudo rm -f $(brew --prefix)/Cellar/qt/*/share/qt/plugins/imageformats/libqpdf.dylib


== Manually copy files ==
== Manually copy files ==
Line 85: Line 60:


     mkdir -p strawberry.app/Contents/Frameworks
     mkdir -p strawberry.app/Contents/Frameworks
     cp /usr/local/lib/libsoup-3.0.0.dylib strawberry.app/Contents/Frameworks/
     cp $(brew --prefix)/lib/libsoup-3.0.0.dylib strawberry.app/Contents/Frameworks/


== Deploy ==
== Deploy ==


     make deploy
     make deploy
== Deploy check ==
Checks that all libraries are deployed correctly.
    make deploycheck


== Create DMG ==
== Create DMG ==

Revision as of 23:30, 28 July 2024

Compile on macOS using homebrew

This guide is currently not maintained and might no longer work.

Homebrew is generally unsuitable for building strawberry since its missing several gstreamer plugins, specific macdeployqt patches and specific Qt and gstreamer modifications and patches.

Since Homebrew refuse enable certain gstreamer plugins and have been generally unwilling to accept patches, we can not give support for building strawberry with homebrew. This guide is provided as is, outdated and without any support. If you want access to the Wiki for editing, please e-mail us or contact us on the forum.

If you want support, consider donating for getting access to the official signed binaries of strawberry.


Install xcode tools and brew package manager

   xcode-select --install
   /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install dependencies through brew

   brew install pkg-config cmake ninja meson bison flex wget create-dmg gettext boost protobuf protobuf-c
   brew install glib glib-openssl glib-networking gdk-pixbuf gobject-introspection orc
   brew install libffi openssl sqlite fftw libmtp libplist libxml2 libsoup
   brew install libogg libvorbis flac wavpack opus speex mpg123 lame twolame taglib chromaprint libebur128 libbs2b libcdio libopenmpt faad2 faac fdk-aac musepack game-music-emu
   brew install qt6 gstreamer

Set environment variables

   export GIO_EXTRA_MODULES=$(brew --prefix)/lib/gio/modules
   export GST_PLUGIN_SCANNER=$(brew --prefix)/opt/gstreamer/libexec/gstreamer-1.0/gst-plugin-scanner
   export GST_PLUGIN_PATH=$(brew --prefix)/lib/gstreamer-1.0

Prepare build

   mkdir -p ~/build
   cd ~/build
   git clone --recursive https://github.com/strawberrymusicplayer/strawberry
   cd strawberry
   mkdir build
   cd build

(If you already did `git clone`, do `git pull` to make sure you have the latest code).

Configure build

   cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$(brew --prefix)/opt/qt6/lib/cmake -DBUILD_WITH_QT6=ON -DUSE_BUNDLE=ON -DENABLE_SPARKLE=OFF -DICU_ROOT=$(brew --prefix)/opt/icu4c -DPROTOBUF_INCLUDE_DIRS=$(brew --prefix)/include -DENABLE_DBUS=OFF


Build

   make -j 4
   make install

Remove problematic unneeded plugins

   sudo rm -rf $(brew --prefix)/opt/qt6/share/qt/plugins/virtualkeyboard $(brew --prefix)/opt/qt6/share/qt/plugins/platforminputcontexts
   sudo rm -f $(brew --prefix)/Cellar/qt/*/share/qt/plugins/imageformats/libqpdf.dylib

Manually copy files

You need to manually copy libsoup-3.0.0.dylib, as this library needs to be loaded by gstreamer at runtime:

   mkdir -p strawberry.app/Contents/Frameworks
   cp $(brew --prefix)/lib/libsoup-3.0.0.dylib strawberry.app/Contents/Frameworks/

Deploy

   make deploy

Deploy check

Checks that all libraries are deployed correctly.

   make deploycheck

Create DMG

   make dmg

Install

To install, either open the DMG, drag Strawberry over to Applications, or manually copy the strawberry.app folder over to /Applications/