File: ArrangeDMG.sh

package info (click to toggle)
openscenegraph 2.8.3-5
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 33,968 kB
  • ctags: 30,935
  • sloc: cpp: 287,169; ansic: 9,050; sh: 654; yacc: 548; objc: 374; makefile: 264; lex: 151; perl: 119
file content (159 lines) | stat: -rw-r--r-- 5,714 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/bin/bash
#!/bin/sh

#####################################################################
# Author: Eric Wing
# 
# This is a stripped down version of my original Build_OSG_OSX.sh
# script. This just copies all the already built binaries 
# into a structure that is near-ready for distribution.
# 
# Usage: You should run this from the directory above the OSG-projects
# ("AnyDirectory" in the picture below)
# bash OpenSceneGraph/Xcode/Misc/ArrangeDMG.sh
#
# The Xcode projects were designed so all three projects could be 
# built without any configuration or installation on the users end 
# if the directory structure followed this simple layout:
#
# AnyDirectory/
#   OpenThreads/
#     Xcode/
#       OpenThreads/
#         OpenThreads.xcode
#    OpenSceneGraph/
#      Xcode/
#        OpenSceneGraph/
#          OpenSceneGraph.xcode
#
# Simply put, the root directories for the 3 projects must be at the 
# same level. If you placed my Xcode tarball for each of 3 projects in
# each of the project's respective root directories, my projects should 
# extract themselves in the correct layout when you double click the 
# tarballs.
#
# You may place this script and run it from the same directory level 
# that OpenThreads and OpenSceneGraph exist in.
# 
#####################################################################

# CpMac is deprecated now that cp works properly in Tiger
#COPY="/Developer/Tools/CpMac -r"
COPY="/bin/cp -R"
SVN="svn"
#COPY="mv -f"

#BUILDACTION="clean build"
#CONFIGURATION="Development"
CONFIGURATION="Deployment"

#GDAL_LOCATION="/Library/Frameworks"

# Clean up from previous builds?
echo "Deleteing PackageDir to begin anew"
rm -rf PackageDir
#rm -f OpenSceneGraph.dmg

# Make a directory that will hold all the things to be distributed.
mkdir -p PackageDir
# Make a subdirectory in PackageDir that will hold all the Frameworks
mkdir -p PackageDir/Frameworks
# Make a subdirectory in PackageDir that will hold all the osgPlugins
mkdir -p PackageDir/PlugIns

mkdir -p PackageDir/Examples

mkdir -p PackageDir/XcodeTemplates

mkdir -p PackageDir/Resources

mkdir -p PackageDir/.background


# Everything should be built now. Move all the things to be distrubuted 
# to the PackageDir with the appropriate layout.

echo "Copying Frameworks..."

#$COPY OpenThreads/Xcode/OpenThreads/build/$CONFIGURATION/OpenThreads.framework PackageDir/Frameworks
#$COPY OpenSceneGraph/Xcode/OpenSceneGraph/build/$CONFIGURATION/osg*.framework PackageDir/Frameworks/
$COPY OpenSceneGraph/Xcode/OpenSceneGraph/build/$CONFIGURATION/*.framework PackageDir/Frameworks/

# Copy the gdal framework 
#$COPY $GDAL_LOCATION/gdal.framework PackageDir/Frameworks

echo "Copying PlugIns..."
$COPY OpenSceneGraph/Xcode/OpenSceneGraph/build/$CONFIGURATION/*.so PackageDir/PlugIns/

echo "Copying Examples..."
$COPY OpenSceneGraph/Xcode/OpenSceneGraph/build/$CONFIGURATION/*.app PackageDir/Examples/

echo "Copying Xcode templates..."
$COPY OpenSceneGraph/Xcode/XcodeTemplates PackageDir
# If we are in CVS, all the CVS junk got copied in so we need to remove it
#find -d PackageDir/XcodeTemplates -name CVS -exec rm -rf {} \;
find -d PackageDir/XcodeTemplates -name .svn -exec rm -rf {} \;


echo "Copying License and ReadMe files..."
#$COPY OpenThreads/COPYING.txt PackageDir/LICENSE_OpenThreads.txt
$COPY OpenSceneGraph/LICENSE.txt PackageDir/LICENSE_OSG.txt
$COPY OpenSceneGraph/Xcode/OSX_OSG_README.rtf PackageDir

# Copy the background image and .DS_Store for 'fancy' DMG
$COPY OpenSceneGraph/Xcode/Packaging/Resources/instlogo.pdf PackageDir/.background
$COPY OpenSceneGraph/Xcode/Misc/DSStoreForDMG PackageDir/.DS_Store


# Sorry, I think this is bourne only
echo "Setting up symbolic links for the .app's..."
(cd PackageDir/Examples
	for file in *.app; do
#		echo ${file}
		(cd "$file/Contents"; \
			ln -s ../../../Frameworks/ Frameworks; \
			ln -s ../../../PlugIns/ PlugIns; \
			ln -s ../../../Resources/ Resources;
		)
	done
)

echo "Testing for OpenSceneGraph-Data..."


# If OpenSceneGraph-Data/ resides next to OpenSceneGraph/, then use it
if [ -d OpenSceneGraph-Data ]; then
	echo "Found OpenSceneGraph-Data and will copy into PackageDir/Resources."
	# Determine if it is a subversion copy or not; we don't want the repo info
	if [ -d OpenSceneGraph-Data/.svn ]; then
		$SVN export --force OpenSceneGraph-Data PackageDir/Resources	
	else
		$COPY OpenSceneGraph-Data PackageDir/Resources
	fi

	echo "Creating DMG using:"
	echo "hdiutil create -ov -fs HFS+ -volname OpenSceneGraph -srcfolder PackageDir OpenSceneGraph.dmg"
	/usr/bin/hdiutil create -ov -fs HFS+ -volname OpenSceneGraph -srcfolder PackageDir OpenSceneGraph.dmg

else
	# Not sure how to find the OSG data, so it has to be done manually
	# Would Spotlight help?
	#echo "Next, you must (manually) copy all the OSG-data to PackageDir/Resources and the LICENCE_GDAL.rtf to PackageDir."
	echo "Did not find OpenSceneGraph-Data/ aside OpenSceneGraph/."
	echo "Next, you must (manually) copy all the OSG-data to PackageDir/Resources."

	echo "Looking up possible location for OpenSceneGraph-Data"
	#/usr/bin/perl OpenSceneGraph/Xcode/Misc/FindOSGData.pl
	/usr/bin/perl OpenSceneGraph/Xcode/Misc/FindOSGData.pl --single
	#echo "Looking up location for LICENSE_GDAL.rtf"
	#/usr/bin/perl OpenSceneGraph/Xcode/Misc/FindOSGData.pl --single LICENSE_GDAL.rtf

	echo "After you copy the remaining resources, you will want to package up the DMG. You can use the following line as the basis:"
	echo "hdiutil create -ov -fs HFS+ -volname OpenSceneGraph -srcfolder PackageDir OpenSceneGraph.dmg"
fi


# Now we want to package up everything into a .dmg
#hdiutil create -ov -fs HFS+ -volname OpenSceneGraph -srcfolder PackageDir OpenSceneGraph.dmg