Difference between revisions of "MythTV on Mac OSX build"

From MythTV Official Wiki
Jump to: navigation, search
(Obtaining the packager)
(25 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
{{Merge|Building_MythTV_on_Mac_OS_X}}
 
{{Merge|Building_MythTV_on_Mac_OS_X}}
  
== Building Automatically ==
+
{{outdated}}
 +
 
 +
{{Note box|osx-package.pl is broken for both Mythtv v31 and OSX Catalina 10.15.}}
  
== Help Required ==
 
This page needs to be updated with instructions on how to build the mythtv backend.
 
  
Can you help?
+
== Building Automatically ==
 +
So you've decided that you want to compile Myth on your Mac under OS X.  Normally, the easiest way to do that is to download the packager script, ''osx-packager-qtsdk.pl''. Running the packager script then downloads several pre-requisites and the MythTV source, and builds the prerequisites and MythTV application bundles.  However, you must also have the XCode development environment installed on your Mac before you begin.
  
 
=== Pre-requisites ===
 
=== Pre-requisites ===
 
In order to run the build you will need the following:
 
In order to run the build you will need the following:
 +
* Xcode for your OS X release
 
* MythTV packager
 
* MythTV packager
* Xcode for your OS X release
+
* Firewire SDK (optional)
* Firewire SDK (optionally)
 
* pkg-config
 
 
* internet connection
 
* internet connection
  
==== Obtaining Xcode and Firewire SKD ====
 
Xcode and the Firewire SDK are both available from the [http://connect.apple.com apple developer] site.
 
  
You will need to register as an apple developer.
 
  
Select the 'Safari' option as its free :D
+
==== Xcode and Firewire SDK ====
 +
 
 +
XCode is essential since it installs the compiler, linker and other support utilities. 
 +
 
 +
Xcode and the Firewire SDK are both available from the [http://connect.apple.com apple developer] site. You will need to register as an apple developer.  Select the 'Safari' option as its free :D
  
=== Obtaining pkg-config ===
+
The Firewire SDK is needed if you a) intend to build the backend, and b) want the backend to be able to record from a firewire device.
  
* Help - is pkg-config actually a requirement? The build complains when its missing but I'm not certain if its actually a requirement.
+
===== git =====
 +
XCode comes with ''git'' for source code management.  You will use this program to get source code for building.
  
The easiest way to obtain pkg-config is to first install [http://www.macports.org MacPorts] and then use MacPorts to install pkg-config
+
==== yasm ====
run:
+
Several critical pieces of Myth code are written in X86 assembler, using yasm, to obtain maximum performance.  XCode, however, does not include yasm.  Myth also provides alternate code so that yasm is not strictly necessary. However, things like the on screen display may be sluggish without it.
<pre>sudo port install pkgconfig</pre>
 
  
The package script downloads and builds all the dependencies, and if you are lucky gives you several double-clickable applications.
+
Yasm can be downloaded from http://www.tortall.net/projects/yasm/wiki/Download
 +
Unpack it, configure it with the defaults and install it.
  
==== Obtaining the packager ====
+
=== osx-packager-qtsdk.pl ===
 
The easiest way to build MythTV from source is to download the packager script. The packager scripts downloads the source and builds the release.
 
The easiest way to build MythTV from source is to download the packager script. The packager scripts downloads the source and builds the release.
  
 +
You likely need to obtain the correct packager for your release, though MythTV tries to maintain a degree of backward compatibility.
  
You need to obtain the correct packager for your release.
+
 
 +
==== Using git  to obtain the automatic build script ====
 
   
 
   
 
'''Stable release (recommended)'''
 
'''Stable release (recommended)'''
Either http://svn.mythtv.org/svn/tags/release-0-23-1/packaging/OSX/build/osx-packager.pl
+
git clone -b OSX-fixes git://github.com/MythTV/packaging.git
  
or
+
'''Development release'''
 +
git clone git://github.com/MythTV/packaging.git
  
'''Development release'''
+
Make a copy of ''osx-packager-qtsdk.pl'' in the directory you want to be the top-level for your build.  Make the script executable, as follows:
http://svn.mythtv.org/svn/trunk/packaging/OSX/build/osx-packager.pl
+
<pre> chmod +x osx-packager-qtsdk.pl</pre>
  
e.g:
+
If you run the script with either the ''-help'' or ''-man'' options, it will give a summary of the usage options.
<pre>wget http://svn.mythtv.org/svn/tags/release-0-23-1/packaging/OSX/build/osx-packager.pl</pre>
+
<pre>osx-packager-qtsdk.pl -help</pre>
  
Note: for 10.6.x you need to edit the osx-package.pl file and do a search for 10.6 and follow the instructions.
+
=== Building ===
 +
Once you have obtained all of the pre-requisites you are ready to build. There are several command line options to the ''osx-packager-qtsdk.pl'' script that control exactly what all will be built.
  
 +
==== Selecting a version to build ====
 +
The MythTV developers use github, (formerly subversion) to manage the source code. There are three main subdivisions to consider:
 +
*master (formerly trunk)
 +
*tags
 +
*branches
  
You can view a complete set of the releases available at [http://svn.mythtv.org/svn/tags/ MythTV svn]
+
Use the ''git-rev'' option to select the version to build.  For example
 +
<pre>-gitrev fixes/0.26</pre>
  
Note: on my macmini the build took about three hours.
+
==== Plugins ====
 +
Use the script's <code>-plugins</code> option to specify the plugins you want to include.  Use <code>-pluginskip</code> to supress building any plugins.
  
=== Building ===
+
For example
Once you have obtained all of the pre-requisites you are ready to build.
+
<pre>-plugins mythbrowser,mythgallery,mythmusic,mythnews,mythvideo,mythweather,opengl,exif,new-exif</pre>
  
Building a release tag (recommended):
+
Currently, the following plugins won't work on Mac OS X:
<pre>./osx-packager.pl -svntag release-0-23-1</pre>
+
*MythGame - no compatible games
 +
*MythNetVision - not currently ported to Myth for Mac OS.
  
Building a branch:
+
===== Plugin pre-requisites =====
<pre>./osx-packager.pl -svnbranch release-0-23-1</pre>
+
MythGallery requires exif and/or new-exif if you want to be able to see information related to camera settings that may be embedded in your pictures.  The opengl option must be enabled if you want to have transition effects shown between pictures in a slide show. The script should have downloaded and built this code but you have to enable it, eg:
  
Building the trunk (if you are prepared to bleed):
+
<pre>-plugins mythgallery,opengl,exif,new-exif</pre>
<pre>./osx-packager.pl</pre>
 
  
You should end up with two application MythFrontend.app and MythAVTest.app
+
MythWeather requires Myth's Perl bindings.  The Perl bindings, in turn, rely on certain perl modules that are not present by default.  All the required perl modules can be obtained from the Comprehensive Perl Archive Network (CPAN).  Read up on <code>cpan</code> to learn how to install these modules.  (Hint: run <code>cpan</code> as the super user, i.e. <code>sudo cpan Module::Name</code>.)
  
==== Selecting a version to build ====
+
==== Putting it all together ====
The MythTV developers use subversion to manage the source code. There are three main areas (folders) in subversion:
+
The other relevant options are ''-verbose'' and ''-enable-backend''.  The -verbose option will report a great deal of detail about the build which can be very helpful if there is a failure.  If you want the backend as well, use the ''-enable-backend'' flag. Use ''-enable-jobtools'' to build an application that will process jobs (eg commercial flagging) from the backend's job queue.
*trunk
 
*tags
 
*branches
 
  
==== For developing Myth TV ====
+
<pre>osx-packager-qtsdk.pl -gitrev fixes/0.26 -enable-backend -enable-jobtools -plugins  mythbrowser,mythgallery,mythmusic,mythnews,mythvideo,mythweather,opengl,exif,new-exif-m32 -verbose</pre>
Trunk is where the latest code is being developed. The trunk is likely to be highly unstable and may not always build. The trunk should is normally only used by developers actively involved in MythTV development.
 
  
==== To use a stable version of Myth TV ====
+
Assuming all goes well, you should end up with at least three applications ready to test.
Each time the developers create a release of MythTV they create a tag in the 'tags' folder of subversion. The tag represents a 'point in time' version of the source code which doesn't change over time.
 
  
If you are looking to build a version of Myth TV for your own use then you will want to build a version from the 'tags' folder.
+
==== Approximate Build Times  ====
  
==== To get bug fixes for your release which haven't been formally released ====
+
* Mac Mini: 3 hours
Branches
+
* Mac Pro: 45 minutes
  
Branches are generally created for two reasons 1) work on a new feature which isn't ready to be merged into the main trunk. 2) creating small fixes to a previous release.
+
(This does not include download times)
  
=== Contribute the build to the community ===
+
== Contribute the build to the community ==
 
Now you have a build and as I'm sure your mum always said 'you need to share' ;).
 
Now you have a build and as I'm sure your mum always said 'you need to share' ;).
  
You can help the community by contributing your build to the sourceforge project MythTV for MacOSX which has been set up to host release build of MythTV for the Mac OSX.
+
You can help the community by contributing your build to the sourceforge project MythTV for MacOSX which has been set up to host release build of MythTV for the Mac OSX.  If you do this, please make sure your build has FireWire support.
  
 
You can find details on how to contribute your build on the [http://www.mythtv.org/wiki/Release_Build_Contributors_Page contributors] page.
 
You can find details on how to contribute your build on the [http://www.mythtv.org/wiki/Release_Build_Contributors_Page contributors] page.
Line 99: Line 107:
 
== Building Manually ==
 
== Building Manually ==
  
Sadly, the packager script doesn't always work. Maybe one of the downloadable dependencies has been outdated, and someone needs to try building against a newer one. Maybe the MythTV source code has changed and broken Mac builds. Look on the [[Myth_on_Mac_-_Build_status]] page for hints about this.  For instructions about building by hand, see [[Building MythTV on Mac OS X]]
+
Sadly, the packager script doesn't always work. Maybe one of the downloadable dependencies has been outdated, and someone needs to try building against a newer one. Maybe the MythTV source code has changed and broken Mac builds. Look on the [[Myth_on_Mac_-_Build_status]] page for hints about this.  Examining the build script output and the script itself may help.  You may also set environment variables and build components yourself in the <code>.osx-packager/src</code> subdirectory of your build directory.
 +
 
 +
=== Rebuilding ===
 +
 
 +
To obtain a completely clean environment for a new build, you must delete all the prerequisite builds.  The simplest way is to delete the build directory, using
 +
 
 +
    rm -rf .osx-packager
 +
 
 +
 
 +
This will delete all source code downloads and build output.  Of course, it also means you will have to redownload all the prerequisites.  More commonly, you just want a completely clean build using the existing downloads.  This can be forced with
 +
 
 +
====== bash ======
 +
    rm -rf .osx-packager/build osx-packager/src/*/
  
If you just want to watch TV on your Mac, and you aren't planning to do development, you're better off using a prebuilt binary.
+
====== zsh ======
 +
    rm -rf .osx-packager/build osx-packager/src/*(/)
  
 +
(This should probably be added as an option to the packaging script)
  
 
[[Category:MacOS]]
 
[[Category:MacOS]]

Revision as of 12:28, 16 May 2020

Merge-arrows.gif
It has been suggested that this article or section be merged with Building_MythTV_on_Mac_OS_X. (Discuss)


Time.png Outdated: The information on this page may no longer be relevant to the current release of MythTV, 34.0. Please consider helping to update it. This page was last modified on 2020-05-16.


Important.png Note: osx-package.pl is broken for both Mythtv v31 and OSX Catalina 10.15.


Building Automatically

So you've decided that you want to compile Myth on your Mac under OS X. Normally, the easiest way to do that is to download the packager script, osx-packager-qtsdk.pl. Running the packager script then downloads several pre-requisites and the MythTV source, and builds the prerequisites and MythTV application bundles. However, you must also have the XCode development environment installed on your Mac before you begin.

Pre-requisites

In order to run the build you will need the following:

  • Xcode for your OS X release
  • MythTV packager
  • Firewire SDK (optional)
  • internet connection


Xcode and Firewire SDK

XCode is essential since it installs the compiler, linker and other support utilities.

Xcode and the Firewire SDK are both available from the apple developer site. You will need to register as an apple developer. Select the 'Safari' option as its free :D

The Firewire SDK is needed if you a) intend to build the backend, and b) want the backend to be able to record from a firewire device.

git

XCode comes with git for source code management. You will use this program to get source code for building.

yasm

Several critical pieces of Myth code are written in X86 assembler, using yasm, to obtain maximum performance. XCode, however, does not include yasm. Myth also provides alternate code so that yasm is not strictly necessary. However, things like the on screen display may be sluggish without it.

Yasm can be downloaded from http://www.tortall.net/projects/yasm/wiki/Download Unpack it, configure it with the defaults and install it.

osx-packager-qtsdk.pl

The easiest way to build MythTV from source is to download the packager script. The packager scripts downloads the source and builds the release.

You likely need to obtain the correct packager for your release, though MythTV tries to maintain a degree of backward compatibility.


Using git to obtain the automatic build script

Stable release (recommended)

git clone -b OSX-fixes git://github.com/MythTV/packaging.git

Development release

git clone git://github.com/MythTV/packaging.git

Make a copy of osx-packager-qtsdk.pl in the directory you want to be the top-level for your build. Make the script executable, as follows:

 chmod +x osx-packager-qtsdk.pl

If you run the script with either the -help or -man options, it will give a summary of the usage options.

osx-packager-qtsdk.pl -help

Building

Once you have obtained all of the pre-requisites you are ready to build. There are several command line options to the osx-packager-qtsdk.pl script that control exactly what all will be built.

Selecting a version to build

The MythTV developers use github, (formerly subversion) to manage the source code. There are three main subdivisions to consider:

  • master (formerly trunk)
  • tags
  • branches

Use the git-rev option to select the version to build. For example

-gitrev fixes/0.26

Plugins

Use the script's -plugins option to specify the plugins you want to include. Use -pluginskip to supress building any plugins.

For example

-plugins mythbrowser,mythgallery,mythmusic,mythnews,mythvideo,mythweather,opengl,exif,new-exif

Currently, the following plugins won't work on Mac OS X:

  • MythGame - no compatible games
  • MythNetVision - not currently ported to Myth for Mac OS.
Plugin pre-requisites

MythGallery requires exif and/or new-exif if you want to be able to see information related to camera settings that may be embedded in your pictures. The opengl option must be enabled if you want to have transition effects shown between pictures in a slide show. The script should have downloaded and built this code but you have to enable it, eg:

-plugins mythgallery,opengl,exif,new-exif

MythWeather requires Myth's Perl bindings. The Perl bindings, in turn, rely on certain perl modules that are not present by default. All the required perl modules can be obtained from the Comprehensive Perl Archive Network (CPAN). Read up on cpan to learn how to install these modules. (Hint: run cpan as the super user, i.e. sudo cpan Module::Name.)

Putting it all together

The other relevant options are -verbose and -enable-backend. The -verbose option will report a great deal of detail about the build which can be very helpful if there is a failure. If you want the backend as well, use the -enable-backend flag. Use -enable-jobtools to build an application that will process jobs (eg commercial flagging) from the backend's job queue.

osx-packager-qtsdk.pl -gitrev fixes/0.26 -enable-backend -enable-jobtools -plugins  mythbrowser,mythgallery,mythmusic,mythnews,mythvideo,mythweather,opengl,exif,new-exif-m32 -verbose

Assuming all goes well, you should end up with at least three applications ready to test.

Approximate Build Times

  • Mac Mini: 3 hours
  • Mac Pro: 45 minutes

(This does not include download times)

Contribute the build to the community

Now you have a build and as I'm sure your mum always said 'you need to share' ;).

You can help the community by contributing your build to the sourceforge project MythTV for MacOSX which has been set up to host release build of MythTV for the Mac OSX. If you do this, please make sure your build has FireWire support.

You can find details on how to contribute your build on the contributors page.

Building Manually

Sadly, the packager script doesn't always work. Maybe one of the downloadable dependencies has been outdated, and someone needs to try building against a newer one. Maybe the MythTV source code has changed and broken Mac builds. Look on the Myth_on_Mac_-_Build_status page for hints about this. Examining the build script output and the script itself may help. You may also set environment variables and build components yourself in the .osx-packager/src subdirectory of your build directory.

Rebuilding

To obtain a completely clean environment for a new build, you must delete all the prerequisite builds. The simplest way is to delete the build directory, using

   rm -rf .osx-packager


This will delete all source code downloads and build output. Of course, it also means you will have to redownload all the prerequisites. More commonly, you just want a completely clean build using the existing downloads. This can be forced with

bash
   rm -rf .osx-packager/build osx-packager/src/*/
zsh
   rm -rf .osx-packager/build osx-packager/src/*(/)

(This should probably be added as an option to the packaging script)