[Opalvoip-user] Mac OS X Build instructions for and patch to make ptlib 2.6.5 and opal 3.6.6.
Brought to you by:
csoutheren,
rjongbloed
From: Mark F. <ma...@po...> - 2009-11-11 07:06:22
|
Criag for wiki (1st draft of Mac OS X buid instructions). 1. Download and install: http://mac.softpedia.com/progDownload/pkg-config-Download-46896.html cd pkg-confiug ./configure make sudo make install 2. download opal and ptlib (that matches version of opal). uncompress where PTLIB and OPAL are in folder such as $HOME/h323: NOTE: make sure full path has no special char or spaces in it. For bash/sh export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig export LD_LIBRARY_PATH=/usr/local/lib export PTLIBPLUGINDIR=/usr/local/lib/ptlib-minor.major.patch export PTLIBDIR=$HOME/h323/ptlib export OPALLIBDIR=$HOME/h323/opal cd ~/h323/ptlib ./configure --enable-wavfile --enable-openssl make sudo make install cd ../opal ./configure sudo make install NOTE: if you want h.323 and H264 you need to install FFPEG ./configure --enable-h264 --enable-ffmpeg-h263 --with-libavcodec- source-dir=../ffmpeg/ 3. to universal binary for MacOS X you need to setup arch for other cpu. * CFLAGS contains multiple "-arch xxx" flags. * Or, set TARGET_ARCHS to a space-separated list (e.g. "x86 x86_64 ppc") TARGET_ARCHS is a bit more forgiving than CFLAGS (x86 will match i386, powerpc will match ppc). 4. BUGS to fix for Mac OS X build: 4a. OPAL plugin bug: Not looking for plugins with .dylib (still looking for .so). Files effected are: PTLIB: src/ptlib/unix/udll.cxx PString PDynaLink::GetExtension() { #ifdef P_MACOSX return PString(".dylib"); #else return PString(".so"); #endif } and OPAL: plugins/video/common/dyna.cxx: in bool DynaLink::InternalOpen(const char * dir, const char *name) ... #ifndef _WIN32 #ifdef P_MACOSX strcat(path,".dylib"); #else strcat(path, ".so"); #endif #endif 4b. PTLIB Patch for Mac OS X build of PTLib v2.6.5 (Unix Darwin (9.8.0-i386) with PTLib (v2.6.5)) - fix PSETPGRP for current Mac OS X SDK - fix / implement absolute timer. alternative is: http://le-depotoir.googlecode.com/svn/trunk/misc/clock_gettime_stub.c diff ~/ptlib/include/ptlib/unix/ptlib/pmachdep.h /Users/Mark/h323/ ptlib/include/ptlib/unix/ptlib/pmachdep.h 345c345,347 < #define _POSIX_MONOTONIC_CLOCK --- > > // for timers use: clock_gettime() in osutil.cxx > //#define _POSIX_MONOTONIC_CLOCK 350c352 < #define PSETPGRP() setpgrp(0, 0) --- > //#define PSETPGRP() setpgrp(0, 0) 351a354,359 > #if defined (P_MACOSX) && (P_MACOSX >= 908) > // OS X 10.5.8 with XCODE Version 3.1.4 and 10.5 SDK > #define PSETPGRP() setpgrp() > #else > #define PSETPGRP() setpgrp(0, 0) > #endif diff ~/ptlib/src/ptlib/unix/osutil.cxx /Users/Mark/h323/ptlib/src/ ptlib/unix/osutil.cxx 58a59 > 147a149,152 > #if defined(P_MACOSX) > #include <mach/mach_time.h> > #endif > 301,302c306,308 < // timer < --- > // timer - milliseconds - > // A millisecond (from milli- and second; abbreviation: ms) is a thousandth (1/1000) of a second. > // A microsecond is equal to 1000 nanoseconds or 1/1000 millisecond. 305a312,342 > > #if defined(P_MACOSX) > > // Mac OS X reference: http://www.mail-archive.com/yad...@li.../msg01354.html > // and http://www.macresearch.org/tutorial_performance_and_time > // and http://developer.apple.com/mac/library/qa/qa2004/qa1398.html > > static mach_timebase_info_data_t timebase_info; > if (timebase_info.denom == 0) { > > // Zero-initialization of statics guarantees that denom will be 0 before > // calling mach_timebase_info. mach_timebase_info will never set denom to > // 0 as that would be invalid, so the zero-check can be used to determine > // whether mach_timebase_info has already been called. This is recommended by Apple's QA1398. > kern_return_t kr = mach_timebase_info(&timebase_info); > PAssert(kr == KERN_SUCCESS, POperatingSystemError); > } > > // mach_absolute_time is it when it comes to ticks on the Mac. Other calls > // with less precision (such as TickCount) just call through to mach_absolute_time. > > // timebase_info converts absolute time tick units into nanoseconds. Convert > // to microseconds up front to stave off overflows. > return mach_absolute_time() / 1000LL * // 1000 nanosec / 1 millisec > timebase_info.numer / timebase_info.denom; > > // Don't bother with the rollover handling > // With numer and denom = 1 (the expected case), the 64-bit absolute time > // reported in nanoseconds is enough to last nearly 585 years. > > #else 310a348 > 315a354 > #endif |