Permalink
Browse files

Merged fixes in master with 1.7

  • Loading branch information...
2 parents 0223e82 + eb23dcb commit 076223e30684fe85c2df46f63f0dfba117abf73d @taxilian taxilian committed Sep 27, 2012
Showing with 1,289 additions and 186 deletions.
  1. +19 −1 cmake/Mac.cmake
  2. +4 −4 cmake/PluginConfigDefaults.cmake
  3. +66 −1 cmake/Win.cmake
  4. +1 −1 cmake/buildconfig.cmake
  5. +29 −0 cmake/chrome.cmake
  6. +34 −15 cmake/common.cmake
  7. +19 −0 cmake/wix.cmake
  8. +35 −0 cmake/xpi.cmake
  9. 0 examples/FBTestPlugin/Mac/dmg_template/.background/PLACE_BACKGROUND_PICTURE_HERE.txt
  10. BIN examples/FBTestPlugin/Mac/dmg_template/.background/background.png
  11. 0 examples/FBTestPlugin/Mac/dmg_template/README.txt
  12. +21 −0 examples/FBTestPlugin/Mac/dmgdesign.applescript
  13. +45 −0 examples/FBTestPlugin/Mac/installer.cmake
  14. +3 −0 examples/FBTestPlugin/Mac/projectDef.cmake
  15. +9 −3 fbgen.py
  16. +17 −0 fbgen/src/CMakeLists.txt
  17. +9 −0 fbgen/src/Chrome/chromepackage/manifest.json
  18. 0 fbgen/src/Mac/dmg_template/.background/PLACE_BACKGROUND_PICTURE_HERE.txt
  19. BIN fbgen/src/Mac/dmg_template/.background/background.png
  20. 0 fbgen/src/Mac/dmg_template/README.txt
  21. +21 −0 fbgen/src/Mac/dmgdesign.applescript
  22. +45 −0 fbgen/src/Mac/installer.cmake
  23. +3 −0 fbgen/src/Mac/projectDef.cmake
  24. +9 −0 fbgen/src/Win/WiX/Template.ddf
  25. +9 −0 fbgen/src/Win/WiX/Template.inf
  26. +9 −0 fbgen/src/Win/projectDef.cmake
  27. +1 −0 fbgen/src/xpi/content/chrome.manifest
  28. +36 −0 fbgen/src/xpi/content/install.rdf
  29. +15 −26 src/ActiveXCore/ActiveXBrowserHost.cpp
  30. +3 −7 src/ActiveXCore/ActiveXBrowserHost.h
  31. +3 −2 src/ActiveXCore/precompiled_headers.h
  32. +38 −29 src/NpapiCore/NpapiBrowserHost.cpp
  33. +5 −7 src/NpapiCore/NpapiBrowserHost.h
  34. +34 −6 src/NpapiCore/NpapiPlugin.cpp
  35. +2 −0 src/NpapiCore/Win/NpapiBrowserHostAsyncWin.cpp
  36. +3 −1 src/NpapiCore/precompiled_headers.h
  37. +8 −4 src/PluginAuto/CMakeLists.txt
  38. +7 −0 src/PluginAuto/Win/PluginWindowWin.cpp
  39. +11 −0 src/PluginAuto/Win/PluginWindowWin.h
  40. +19 −5 src/PluginAuto/X11/PluginWindowX11.cpp
  41. +1 −0 src/PluginAuto/X11/PluginWindowX11.h
  42. +4 −0 src/PluginAuto/precompiled_headers.h
  43. +258 −0 src/PluginCore/BrowserStreamRequest.h
  44. +18 −1 src/PluginCore/DefaultBrowserStreamHandler.cpp
  45. +33 −0 src/PluginCore/DefaultBrowserStreamHandler.h
  46. +8 −0 src/PluginCore/PluginCore.cpp
  47. +26 −6 src/PluginCore/PluginCore.h
  48. +34 −0 src/PluginCore/PluginEvents/X11NativeGdkEvent.cpp
  49. +89 −0 src/PluginCore/PluginEvents/X11NativeGdkEvent.h
  50. +54 −30 src/PluginCore/SimpleStreamHelper.cpp
  51. +51 −0 src/PluginCore/SimpleStreamHelper.h
  52. +2 −0 src/PluginCore/Win/SystemHelpersWin.cpp
  53. +7 −0 src/PluginCore/Win/SystemProxyDetectorWin.cpp
  54. +3 −0 src/PluginCore/precompiled_headers.h
  55. +36 −5 src/ScriptingCore/BrowserHost.cpp
  56. +49 −19 src/ScriptingCore/BrowserHost.h
  57. +10 −10 src/ScriptingCore/CrossThreadCall.h
  58. +2 −1 src/ScriptingCore/FBPointers.h
  59. +1 −1 src/ScriptingCore/URI.cpp
  60. +4 −0 src/ScriptingCore/URI.h
  61. +4 −0 src/ScriptingCore/precompiled_headers.h
  62. +3 −1 src/ScriptingCore/utf8_tools.cpp
