compilingonmac
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
compilingonmac [2012/01/29 02:06] – [Cross-compiling for PPC on i386] glaubitz | compilingonmac [2017/10/01 09:04] (current) – thp | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== CompilingOnMac ====== | ====== CompilingOnMac ====== | ||
- | This explains how to compile libhimd | + | To install the build dependencies, |
- | ===== Prerequisites ===== | + | https:// |
- | ==== First, download and install Apple XCode for your version of MacOS ==== | + | At the moment, the build dependencies can be installed with: |
- | The latest XCode (3.2.5) can be obtained from [[http:// | + | brew update |
+ | brew install --force qt5 mad libid3tag libtag glib libusb libusb-compat libgcrypt | ||
+ | brew link --force qt5 | ||
- | * for MacOS 10.4 the latest version is 2.5: xcode25_8m2558_developerdvd.dmg | ||
- | * for MacOS 10.5 the latest version is 3.1.4: xcode314_2809_developerdvd.dmg | ||
- | * for MacOS 10.6 the latest (free) version is 3.2.6: xcode_3.2.6_and_ios_sdk_4.3_final.dmg | ||
- | * for MacOS 10.7 the latest version is 4.2 and can be downloaded through the Mac App Store | ||
- | |||
- | If you're using MacOS 10.6, you can also buy XCode (4.x) in the Mac App Store (free for 10.7). | ||
- | |||
- | ==== Then, download and install the Qt development libraries and headers for your version of MacOS ==== | ||
- | |||
- | [[http:// | ||
- | |||
- | * On Intel machines, you can simply download the pre-compiled libraries plus the //build and interface tools//. These are sufficient to build QHiMDTransfer. | ||
- | |||
- | * On PPC machines and earlier version of MacOS, you can either download the last pre-compiled version, 4.6.4: [[ftp:// | ||
- | |||
- | ==== Installing Macports ==== | ||
- | |||
- | The last prerequisite is to download and install Macports. | ||
- | |||
- | [[http:// | ||
- | |||
- | After installing macports, make sure that you can run the //port// command. To test this, open a terminal (Applications-> | ||
- | |||
- | < | ||
- | sudo echo "/ | ||
- | </ | ||
- | |||
- | ===== Installing extra packages in Macports ===== | ||
- | |||
- | In the same terminal, type: | ||
- | |||
- | < | ||
- | sudo port install glib2 libmad git-core sox libgcrypt taglib libid3tag libusb-devel | ||
- | </ | ||
- | |||
- | You will need to type your password to authenticate the //sudo//. Please be aware, that the //port// command will take quite an amount of time when you run it the first time since MacPorts has to compile all necessary packages from source. Especially on older PowerPC machines, the compilation of the code can take several hours (around 5 hours on a Mac Mini G4). It's highly recommended to let this step run over night on older machines. | ||
- | |||
- | ==== Building and installing Qt4 through Macports ==== | ||
- | |||
- | To install Qt4 through Macports, type: | ||
- | |||
- | < | ||
- | sudo port install qt4-mac | ||
- | </ | ||
- | |||
- | **NOTE:** //qt4-mac// is a very large package and takes hours to compile. Be prepared to have your computer compile for at least 12~24 hours. Not recommended on machines below 1 GHz. Please consider installing the pre-compiled Qt 4.6.4 binaries in this case (see above). Alternatively, | ||
- | ===== Getting the code ===== | ||
- | |||
- | After the additional ports have been installed in Macports, you'll to fetch the source code from our [[start# | ||
- | |||
- | ===== Building and Running ===== | ||
- | |||
- | There are in principal two different toolchains which can be used to build //libhimd// and // | ||
- | |||
- | ==== Using make ==== | ||
- | |||
- | This variant is very similar to the way the software is build on Linux. It just takes calling //qmake// with special options and then the obligatory //make//: | ||
- | |||
- | < | ||
- | qmake -spec macx-g++ -r | ||
- | make | ||
- | make install | ||
- | </ | ||
- | |||
- | The executable will be called " | ||
- | |||
- | ==== Using XCode ==== | ||
- | |||
- | This method is not recommended as it might cause trouble on MacOS 10.6 (Snow Leopard) with so-called //Jam targets//. Also, you might run into trouble when qmake creates project files for MacOS/i386 on a PPC machine. | ||
- | |||
- | < | ||
- | cd linux-minidisc | ||
- | qmake -r | ||
- | </ | ||
- | |||
- | First, build libhimd: | ||
- | |||
- | < | ||
- | cd libhimd | ||
- | xcodebuild | ||
- | cd .. | ||
- | </ | ||
- | |||
- | Then QHiMDTransfer: | ||
- | |||
- | < | ||
- | cd qhimdtransfer | ||
- | xcodebuild | ||
- | cd .. | ||
- | </ | ||
- | |||
- | To run QHiMDTransfer, | ||
- | ==== Generating translation files ==== | ||
- | |||
- | To generate the translation files for // | ||
- | |||
- | < | ||
- | cd qhimdtransfer | ||
- | make ts | ||
- | </ | ||
- | ==== Deploying the .app file ==== | ||
- | |||
- | The final step of creating the Qt application is the deployment which makes it independent of the build environment (Qt, Macports, XCode) by incorporating all dynamic libraries into the app package. Since Qt provides a command-line utility to perform this step, this involves nothing but invoking it: | ||
- | |||
- | < | ||
- | cd qhimdtransfer | ||
- | macdeployqt QHiMDTransfer.app | ||
- | </ | ||
- | |||
- | ==== Creating the installer .dmg image ==== | ||
- | |||
- | Please see this website for instructions: | ||
- | |||
- | ==== Building Universal Binaries ==== | ||
- | |||
- | To build universal binaries (PPC + i386) or (i386 + x86_64), Macports ports need to be build with the // | ||
- | |||
- | < | ||
- | sudo port install glib2 libmad git-core sox libmcrypt taglib +universal | ||
- | </ | ||
- | |||
- | See: [[https:// | ||
- | |||
- | Then add the additional architecture for the Qt project file, see: | ||
- | |||
- | [[http:// | ||
- | |||
- | meaning, adding either of | ||
- | |||
- | < | ||
- | CONFIG+=x86 x86_x64 ppc | ||
- | </ | ||
- | |||
- | to the project files. | ||
- | |||
- | ===== Cross-compiling for PPC on i386 (on MacOS 10.5) ===== | ||
- | |||
- | It is possible to cross-compile Macports and the MiniDisc software for PPC on an i386 host. This is very convenient as it dramatically speeds up building the software for PPC since the fastest PPC Macs are much slower than current Intel machines. | ||
- | |||
- | First, install XCode and Macports as described above, but do not install Qt as it will be installed through Macports. | ||
- | |||
- | After installing Macports, edit the // | ||
- | |||
- | < | ||
- | build_arch | ||
- | </ | ||
- | |||
- | Then, edit the portfile for libffi to fix a problem with cross-compilation. Type "port edit libffi" | ||
- | |||
- | < | ||
- | configure.args --build=powerpc-apple-darwin9.8.0 --with-gcc-arch=ppc | ||
- | </ | ||
- | |||
- | Other ports to be patched: //libmad//, //orc//. | ||
- | |||
- | For //orc//, comment the first line shown here out (prepend the hash sign) and add the second one: | ||
- | |||
- | < | ||
- | # | ||
- | configure.args --build=powerpc-apple-darwin9.8.0 | ||
- | </ | ||
- | |||
- | For //libmad//, just add: | ||
- | |||
- | < | ||
- | configure.args --build=powerpc-apple-darwin9.8.0 | ||
- | </ | ||
- | |||
- | Now, install the dependencies as usual, but include // | ||
- | |||
- | < | ||
- | sudo port install glib2 libmad git-core sox libgcrypt taglib libid3tag libusb-devel qt4-mac | ||
- | </ | ||
- | |||
- | ===== Important Notes ===== | ||
- | |||
- | * The application runs only on MacOS versions equal or higher than version of the build system | ||
- | * There is a bug in //qmake// which produces broken // | ||
- | * The current portfile for //ffmpeg// in Macports is broken. Please use //port edit ffmpeg// to add the configure option " | ||
- | |||
- | ===== Links ===== | ||
- | |||
- | * [[http:// |
compilingonmac.txt · Last modified: 2017/10/01 09:04 by thp