diff --git a/.gitignore b/.gitignore index 930f8e0..a4cb745 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ Output output fgBuild sgBuild +image +macflightgear +fgdata diff --git a/.gitmodules b/.gitmodules index 79d8fb5..c3d50eb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "fgrun"] path = fgrun url = git://gitorious.org/fg/fgrun.git +[submodule "maclauncher"] + path = maclauncher + url = git://gitorious.org/fg/maclauncher.git diff --git a/Info.plist.in b/Info.plist.in index 5fdd5d4..b6dd5d4 100644 --- a/Info.plist.in +++ b/Info.plist.in @@ -2,12 +2,14 @@ + CFBundleDevelopmentRegion + English CFBundleIconFile FlightGear.icns CFBundlePackageType APPL CFBundleGetInfoString - FlightGear nightly build + FlightGear, the open-source flight simulator, <%= fgVersion %>. ©1996-<%= fgCurrentYear%>, The FlightGear Project CFBundleSignature ???? CFBundleExecutable @@ -19,11 +21,13 @@ CFBundleShortVersionString <%= fgVersion %> LSMinimumSystemVersion - 10.5.0 + 10.6.0 NSMainNibFile MainMenu NSPrincipalClass NSApplication + NSHumanReadableCopyright + ©1996-<%= fgCurrentYear%>, The FlightGear Project diff --git a/base-package.rules b/base-package.rules new file mode 100644 index 0000000..8e210bf --- /dev/null +++ b/base-package.rules @@ -0,0 +1,38 @@ +- .git +- *.xcf +- *.tex + ++ /fgdata/Aircraft/Generic ++ /fgdata/Aircraft/Instruments ++ /fgdata/Aircraft/Instruments-3d + ++ /fgdata/Aircraft/UIUC ++ /fgdata/Aircraft/c172p ++ /fgdata/Aircraft/777 ++ /fgdata/Aircraft/777-200 ++ /fgdata/Aircraft/b1900d ++ /fgdata/Aircraft/ufo ++ /fgdata/Aircraft/CitationX ++ /fgdata/Aircraft/ZLT-NT ++ /fgdata/Aircraft/dhc2 ++ /fgdata/Aircraft/Cub ++ /fgdata/Aircraft/sopwithCamel ++ /fgdata/Aircraft/f-14b ++ /fgdata/Aircraft/ASK13 ++ /fgdata/Aircraft/bo105 ++ /fgdata/Aircraft/Dragonfly ++ /fgdata/Aircraft/SenecaII ++ /fgdata/Aircraft/A6M2 + +- /fgdata/Aircraft/* + +- /fgdata/Textures.high/*.new +- /fgdata/Textures.high/*.orig +- /fgdata/Textures.high/*.save +- /fgdata/Textures/Unused +- /fgdata/Textures/*.orig +- /fgdata/Docs/source +- /fgdata/Models/Airspace +- /fgdata/Models/MNUAV + + diff --git a/hudson_mac_build_launcher.sh b/hudson_mac_build_launcher.sh deleted file mode 100755 index dc3bd24..0000000 --- a/hudson_mac_build_launcher.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -SDK_PATH="/Developer/SDKs/MacOSX10.6.sdk" -OSX_TARGET="10.6" - -svn co https://macflightgear.svn.sourceforge.net/svnroot/macflightgear/trunk/FlightGearOSX macflightgear - -pushd macflightgear - -# compile the stub executable -gcc -o FlightGear -mmacosx-version-min=$OSX_TARGET -isysroot $SDK_PATH -arch i386 main.m \ - -framework Cocoa -framework RubyCocoa -framework Foundation -framework AppKit - -popd - diff --git a/hudson_mac_build_release.sh b/hudson_mac_build_release.sh new file mode 100755 index 0000000..a9d1566 --- /dev/null +++ b/hudson_mac_build_release.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +if [ "$WORKSPACE" == "" ]; then + echo "ERROR: Missing WORKSPACE environment variable." + exit 1 +fi + +############################################################################### +# remove old and create fresh build directories +rm -rf sgBuild +rm -rf fgBuild +mkdir -p sgBuild +mkdir -p fgBuild +mkdir -p output +rm -rf output/* +rm -rf $WORKSPACE/dist/include/simgear $WORKSPACE/dist/libSim* $WORKSPACE/dist/libsg*.a + +############################################################################### +echo "Starting on SimGear" +pushd sgBuild +cmake -DCMAKE_INSTALL_PREFIX:PATH=$WORKSPACE/dist -G Xcode ../simgear + +# compile +xcodebuild -configuration Release -target install build + +if [ $? -ne '0' ]; then + echo "make simgear failed" + exit 1 +fi + +popd + +################################################################################ +echo "Starting on FlightGear" +pushd fgBuild +cmake -DCMAKE_INSTALL_PREFIX:PATH=$WORKSPACE/dist -G Xcode ../flightgear + +xcodebuild -configuration Release -target install build + +if [ $? -ne '0' ]; then + echo "make flightgear failed" + exit 1 +fi + +popd + +chmod +x $WORKSPACE/dist/bin/osgversion + +################################################################################ +echo "Building Macflightgear launcher" + +OSX_TARGET="10.6" + +pushd maclauncher/FlightGearOSX + +# compile the stub executable +gcc -o FlightGear -mmacosx-version-min=$OSX_TARGET -isysroot $SDK_PATH -arch i386 main.m \ + -framework Cocoa -framework RubyCocoa -framework Foundation -framework AppKit + +popd + +################################################################################ +echo "Syncing base packages files from sphere.telascience.org" +rsync -avz --filter 'merge base-package.rules' \ + -e ssh jturner@sphere.telascience.org:/home/jturner/fgdata . + +# run the unlock script now - we need to do this right before code-signing, +# or the keychain may automatically re-lock after some period of time +unlock-keychain.sh + +echo "Running package script" +./hudson_mac_package_release.rb diff --git a/hudson_mac_package_release.rb b/hudson_mac_package_release.rb index d1cfb24..1180f15 100755 --- a/hudson_mac_package_release.rb +++ b/hudson_mac_package_release.rb @@ -1,9 +1,11 @@ #!/usr/bin/ruby require 'ERB' +require 'fileutils' #I know, no underscore is not ruby-like +include FileUtils $osgLibs = ['osgFX', 'osgParticle', 'osg', 'osgGA', 'osgText', 'osgUtil', 'osgSim', 'osgViewer', 'osgDB'] -$osgPlugins = ['ac', 'osg', 'freetype', 'qt', 'imageio', 'rgb', 'txf', 'mdl', '3ds'] +$osgPlugins = ['ac', 'osg', 'freetype', 'imageio', 'rgb', 'txf', 'mdl', '3ds'] def runOsgVersion(option) env = "export DYLD_LIBRARY_PATH=#{Dir.pwd}/dist/lib" @@ -15,10 +17,17 @@ osgVersion = runOsgVersion('version-number') $osgSoVersion=runOsgVersion('so-number') $openThreadsSoVersion=runOsgVersion('openthreads-soversion-number') +$codeSignIdentity = ENV['FG_CODESIGN_IDENTITY'] +puts "Code signing identity is #{$codeSignIdentity}" + puts "osgVersion=#{osgVersion}, so-number=#{$osgSoVersion}" $alutSourcePath='/Library/Frameworks/ALUT.framework' +$svnLibs = ['svn_client', 'svn_wc', 'svn_delta', 'svn_diff', 'svn_ra', + 'svn_ra_local', 'svn_repos', 'svn_fs', 'svn_fs_fs', 'svn_fs_util', + 'svn_ra_svn', 'svn_subr', 'svn_ra_neon'] + def fix_install_names(object) #puts "fixing install names for #{object}" @@ -32,15 +41,39 @@ def fix_install_names(object) newName= "@executable_path/../Frameworks/#{oldName}" `install_name_tool -change #{oldName} #{newName} #{object}` - alutBundlePath = "@executable_path/../Frameworks/Alut.framework" + alutBundlePath = "@executable_path/../Frameworks/ALUT.framework" alutLib = "Versions/A/ALUT" `install_name_tool -change #{$alutSourcePath}/#{alutLib} #{alutBundlePath}/#{alutLib} #{object}` end -prefixDir=Dir.pwd + "/dist" +$prefixDir=Dir.pwd + "/dist" dmgDir=Dir.pwd + "/image" srcDir=Dir.pwd + "/flightgear" +def fix_svn_install_names(object) + $svnLibs.each do |l| + fileName = "lib#{l}-1.0.dylib" + newName = "@executable_path/../Frameworks/#{fileName}" + `install_name_tool -change #{fileName} #{newName} #{object}` + end +end + +def copy_svn_libs() + puts "Copying Subversion client libraries" + $svnLibs.each do |l| + libFile = "lib#{l}-1.0.dylib" + path = "#{$frameworksDir}/#{libFile}" + `cp #{$prefixDir}/lib/#{libFile} #{$frameworksDir}` + fix_svn_install_names(path) + # `install_name_tool -id #{libFile} #{path}` + end +end + +def code_sign(path) + puts "Signing #{path}" + `codesign -s "#{$codeSignIdentity}" #{path}` +end + puts "Erasing previous image dir" `rm -rf #{dmgDir}` @@ -48,56 +81,72 @@ puts "Erasing previous image dir" bundle=dmgDir + "/FlightGear.app" contents=bundle + "/Contents" macosDir=contents + "/MacOS" -frameworksDir=contents +"/Frameworks" +$frameworksDir=contents +"/Frameworks" resourcesDir=contents+"/Resources" osgPluginsDir=contents+"/PlugIns/osgPlugins-#{osgVersion}" +# for writing copyright year to Info.plist +t = Time.new +fgCurrentYear = t.year fgVersion = File.read("#{srcDir}/version").strip volName="\"FlightGear #{fgVersion}\"" -dmgPath = Dir.pwd + "/fg_mac_#{fgVersion}.dmg" +dmgPath = Dir.pwd + "/output/fg_mac_#{fgVersion}.dmg" puts "Creating directory structure" `mkdir -p #{macosDir}` -`mkdir -p #{frameworksDir}` +`mkdir -p #{$frameworksDir}` `mkdir -p #{resourcesDir}` `mkdir -p #{osgPluginsDir}` puts "Copying binaries" -bins = ['fgfs', 'terrasync'] +bins = ['fgfs', 'fgjs', 'fgcom', 'fgviewer'] bins.each do |b| - `cp #{prefixDir}/bin/#{b} #{resourcesDir}/#{b}` - fix_install_names("#{resourcesDir}/#{b}") + if !File.exist?("#{$prefixDir}/bin/#{b}") + next + end + + outPath = "#{macosDir}/#{b}" + `cp #{$prefixDir}/bin/#{b} #{outPath}` + fix_install_names(outPath) + fix_svn_install_names(outPath) end puts "copying libraries" $osgLibs.each do |l| libFile = "lib#{l}.#{$osgSoVersion}.dylib" - `cp #{prefixDir}/lib/#{libFile} #{frameworksDir}` - fix_install_names("#{frameworksDir}/#{libFile}") + `cp #{$prefixDir}/lib/#{libFile} #{$frameworksDir}` + fix_install_names("#{$frameworksDir}/#{libFile}") end # and not forgetting OpenThreads libFile = "libOpenThreads.#{$openThreadsSoVersion}.dylib" -`cp #{prefixDir}/lib/#{libFile} #{frameworksDir}` +`cp #{$prefixDir}/lib/#{libFile} #{$frameworksDir}` $osgPlugins.each do |p| pluginFile = "osgdb_#{p}.so" - `cp #{prefixDir}/lib/osgPlugins-#{osgVersion}/#{pluginFile} #{osgPluginsDir}` + `cp #{$prefixDir}/lib/osgPlugins-#{osgVersion}/#{pluginFile} #{osgPluginsDir}` fix_install_names("#{osgPluginsDir}/#{pluginFile}") end +copy_svn_libs() + # custom ALUT # must copy frameworks using ditto -`ditto #{$alutSourcePath} #{frameworksDir}/ALUT.framework` +`ditto #{$alutSourcePath} #{$frameworksDir}/ALUT.framework` # Macflightgear launcher puts "Copying Macflightgear launcher files" -Dir.chdir "macflightgear" do +Dir.chdir "maclauncher/FlightGearOSX" do `cp FlightGear #{macosDir}` - `rsync -a --exclude=\".svn\" *.rb *.lproj *.sh *.tiff #{resourcesDir}` + `rsync -a *.rb *.lproj *.sh *.tiff #{resourcesDir}` +end + +if File.exist?("#{$prefixDir}/bin/fgcom-data") + puts "Copying FGCom data files" + `ditto #{$prefixDir}/bin/fgcom-data #{resourcesDir}/fgcom-data` end # Info.plist @@ -111,6 +160,18 @@ File.open("#{contents}/Info.plist", 'w') { |f| `cp #{srcDir}/package/mac/FlightGear.icns #{resourcesDir}/FlightGear.icns` `cp #{srcDir}/COPYING #{dmgDir}` +puts "Copying base package files into the image" +`rsync -a fgdata/ #{resourcesDir}/data` + +# code sign all executables in MacOS dir. Do this last since reource +# changes will invalidate the signature! +Dir.foreach(macosDir) do |b| + if b == '.' or b == '..' then + next + end + code_sign("#{macosDir}/#{b}") +end + puts "Creating DMG" createArgs = "-format UDBZ -imagekey bzip2-level=9 -quiet -volname #{volName}" diff --git a/maclauncher b/maclauncher new file mode 160000 index 0000000..7ffef2c --- /dev/null +++ b/maclauncher @@ -0,0 +1 @@ +Subproject commit 7ffef2cb26442578f3c4b1e22158feb1ad812367