View
@@ -83,7 +83,8 @@ MACRO(add_mac_plugin PROJECT_NAME PLIST_TEMPLATE STRINGS_TEMPLATE LOCALIZED_TEMP
endforeach()
# Compile the resource file
- find_program(RC_COMPILER Rez NO_DEFAULT_PATHS)
+ firebreath_find_commands()
+ set(RC_COMPILER ${CMD_REZ})
execute_process(COMMAND
${RC_COMPILER} ${RCFILES} -useDF ${ARCHS} -arch x86_64 -o ${CMAKE_CURRENT_BINARY_DIR}/bundle/English.lproj/Localized.rsrc
)
@@ -116,3 +117,20 @@ MACRO(add_mac_plugin PROJECT_NAME PLIST_TEMPLATE STRINGS_TEMPLATE LOCALIZED_TEMP
ENDMACRO(add_mac_plugin)
+MACRO(firebreath_find_commands)
+
+ set(XCODE_TOOLS_PATHS /Developer/Tools /Applications/Xcode.app/Contents/Developer/Tools /Applications/Xcode.app/Contents/Developer/usr/bin /usr/bin)
+
+ find_program(CMD_CP cp)
+ find_program(CMD_RM rm)
+ find_program(CMD_LN ln)
+ find_program(CMD_MV mv)
+ find_program(CMD_HDIUTIL hdiutil)
+ find_program(CMD_SIPS sips)
+ find_program(CMD_SLEEP sleep)
+ find_program(CMD_OSASCRIPT osascript)
+ find_program(CMD_SETFILE SetFile ${XCODE_TOOLS_PATHS} )
+ find_program(CMD_DEREZ DeRez ${XCODE_TOOLS_PATHS} )
+ find_program(CMD_REZ Rez ${XCODE_TOOLS_PATHS} )
+
+ENDMACRO(firebreath_find_commands)
@@ -12,10 +12,10 @@
if (APPLE)
- set (FBMAC_USE_CARBON 1)
- set (FBMAC_USE_COCOA 0)
- set (FBMAC_USE_QUICKDRAW 1)
- set (FBMAC_USE_COREGRAPHICS 0)
+ set (FBMAC_USE_CARBON 0)
+ set (FBMAC_USE_COCOA 1)
+ set (FBMAC_USE_QUICKDRAW 0)
+ set (FBMAC_USE_COREGRAPHICS 1)
set (FBMAC_USE_COREANIMATION 0)
set (FBMAC_USE_INVALIDATINGCOREANIMATION 0)
endif(APPLE)
View
@@ -136,6 +136,9 @@ set(ATL_INCLUDE_DIRS
${MFC_INCLUDE_DIR}
CACHE INTERNAL "ATL and MFC include dirs")
+IF(NOT DEFINED CMAKE_MAKECAB)
+ SET(CMAKE_MAKECAB makecab)
+ENDIF(NOT DEFINED CMAKE_MAKECAB)
MACRO(add_windows_plugin PROJNAME INSOURCES)
set(SOURCES
@@ -251,6 +254,68 @@ function (add_wix_installer PROJNAME WIX_SOURCEFILES WIX_COMPGROUP WIX_OUTDIR WI
WIX_LINK(${PROJNAME}${FB_WIX_SUFFIX} ${WIX_DEST} WIX_FULLOBJLIST NONE)
ADD_DEPENDENCIES(${PROJNAME}${FB_WIX_SUFFIX} ${WIX_PROJDEP})
-
+
+ # Create the EXE wrapper
+
+ if (FB_WIX_EXEDEST)
+ SET (WIX_EXEDEST ${FB_WIX_EXEDEST})
+ else()
+ SET (WIX_EXEDEST ${WIX_OUTDIR}/${PROJNAME}.exe)
+ endif()
+
+ if (NOT FB_WIX_EXE_SUFFIX)
+ set (FB_WIX_EXE_SUFFIX _WiXInstallExe)
+ endif()
+
+ set (WIX_EXESOURCES
+ ${FB_ROOT}/cmake/dummy.cpp
+ ${WIX_DEST}
+ )
+ ADD_LIBRARY(${PROJNAME}${FB_WIX_EXE_SUFFIX} STATIC ${WIX_EXESOURCES})
+
+ WIX_SETUPBLD(${PROJNAME}${FB_WIX_EXE_SUFFIX} ${WIX_EXEDEST} ${WIX_DEST})
+
+ ADD_DEPENDENCIES(${PROJNAME}${FB_WIX_EXE_SUFFIX} ${PROJNAME}${FB_WIX_SUFFIX})
endif()
endfunction(add_wix_installer)
+
+function (create_cab PROJNAME DDF CAB_SOURCEFILES CAB_OUTDIR PROJDEP)
+ GET_FILENAME_COMPONENT(_tmp_File ${DDF} NAME)
+ configure_file(${DDF} ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})
+ message("Configuring ${DDF} -> ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File}")
+ set(CAB_DDF ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})
+
+ set(SOURCELIST ${CAB_DDF})
+ FOREACH(_curFile ${CAB_SOURCEFILES})
+ GET_FILENAME_COMPONENT(_tmp_File ${_curFile} NAME)
+ configure_file(${_curFile} ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})
+ message("Configuring ${_curFile} -> ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File}")
+ set(SOURCELIST ${SOURCELIST} ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})
+ ENDFOREACH()
+
+ set (WIX_SOURCES
+ ${FB_ROOT}/cmake/dummy.cpp
+ ${DDF}
+ ${CAB_SOURCEFILES}
+ ${SOURCELIST}
+ )
+
+ if (FB_CAB_DEST)
+ SET (CAB_DEST ${FB_CAB_DEST})
+ else()
+ SET (CAB_DEST ${CAB_OUTDIR}/${PROJNAME}.cab)
+ endif()
+
+ if (NOT FB_CAB_SUFFIX)
+ set (FB_CAB_SUFFIX _Cab)
+ endif()
+
+ ADD_LIBRARY(${PROJNAME}${FB_CAB_SUFFIX} STATIC ${WIX_SOURCES})
+ ADD_CUSTOM_COMMAND( TARGET ${PROJNAME}${FB_CAB_SUFFIX} POST_BUILD
+ COMMAND ${CMAKE_MAKECAB}
+ ARGS /D "OUTDIR=${CAB_OUTDIR}" /F "${CAB_DDF}"
+ DEPENDS ${SOURCELIST}
+ COMMENT "Create Cab ${CAB_DEST}"
+ )
+ ADD_DEPENDENCIES(${PROJNAME}${FB_CAB_SUFFIX} ${PROJDEP})
+endfunction(create_cab)
View
@@ -25,7 +25,7 @@ if (WIN32)
message(STATUS "Balanced size/speed optimization")
endif()
- set(CMAKE_C_FLAGS "/GF /DWIN32 /DFB_WIN=1 /DXP_WIN=1 /W3 /wd4996 /nologo /D UNICODE /D _UNICODE /D _WINDOWS /Zm256")
+ set(CMAKE_C_FLAGS "/GF /DWIN32 /DFB_WIN=1 /DXP_WIN=1 /W3 /wd4996 /nologo /D UNICODE /D _UNICODE /D _WINDOWS /Zm256 /Y-")
set(CMAKE_CXX_FLAGS "/GF /DWIN32 /DFB_WIN=1 /DXP_WIN=1 /W3 /wd4996 /nologo /EHsc /wd4290 /D UNICODE /D _UNICODE /D _WINDOWS /Zm256")
set(CMAKE_C_FLAGS_RELEASE "/GL /MT ${FB_OPT_PARAM} /DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "/GL /MT ${FB_OPT_PARAM} /DNDEBUG")
View
@@ -0,0 +1,29 @@
+# Build a signed Chrome package to distribute the plugin
+# 2012/01 Geoffroy Couprie geoffroy.couprie@loginpeople.com
+
+function (add_chrome_package PROJNAME CRX_OUTDIR DLLFILE KEYFILE CRX_PROJDEP)
+ message(STATUS "CONFIGURING CRX PACKAGING")
+ set (CRX_SOURCES
+ ${FB_ROOT}/cmake/dummy.cpp
+ )
+ if (NOT FB_CRX_SUFFIX)
+ set (FB_CRX_SUFFIX _CRX)
+ endif()
+ ADD_LIBRARY(${PROJNAME}${FB_CRX_SUFFIX} STATIC ${CRX_SOURCES})
+
+ #Replace the plugin version in the install.rdf template
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-crx)
+ configure_template(${CMAKE_CURRENT_SOURCE_DIR}/Chrome/chromepackage/manifest.json ${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-crx/manifest.json)
+
+ add_custom_command(
+ TARGET ${PROJNAME}${FB_CRX_SUFFIX}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory "\"${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-crx\"" "\"${CRX_OUTDIR}/${FBSTRING_PluginFileName}/\""
+ COMMAND ${CMAKE_COMMAND} -E copy ${DLLFILE} "\"${CRX_OUTDIR}/${FBSTRING_PluginFileName}/\""
+ COMMAND $ENV{LOCALAPPDATA}\\Google\\Chrome\\Application\\chrome.exe --pack-extension="\"${CRX_OUTDIR}/${FBSTRING_PluginFileName}\"" --pack-extension-key="\"${KEYFILE}\"" --no-message-box
+ COMMAND popd
+ COMMAND ${CMAKE_COMMAND} -E remove_directory "${CRX_OUTDIR}/${FBSTRING_PluginFileName}"
+ )
+ ADD_DEPENDENCIES(${PROJNAME}${FB_CRX_SUFFIX} ${CRX_PROJDEP})
+
+endfunction(add_chrome_package)
View
@@ -48,6 +48,12 @@ else ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set ( FB_PLATFORM_ARCH_NAME "i386" )
endif ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
+# include the Chrome package generation function
+include(${FB_ROOT}/cmake/chrome.cmake)
+
+# include the XPI generation function
+include(${FB_ROOT}/cmake/xpi.cmake)
+
# include file with the crazy configure_template function
include(${FB_ROOT}/cmake/configure_template.cmake)
@@ -306,19 +312,32 @@ function (fb_check_boost)
endfunction()
MACRO(ADD_PRECOMPILED_HEADER PROJECT_NAME PrecompiledHeader PrecompiledSource SourcesVar)
- IF(MSVC)
- GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
- SET(__PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PrecompiledBasename}.pch")
-
- # Found this example of setting up PCH in the cmake source code under Tests/PrecompiledHeader
- SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
- COMPILE_FLAGS "/Yu\"${PrecompiledHeader}\" /FI\"${PrecompiledHeader}\" /Fp\"${__PrecompiledBinary}\"")
-
- SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
- PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledBasename}.h\"")
- elseif (APPLE)
- message("Setting precompiled header ${PrecompiledHeader} on ${PROJECT_NAME}")
- SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES)
- SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${PrecompiledHeader}")
- endif()
+ IF(FB_USE_PCH)
+ add_definitions(-D FB_USE_PCH=1)
+ IF(MSVC)
+ GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
+ SET(__PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PrecompiledBasename}.pch")
+
+ # Found this example of setting up PCH in the cmake source code under Tests/PrecompiledHeader
+ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
+ COMPILE_FLAGS "/Yu\"${PrecompiledHeader}\" /FI\"${PrecompiledHeader}\" /Fp\"${__PrecompiledBinary}\"")
+
+ SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
+ PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledBasename}.h\"")
+
+ FOREACH( src_file ${${SourcesVar}} )
+
+ GET_FILENAME_COMPONENT(src_ext ${src_file} EXT)
+ if ("${src_ext}" STREQUAL ".c")
+ SET_SOURCE_FILES_PROPERTIES(${src_file} PROPERTIES COMPILE_FLAGS "/Y-")
+ message("${src_file} is a C file")
+ endif()
+
+ ENDFOREACH()
+ elseif (APPLE)
+ message("Setting precompiled header ${PrecompiledHeader} on ${PROJECT_NAME}")
+ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES)
+ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${PrecompiledHeader}")
+ endif()
+ ENDIF()
ENDMACRO(ADD_PRECOMPILED_HEADER)
View
@@ -72,6 +72,8 @@ if (WIN32)
SET(WIX_CANDLE ${WIX_ROOT_DIR}/bin/candle.exe)
SET(WIX_LIGHT ${WIX_ROOT_DIR}/bin/light.exe)
SET(WIX_HEAT ${WIX_ROOT_DIR}/bin/heat.exe)
+ SET(WIX_SETUPBLD ${WIX_ROOT_DIR}/bin/setupbld.exe)
+ SET(WIX_SETUP ${WIX_ROOT_DIR}/bin/setup.exe)
# MESSAGE(STATUS "Windows Installer XML found.")
ENDIF(NOT WIX_FOUND)
@@ -209,4 +211,21 @@ if (WIN32)
)
ENDMACRO(WIX_LINK)
+
+ #
+ # Create
+ #
+ # Parameters
+ # _target - Name of target exe file
+ # _source - Name of source msi file
+ #
+ MACRO(WIX_SETUPBLD _project _target _source )
+ ADD_CUSTOM_COMMAND( TARGET ${_project} POST_BUILD
+ COMMAND ${WIX_SETUPBLD}
+ ARGS -out "${_target}" -mpsu "${_source}" -setup ${WIX_SETUP}
+ DEPENDS ${_source}
+ COMMENT "Wrapping ${_source} -> ${_target}"
+ )
+
+ ENDMACRO(WIX_LINK)
endif(WIN32)
View
@@ -0,0 +1,35 @@
+# Build a signed XPI package to distribute the plugin
+# 2012/01 Geoffroy Couprie geoffroy.couprie@loginpeople.com
+
+function (add_signed_xpi_installer PROJNAME XPI_OUTDIR DLLFILE XPISIGNERPATH PFXFILE PASSFILE XPI_PROJDEP)
+ message(STATUS "CONFIGURING XPI PACKAGING")
+ set (XPI_SOURCES
+ ${FB_ROOT}/cmake/dummy.cpp
+ )
+ if (NOT FB_XPI_SUFFIX)
+ set (FB_XPI_SUFFIX _XPI)
+ endif()
+ ADD_LIBRARY(${PROJNAME}${FB_XPI_SUFFIX} STATIC ${XPI_SOURCES})
+
+ if (NOT "${PASSFILE}" STREQUAL "")
+ file(STRINGS "${PASSFILE}" PASSPHRASE LIMIT_COUNT 1)
+ endif()
+
+ #Replace the plugin version in the install.rdf template
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-xpi)
+ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/xpi/content/chrome.manifest DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-xpi)
+ configure_template(${CMAKE_CURRENT_SOURCE_DIR}/xpi/content/install.rdf ${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-xpi/install.rdf)
+
+ add_custom_command(
+ TARGET ${PROJNAME}${FB_XPI_SUFFIX}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory "\"${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-xpi\"" "\"${XPI_OUTDIR}/${FBSTRING_PluginFileName}/\""
+ COMMAND mkdir "\"${XPI_OUTDIR}/${FBSTRING_PluginFileName}/plugins/\""
+ COMMAND ${CMAKE_COMMAND} -E copy "${DLLFILE}" "\"${XPI_OUTDIR}/${FBSTRING_PluginFileName}/plugins/\""
+ COMMAND java -jar ${XPISIGNERPATH} ${PFXFILE} ${PASSPHRASE} "${XPI_OUTDIR}/${FBSTRING_PluginFileName}" "${XPI_OUTDIR}/${FBSTRING_PluginFileName}.xpi"
+ COMMAND popd
+ COMMAND ${CMAKE_COMMAND} -E remove_directory "${XPI_OUTDIR}/${FBSTRING_PluginFileName}"
+ )
+ ADD_DEPENDENCIES(${PROJNAME}${FB_XPI_SUFFIX} ${XPI_PROJDEP})
+
+endfunction(add_signed_xpi_installer)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,21 @@
+on run args
+ set thePluginName to (item 1 of args)
+ set theInstallerName to (item 2 of args)
+ tell application "Finder"
+ tell disk theInstallerName
+ open
+ set current view of container window to icon view
+ set toolbar visible of container window to false
+ set statusbar visible of container window to false
+ set the bounds of container window to {200, 100, 712, 612}
+ set opts to the icon view options of container window
+ set background picture of opts to file ".background:background.png"
+ set arrangement of opts to not arranged
+ set icon size of opts to 80
+ set position of item thePluginName of container window to {150, 275}
+ set position of item "Plugins" of container window to {650, 275}
+ delay 5
+ eject
+ end tell
+ end tell
+end run
@@ -0,0 +1,45 @@
+set(INSTALLER_NAME "${PLUGIN_NAME} Installer")
+
+FIREBREATH_FIND_COMMANDS()
+
+message(STATUS "Adding DMG installer for ${PROJECT_NAME}")
+add_custom_command(
+ TARGET ${PROJECT_NAME}
+ POST_BUILD
+ COMMENT "------------ CREATE DMG INSTALLER"
+
+ #replace the copy with svn/git/whatever export if needed
+ COMMAND ${CMD_CP} -r ${CMAKE_CURRENT_SOURCE_DIR}/Mac/dmg_template ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template
+ COMMAND ${CMD_CP} -R ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.plugin ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template
+
+ #Give an icon to your bundle
+ #COMMAND ${CMD_SIPS} -i ${CMAKE_CURRENT_SOURCE_DIR}/Mac/icon.png
+ #COMMAND ${CMD_DEREZ} -only icns ${CMAKE_CURRENT_SOURCE_DIR}/Mac/icon.png > ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tempicns.rsrc
+ #COMMAND ${CMD_REZ} -append ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tempicns.rsrc -o `printf "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/${PLUGIN_NAME}.plugin/Icon\r"`
+
+ COMMAND ${CMD_SETFILE} -a C ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/${PLUGIN_NAME}.plugin/
+ COMMAND ${CMD_LN} -s /Library/Internet\ Plug-Ins ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/
+ COMMAND ${CMD_MV} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/Internet\ Plug-Ins ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/Plugins
+
+ #Create the DMG
+ COMMAND ${CMD_HDIUTIL} create -fs HFS+ -srcfolder ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/ -volname "${INSTALLER_NAME}" -format UDRW ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg
+ COMMAND ${CMD_HDIUTIL} attach ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg -noautoopen -quiet
+
+ #Wait for the installer to mount
+ COMMAND ${CMD_SLEEP} 2
+ COMMAND ${CMD_OSASCRIPT} ${CMAKE_CURRENT_SOURCE_DIR}/Mac/dmgdesign.applescript ${PLUGIN_NAME}.plugin "${INSTALLER_NAME}"
+ COMMAND ${CMD_SLEEP} 2
+ COMMAND ${CMD_HDIUTIL} attach ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg -noautoopen -quiet
+
+ #Repeat the commands, as they are not always executed o_O
+ COMMAND ${CMD_SLEEP} 2
+ COMMAND ${CMD_OSASCRIPT} ${CMAKE_CURRENT_SOURCE_DIR}/Mac/dmgdesign.applescript ${PLUGIN_NAME}.plugin "${INSTALLER_NAME}"
+ COMMAND ${CMD_SLEEP} 2
+
+ COMMAND ${CMD_HDIUTIL} convert ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg -format UDZO -imagekey zlib-level=9 -o ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.dmg
+
+ COMMAND ${CMD_RM} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg
+ COMMAND ${CMD_RM} -rf ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template
+
+ #COMMAND ${CMD_RM} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tempicns.rsrc
+)
@@ -69,3 +69,6 @@ set (CPACK_GENERATOR PackageMaker DragNDrop TGZ ZIP)
set (CPACK_INSTALL_DIRECTORIES ${PLUGIN_BUILD_DIR}/Debug/${PLUGIN_FNAME}.plugin/)
set (CPACK_OUTPUT_CONFIG_FILE ${PLUGIN_BUILD_DIR}/Debug/CPackConfig.cmake)
include (CPack)
+
+#To create a DMG, include the following file
+#include(Mac/installer.cmake)
View
@@ -32,7 +32,7 @@ def getTemplateFiles(basePath, origPath=None):
files = []
for filename in os.listdir(basePath):
tmpName = os.path.join(basePath, filename)
- if filename[0:1] == '.' or tmpName is None:
+ if filename == '.' or filename == ".." or tmpName is None:
continue
if os.path.isdir(tmpName):
files.extend(getTemplateFiles(tmpName, origPath) )
@@ -164,8 +164,14 @@ def Main():
tplFile = os.path.join("fbgen", "src", tpl)
print tplFile
template = Template(tplFile)
- f = open(filename, "wb")
- f.write(template.process(plugin, company, guid, generatedGuids, templateTime))
+ #Special case for binary files
+ if(tplFilename == "background.png"):
+ input = open(tplFile, "rb")
+ output = open(filename, "wb")
+ output.write(input.read())
+ else:
+ f = open(filename, "wb")
+ f.write(template.process(plugin, company, guid, generatedGuids, templateTime))
print " Processed", tpl
except:
print " Error processing", tpl
Oops, something went wrong.

0 comments on commit 076223e

Please sign in to comment.