1#!/bin/sh 2# 3# This script makes a Apple Mac OS X framework for PETSc 4# 5# ./configure --download-mpich --with-fc=0 -download-mpich-shared=0 --with-shared-libraries 6# 7# To use the framework: 8# 9# 1) replace all #include <petscXXX.h> in application with #import <PETSc/petscXXX.h> 10# 2a) compile with, for example, cc -v ex1.c -o ex1 -I/opt/local/include -F ${PETSC_DIR}/${PETSC_ARCH} -framework PETSc or 11# 2b) copy ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework to /System/Library/Frameworks/ then you do not need the -F option 12# 3) you can also use the framework inside Xcode by simply indicating the targets dependence on the PETSc framework 13# 14# 15rm -rf ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework 16 17mkdir ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework 18mkdir ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework/Versions 19mkdir ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework/Versions/A 20cd ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework/Versions/ 21ln -s A Current 22 23cd A 24mkdir Headers 25cp ${PETSC_DIR}/include/*.h Headers 26cp ${PETSC_DIR}/${PETSC_ARCH}/include/*.h Headers 27cp -r ${PETSC_DIR}/include/petsc-private Headers 28cd Headers 29sed -i "" "s?#include [ ]*<petsc-private?#import <PETSc/petsc-private?g" *.h petsc-private/*.h 30sed -i "" "s?#include [ ]*<petsc?#import <PETSc/petsc?g" *.h petsc-private/*.h 31sed -i "" "s?#include [ ]*<mpi?#import <PETSc/mpi?g" *.h petsc-private/*.h 32cd .. 33 34cp ${PETSC_DIR}/${PETSC_ARCH}/lib/libpetsc.dylib PETSc 35mkdir Resources 36cd Resources 37cat <<EOF > Info.plist 38<?xml version="1.0" encoding="UTF-8"?> 39<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 40<plist version="1.0"> 41<dict> 42 <key>BuildMachineOSBuild</key> 43 <string>12A269</string> 44 <key>CFBundleDevelopmentRegion</key> 45 <string>English</string> 46 <key>CFBundleExecutable</key> 47 <string>PETSc</string> 48 <key>CFBundleIdentifier</key> 49 <string>gov.anl.mcs.PETSc</string> 50 <key>CFBundleInfoDictionaryVersion</key> 51 <string>6.0</string> 52 <key>CFBundleName</key> 53 <string>PETSc</string> 54 <key>CFBundlePackageType</key> 55 <string>FMWK</string> 56 <key>CFBundleShortVersionString</key> 57 <string>1.0</string> 58 <key>CFBundleSignature</key> 59 <string>????</string> 60 <key>CFBundleVersion</key> 61 <string>1</string> 62 <key>DTCompiler</key> 63 <string></string> 64 <key>DTPlatformBuild</key> 65 <string>4F250</string> 66 <key>DTPlatformVersion</key> 67 <string>GM</string> 68 <key>DTSDKBuild</key> 69 <string>12A264</string> 70 <key>DTSDKName</key> 71 <string>macosx10.8</string> 72 <key>DTXcode</key> 73 <string>0440</string> 74 <key>DTXcodeBuild</key> 75 <string>4F250</string> 76 <key>NSHumanReadableCopyright</key> 77 <string>Copyright © 2012 Argonne National Laboratory. All rights reserved.</string> 78</dict> 79</plist> 80EOF 81 82cd ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework 83ln -s Versions/Current/Headers Headers 84ln -s Versions/Current/PETSc PETSc 85ln -s Versions/Current/Resources Resources 86 87