diff --git a/ide/buildlazdialog.pas b/ide/buildlazdialog.pas index 20c661f4fd..02accae8d9 100644 --- a/ide/buildlazdialog.pas +++ b/ide/buildlazdialog.pas @@ -45,11 +45,11 @@ uses Graphics, GraphType, StdCtrls, ExtCtrls, Buttons, FileUtil, Dialogs, LResources, Laz_XMLCfg, InterfaceBase, Themes, ComCtrls, LazarusIDEStrConsts, TransferMacros, LazConf, IDEProcs, DialogProcs, - IDEWindowIntf, InputHistory, ExtToolDialog, ExtToolEditDlg, + IDEWindowIntf, IDEMsgIntf, InputHistory, ExtToolDialog, ExtToolEditDlg, {$IFDEF win32} EnvironmentOpts, CodeToolManager, // added for windres workaround {$ENDIF} - CompilerOptions; + ApplicationBundle, CompilerOptions; type @@ -507,6 +507,8 @@ var NewTargetOS: String; NewTargetCPU: String; CrossCompiling: Boolean; + CurTargetFilename: String; + BundleDir: String; begin Result:=mrOk; CurItem:=Options.Items[ItemIndex]; @@ -588,7 +590,7 @@ begin Result:=ForceDirectoryInteractive(NewTargetDirectory,[]); if Result<>mrOk then exit; if OSLocksExecutables and not CrossCompiling then begin - // Allow for the case where this correspnds to the current executable + // Allow for the case where this corresponds to the current executable NewTargetFilename:='lazarus'+GetExecutableExt(NewTargetOS); if FileExistsUTF8(AppendPathDelim(NewTargetDirectory)+NewTargetFilename) then NewTargetFilename:='lazarus.new'+GetExecutableExt(NewTargetOS) @@ -647,6 +649,36 @@ begin end; end; + // create apple bundle if needed + //debugln(['CreateBuildLazarusOptions NewTargetDirectory=',NewTargetDirectory]); + if (Options.LCLPlatform in [lpCarbon,lpCocoa]) + and (NewTargetDirectory<>'') + and (DirectoryIsWritableCached(NewTargetDirectory)) then begin + CurTargetFilename:=NewTargetFilename; + if CurTargetFilename='' then + CurTargetFilename:='lazarus'+GetExecutableExt(NewTargetOS); + if not FilenameIsAbsolute(CurTargetFilename) then + CurTargetFilename:=NewTargetDirectory+PathDelim+CurTargetFilename; + BundleDir:=ChangeFileExt(CurTargetFilename,'.app'); + //debugln(['CreateBuildLazarusOptions checking bundle ',BundleDir]); + if not FileExistsCached(BundleDir) then begin + //debugln(['CreateBuildLazarusOptions CurTargetFilename=',CurTargetFilename]); + Result:=CreateApplicationBundle(CurTargetFilename, 'Lazarus'); + if not (Result in [mrOk,mrIgnore]) then begin + debugln(['CreateBuildLazarusOptions CreateApplicationBundle failed']); + IDEMessagesWindow.AddMsg('Error: failed to create application bundle '+BundleDir,NewTargetDirectory,-1); + exit; + end; + //debugln(['CreateBuildLazarusOptions BundleDir exists: ',FileExists(BundleDir)]); + Result:=CreateAppBundleSymbolicLink(CurTargetFilename); + if not (Result in [mrOk,mrIgnore]) then begin + debugln(['CreateBuildLazarusOptions CreateAppBundleSymbolicLink failed']); + IDEMessagesWindow.AddMsg('Error: failed to create application bundle symlink to '+CurTargetFilename,NewTargetDirectory,-1); + exit; + end; + end; + end; + if NewUnitDirectory<>'' then // FPC interpretes '\ ' as an escape for a space in a path, // so make sure the directory doesn't end with the path delimeter. diff --git a/tools/install/macosx/create_lazarus_dmg.sh b/tools/install/macosx/create_lazarus_dmg.sh index f727621eb3..0e486809ef 100755 --- a/tools/install/macosx/create_lazarus_dmg.sh +++ b/tools/install/macosx/create_lazarus_dmg.sh @@ -88,8 +88,6 @@ if [ -z "$COMPILER" ]; then COMPILER=$(which fpc) fi FPCARCH=$($COMPILER -iSP) -#~/fpc/bin/$PPCARCH -#CROSSCOMPILER=~/fpc/bin/fpc FPCVERSION=$($COMPILER -iV) BUILDDIR=~/tmp/buildlaz ROOTDIR=$BUILDDIR/Root @@ -116,9 +114,6 @@ if [ ! -e tools/svn2revisioninc ]; then fi ./tools/svn2revisioninc $LAZSOURCEDIR ide/revision.inc - -#export FPCDIR=~/fpc/lib/fpc/$FPCVERSION - make bigide PP=$COMPILER USESVN2REVISIONINC=0 make lazbuilder PP=$COMPILER @@ -147,8 +142,6 @@ find $BUILDDIR -name '.DS_Store' -exec rm -rf {} \; || true # create symlinks mkdir -p $ROOTDIR/usr/bin cd $ROOTDIR/usr/bin -#does not work: ln -s /Developer/lazarus/lazarus.app/Contents/MacOS/lazarus lazarus -#does not work: ln -s /Developer/lazarus/lazarus.app/Contents/MacOS/startlazarus startlazarus ln -s /Developer/lazarus/lazbuild lazbuild cp $TEMPLATEDIR/uninstall.sh $ROOTDIR/Developer/lazarus/