Building tar.bz2 archives instead of DMG. Added verbose mode. Done some cleaning.

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1207 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
ceylo 2009-08-28 15:28:41 +00:00
parent 6a3e2079f5
commit 7b37972deb

View File

@ -1,4 +1,30 @@
#!/bin/sh #!/bin/sh
############################################################
#
# SFML - Simple and Fast Multimedia Library
# Copyright (C) 2007-2009 Lucas Soltic (ceylow@gmail.com) and Laurent Gomila (laurent.gom@gmail.com)
#
# This software is provided 'as-is', without any express or implied warranty.
# In no event will the authors be held liable for any damages arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it freely,
# subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented;
# you must not claim that you wrote the original software.
# If you use this software in a product, an acknowledgment
# in the product documentation would be appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such,
# and must not be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source distribution.
#
############################################################
cd ../../../ cd ../../../
SFML_VERSION="1.6" SFML_VERSION="1.6"
@ -43,6 +69,8 @@ SHOULD_CONSIDER_CXX="yes"
SHOULD_CONSIDER_C="yes" SHOULD_CONSIDER_C="yes"
SHOULD_CONSIDER_SAMPLES="yes" SHOULD_CONSIDER_SAMPLES="yes"
VERBOSE_OUTPUT="/dev/null"
# Checks that last command ended normally. Prints an error message and exists if not. # Checks that last command ended normally. Prints an error message and exists if not.
check_last_process() check_last_process()
{ {
@ -61,15 +89,20 @@ check_last_process()
# User help # User help
print_usage() print_usage()
{ {
echo "Usage: $0 [clean | build | build-samples | build-pkg | all]" echo "Usage: $0 [clean | build | build-samples | build-pkg | all [--verbose]]"
echo " Default shows this help"
echo echo
echo "Commands:"
echo " clean\t\tdeletes the C and C++ frameworks, object files and packages" echo " clean\t\tdeletes the C and C++ frameworks, object files and packages"
echo " build\t\tcompiles all the C and C++ SFML frameworks" echo " build\t\tcompiles all the C and C++ SFML frameworks"
echo " build-samples\tcompiles the SFML samples" echo " build-samples\tcompiles the SFML samples"
echo " build-pkg\t\tbuilds the packages to be distributed" echo " build-pkg\t\tbuilds the packages to be distributed"
echo " all\t\t\tdoes build, build-samples and build-pkg" echo " all\t\t\tdoes build, build-samples and build-pkg"
echo " help (default)\tshows this usage information"
echo echo
echo "Options:"
echo " --verbose\t\tdo not hide standard ouput, errors are still shown"
echo
echo "Contents summary:"
echo " Found C++ project : $SHOULD_CONSIDER_CXX" echo " Found C++ project : $SHOULD_CONSIDER_CXX"
echo " Found C project : $SHOULD_CONSIDER_C" echo " Found C project : $SHOULD_CONSIDER_C"
echo " Found samples project : $SHOULD_CONSIDER_SAMPLES" echo " Found samples project : $SHOULD_CONSIDER_SAMPLES"
@ -135,7 +168,7 @@ remove_dir()
{ {
if test -d "$1" if test -d "$1"
then then
rm -rfv "$1" > /dev/null rm -rfv "$1" > "$VERBOSE_OUTPUT"
fi fi
} }
@ -144,7 +177,7 @@ remove_file()
{ {
if test -f "$1" if test -f "$1"
then then
rm -f "$1" > /dev/null rm -f "$1" > "$VERBOSE_OUTPUT"
fi fi
} }
@ -176,7 +209,7 @@ clean_all()
if test -d "$XCODE_CXX_ROOT_DIR/$XCODE_FRAMEWORKS_PROJECT" if test -d "$XCODE_CXX_ROOT_DIR/$XCODE_FRAMEWORKS_PROJECT"
then then
cd "$XCODE_CXX_ROOT_DIR" cd "$XCODE_CXX_ROOT_DIR"
xcodebuild -project "$XCODE_FRAMEWORKS_PROJECT" -target "All" -configuration "$XCODE_BUILD_STYLE" clean > /dev/null xcodebuild -project "$XCODE_FRAMEWORKS_PROJECT" -target "All" -configuration "$XCODE_BUILD_STYLE" clean > "$VERBOSE_OUTPUT"
check_last_process " done" check_last_process " done"
else else
if test -d "$XCODE_CXX_ROOT_DIR" if test -d "$XCODE_CXX_ROOT_DIR"
@ -189,6 +222,7 @@ clean_all()
fi fi
fi fi
# Process cleaning for C project # Process cleaning for C project
if [ "$SHOULD_CONSIDER_C" == "yes" ] if [ "$SHOULD_CONSIDER_C" == "yes" ]
then then
@ -196,7 +230,7 @@ clean_all()
if test -d "$XCODE_C_ROOT_DIR/$XCODE_FRAMEWORKS_PROJECT" if test -d "$XCODE_C_ROOT_DIR/$XCODE_FRAMEWORKS_PROJECT"
then then
cd "$XCODE_C_ROOT_DIR" cd "$XCODE_C_ROOT_DIR"
xcodebuild -project "$XCODE_FRAMEWORKS_PROJECT" -target "All" -configuration "$XCODE_BUILD_STYLE" clean > /dev/null xcodebuild -project "$XCODE_FRAMEWORKS_PROJECT" -target "All" -configuration "$XCODE_BUILD_STYLE" clean > "$VERBOSE_OUTPUT"
check_last_process " done" check_last_process " done"
else else
# Do not produce error if the package does no contain the C stuff # Do not produce error if the package does no contain the C stuff
@ -217,7 +251,7 @@ clean_all()
if test -d "$XCODE_SAMPLES_ROOT_DIR/$XCODE_SAMPLES_PROJECT" if test -d "$XCODE_SAMPLES_ROOT_DIR/$XCODE_SAMPLES_PROJECT"
then then
cd "$XCODE_SAMPLES_ROOT_DIR" cd "$XCODE_SAMPLES_ROOT_DIR"
xcodebuild -project "$XCODE_SAMPLES_PROJECT" -target "All" -configuration "$XCODE_BUILD_STYLE" clean > /dev/null xcodebuild -project "$XCODE_SAMPLES_PROJECT" -target "All" -configuration "$XCODE_BUILD_STYLE" clean > "$VERBOSE_OUTPUT"
check_last_process " done" check_last_process " done"
else else
# Do not produce error if the package does not contain the samples # Do not produce error if the package does not contain the samples
@ -253,7 +287,7 @@ build_frameworks()
for target in "${XCODE_CXX_TARGETS[@]}" for target in "${XCODE_CXX_TARGETS[@]}"
do do
printf "Building $target framework..." printf "Building $target framework..."
xcodebuild -project "$XCODE_FRAMEWORKS_PROJECT" -target "$target" -parallelizeTargets -configuration "$XCODE_BUILD_STYLE" build > /dev/null xcodebuild -project "$XCODE_FRAMEWORKS_PROJECT" -target "$target" -parallelizeTargets -configuration "$XCODE_BUILD_STYLE" build > "$VERBOSE_OUTPUT"
check_last_process " done" check_last_process " done"
done done
@ -277,7 +311,7 @@ build_frameworks()
for target in "${XCODE_C_TARGETS[@]}" for target in "${XCODE_C_TARGETS[@]}"
do do
printf "Building $target framework..." printf "Building $target framework..."
xcodebuild -project "$XCODE_FRAMEWORKS_PROJECT" -target "$target" -parallelizeTargets -configuration "$XCODE_BUILD_STYLE" build > /dev/null xcodebuild -project "$XCODE_FRAMEWORKS_PROJECT" -target "$target" -parallelizeTargets -configuration "$XCODE_BUILD_STYLE" build > "$VERBOSE_OUTPUT"
check_last_process " done" check_last_process " done"
done done
@ -302,7 +336,7 @@ build_samples()
if test -d "$XCODE_SAMPLES_ROOT_DIR/$XCODE_SAMPLES_PROJECT" if test -d "$XCODE_SAMPLES_ROOT_DIR/$XCODE_SAMPLES_PROJECT"
then then
# Build the samples # Build the samples
xcodebuild -project "$XCODE_SAMPLES_PROJECT" -target "All" -parallelizeTargets -configuration "$XCODE_BUILD_STYLE" build > /dev/null xcodebuild -project "$XCODE_SAMPLES_PROJECT" -target "All" -parallelizeTargets -configuration "$XCODE_BUILD_STYLE" build > "$VERBOSE_OUTPUT"
check_last_process " done" check_last_process " done"
echo "In order to run the samples, the SFML frameworks (located in \"lib\") must be copied in the /Library/Frameworks directory." > "$CXX_SAMPLES_DIR/README" echo "In order to run the samples, the SFML frameworks (located in \"lib\") must be copied in the /Library/Frameworks directory." > "$CXX_SAMPLES_DIR/README"
check_last_process check_last_process
@ -323,7 +357,7 @@ copy_info_files()
done done
} }
# Build the disk image files of the C and C++ Dev and SDK packages # Build the archives of the C and C++ Dev and SDK packages
build_packages() build_packages()
{ {
cd "$ROOT_DIR" cd "$ROOT_DIR"
@ -341,7 +375,7 @@ build_packages()
"doc") "doc")
if ! test -f "$ROOT_DIR/$dir/html/index.htm" if ! test -f "$ROOT_DIR/$dir/html/index.htm"
then then
echo "$ROOT_DIR/$dir/html/index.htm not found. Make sure the documentation has been built." echo "*** $ROOT_DIR/$dir/html/index.htm not found. Make sure the documentation has been built."
exit 1 exit 1
fi fi
;; ;;
@ -353,10 +387,9 @@ build_packages()
copy_info_files "$CXX_SDK_PACKAGE_DIR" copy_info_files "$CXX_SDK_PACKAGE_DIR"
check_last_process check_last_process
# Build the disk image file # Build the archive
printf "Made final folder, building Disk Image File..." cd "$PACKAGES_ROOT_DIR"
remove_file "$PACKAGES_ROOT_DIR/$CXX_SDK_PACKAGE.dmg" tar -cjlf "$PACKAGES_ROOT_DIR/$CXX_SDK_PACKAGE.tar.bz2" "$CXX_SDK_PACKAGE" > "$VERBOSE_OUTPUT"
hdiutil create -format UDBZ -volname "$CXX_SDK_PACKAGE" -srcfolder "$CXX_SDK_PACKAGE_DIR" "$PACKAGES_ROOT_DIR/$CXX_SDK_PACKAGE.dmg" > /dev/null
check_last_process " done" check_last_process " done"
# Build the C++ Dev package # Build the C++ Dev package
@ -386,10 +419,9 @@ build_packages()
done done
copy_info_files "$CXX_DEV_PACKAGE_DIR" copy_info_files "$CXX_DEV_PACKAGE_DIR"
# Build the disk image file # Build the archive
printf "Made final folder, building Disk Image File..." cd "$PACKAGES_ROOT_DIR"
remove_file "$PACKAGES_ROOT_DIR/$CXX_DEV_PACKAGE.dmg" tar -cjlf "$PACKAGES_ROOT_DIR/$CXX_DEV_PACKAGE.tar.bz2" "$CXX_DEV_PACKAGE" > "$VERBOSE_OUTPUT"
hdiutil create -format UDBZ -volname "$CXX_DEV_PACKAGE" -srcfolder "$CXX_DEV_PACKAGE_DIR" "$PACKAGES_ROOT_DIR/$CXX_DEV_PACKAGE.dmg" > /dev/null
check_last_process " done" check_last_process " done"
fi # SHOULD_CONSIDER_CXX fi # SHOULD_CONSIDER_CXX
@ -413,10 +445,9 @@ build_packages()
done done
copy_info_files "$C_SDK_PACKAGE_DIR" copy_info_files "$C_SDK_PACKAGE_DIR"
# Build the disk image file # Build the archive
printf "Made final folder, building Disk Image File..." cd "$PACKAGES_ROOT_DIR"
remove_file "$PACKAGES_ROOT_DIR/$C_SDK_PACKAGE.dmg" tar -cjlf "$PACKAGES_ROOT_DIR/$C_SDK_PACKAGE.tar.bz2" "$C_SDK_PACKAGE" > "$VERBOSE_OUTPUT"
hdiutil create -format UDBZ -volname "$C_SDK_PACKAGE" -srcfolder "$C_SDK_PACKAGE_DIR" "$PACKAGES_ROOT_DIR/$C_SDK_PACKAGE.dmg" > /dev/null
check_last_process " done" check_last_process " done"
# Build the C Development package # Build the C Development package
@ -454,10 +485,9 @@ build_packages()
done done
copy_info_files "$C_DEV_PACKAGE_DIR" copy_info_files "$C_DEV_PACKAGE_DIR"
# Build the disk image file # Build the archive
printf "Made final folder, building Disk Image File..." cd "$PACKAGES_ROOT_DIR"
remove_file "$PACKAGES_ROOT_DIR/$C_DEV_PACKAGE.dmg" tar -cjlf "$PACKAGES_ROOT_DIR/$C_DEV_PACKAGE.tar.bz2" "$C_DEV_PACKAGE" > "$VERBOSE_OUTPUT"
hdiutil create -format UDBZ -volname "$C_DEV_PACKAGE" -srcfolder "$C_DEV_PACKAGE_DIR" "$PACKAGES_ROOT_DIR/$C_DEV_PACKAGE.dmg" > /dev/null
check_last_process " done" check_last_process " done"
fi fi
@ -476,6 +506,14 @@ main()
action="$1" action="$1"
fi fi
for flag in $*
do
if [ "$flag" == "--verbose" ]
then
VERBOSE_OUTPUT="/dev/stdout"
fi
done
case $action in case $action in
"clean") "clean")
clean_all $* clean_all $*
@ -503,6 +541,9 @@ main()
"help") "help")
print_usage $* print_usage $*
;; ;;
"--verbose")
echo "--verbose option cannot be used alone. See usage."
;;
*) *)
echo "Unknow action $action." echo "Unknow action $action."
print_usage $* print_usage $*