diff --git a/src/MacAppBundle/CMakeLists.txt b/src/MacAppBundle/CMakeLists.txt index d451dca5f..4dccdced0 100644 --- a/src/MacAppBundle/CMakeLists.txt +++ b/src/MacAppBundle/CMakeLists.txt @@ -12,6 +12,33 @@ endif() install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${PYTHON_DIR} ${CMAKE_INSTALL_LIBDIR}/${PYTHON_DIR_BASENAME} )") + +if(HOMEBREW_PREFIX) + #Homebrew installs python dependencies to a site dir in prefix/libexec + #and installs a .pth file containing its path to the HOMEBREW_PREFIX site dir. + + file(GLOB HOMEBREW_PTH_FILES "${PYTHON_DIR}/site-packages/homebrew*.pth") + + foreach(PTH_FILE ${HOMEBREW_PTH_FILES}) + file(READ ${PTH_FILE} ADDITIONAL_DIR) + + string(STRIP ${ADDITIONAL_DIR} ADDITIONAL_DIR) + string(REGEX REPLACE "^${HOMEBREW_PREFIX}/Cellar/([A-Za-z0-9_]+).*$" "\\1" LIB_NAME ${ADDITIONAL_DIR}) + string(REGEX REPLACE ".*libexec(.*)/site-packages" "libexec/${LIB_NAME}\\1" NEW_SITE_DIR ${ADDITIONAL_DIR}) + + install(DIRECTORY ${ADDITIONAL_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}/${NEW_SITE_DIR}) + + #update the paths of the .pth files copied into the bundle + get_filename_component(PTH_FILENAME ${PTH_FILE} NAME) + install(CODE + "file(WRITE + ${CMAKE_INSTALL_LIBDIR}/${PYTHON_DIR_BASENAME}/site-packages/${PTH_FILENAME} + \"../../../${NEW_SITE_DIR}/site-packages\" + )" + ) + endforeach(PTH_FILE) +endif() + install(DIRECTORY ${QT_PLUGINS_DIR}/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/qtplugins) #files installed by homebrew do not have write permission for regular user diff --git a/src/MacAppBundle/DiskImage/background.png b/src/MacAppBundle/DiskImage/background.png new file mode 100644 index 000000000..edef832d6 Binary files /dev/null and b/src/MacAppBundle/DiskImage/background.png differ diff --git a/src/MacAppBundle/DiskImage/layout.json b/src/MacAppBundle/DiskImage/layout.json new file mode 100644 index 000000000..0224c196c --- /dev/null +++ b/src/MacAppBundle/DiskImage/layout.json @@ -0,0 +1,20 @@ +{ + + "title": "FreeCAD", + + "icon": "../FreeCAD.app/Contents/Resources/freecad.icns", + + "icon-size": 80, + + "background": "background.png", + + "contents": [ + + { "x": 250, "y": 150, "type": "file", "path": "/usr/local/FreeCAD.app" }, + { "x": 475, "y": 150, "type": "link", "path": "/Applications" } + + ], + + "format": "UDZO" +} + diff --git a/src/Tools/ArchiveNameFromVersionHeader.py b/src/Tools/ArchiveNameFromVersionHeader.py new file mode 100644 index 000000000..51455228f --- /dev/null +++ b/src/Tools/ArchiveNameFromVersionHeader.py @@ -0,0 +1,53 @@ +#! python +### +# A convenience script to generate a deployment archive name of the form +# FreeCAD_{Major Version Number}.{Minor Version Number}-{Git Revision Count}.{Git Short SHA}-{OS}-{Arch} +# +import sys,string,getopt,platform + +def deserializeVersionHeader(path): + version = {} + try: + dat = open(path, 'r').readlines() + except IOError: + print 'Unable to open ', path + raise + + for l in dat: + tokens = l.split() + if len(tokens) > 1 and tokens[0].lower() == '#define': + version[tokens[1]] = tokens[2].replace('"',"") + + return version + +def main(): + OSAbbrev = {'Windows' : 'WIN', 'Darwin' : 'OSX'} + SHA = None + + if(len(sys.argv) < 2): + sys.stderr.write("Usage: archiveNameFromVersion [--git-SHA=]\n") + + try: + opts, args = getopt.getopt(sys.argv[2:], "g:", ["git-SHA="]) + except getopt.GetoptError: + pass + + for o, a in opts: + if o in ("-g", "--git-SHA"): + SHA = a + + version = deserializeVersionHeader(sys.argv[1]) + if SHA: + version['FCRepositoryHash'] = SHA + + print 'FreeCAD_{Major}.{Minor}-{RevCount}.{GitShortSHA}-{OS}-{Arch}'.format( + Major=version['FCVersionMajor'], + Minor=version['FCVersionMinor'], + RevCount=version['FCRevision'], + GitShortSHA=version['FCRepositoryHash'][0:7], + OS=OSAbbrev.get(platform.system(), 'LIN'), + Arch=platform.machine()) + +if __name__ == "__main__": + main() +