Use MacCompileStuff for every macOS package
(cherry-picked from commit 6f8c504121
)
This commit is contained in:
parent
9fb1ee2308
commit
e4da9d9af4
2 changed files with 16 additions and 251 deletions
|
@ -7,154 +7,7 @@
|
|||
|
||||
starttimestamp=$(date +%s)
|
||||
|
||||
###Required Version Defines
|
||||
sdl2_required_version="2.0.8"
|
||||
sdl2_image_required_version="2.0.3"
|
||||
sdl2_mixer_required_version="2.0.2"
|
||||
sdl2_net_required_version="2.0.1"
|
||||
###/Required Version Defines
|
||||
|
||||
###Sha256
|
||||
sdl2_dmg_sha256="74dd2cb6b18e35e8181523590115f10f1da774939c21ce27768a2a80ba57ad5f"
|
||||
sdl2_image_dmg_sha256="f1beefadf4dfc4f923c5cdb37d012fd94063b9c5085f492f9170e0043778db4a"
|
||||
sdl2_mixer_dmg_sha256="174a371e2acdfa7ae26be71134b9925f46e5257c8c8d608f09a6726a0368606b"
|
||||
sdl2_net_dmg_sha256="3a126e31b323d832be0ef4b9941fc3113b931e42a26e9bcc989487fd5348f858"
|
||||
###/Sha256
|
||||
|
||||
###Pango and Cairo
|
||||
cairo_headers_path=""
|
||||
pango_headers_path=""
|
||||
libcairo_path=""
|
||||
libpango_path=""
|
||||
libpangocairo_path=""
|
||||
libpangoft2_path=""
|
||||
###/Pango and Cairo
|
||||
|
||||
###Functions
|
||||
brew_install() {
|
||||
local PACKAGE=$1
|
||||
if ! brew ls --versions ${PACKAGE} > /dev/null; then
|
||||
echo "==> Installing ${PACKAGE}"
|
||||
brew install ${PACKAGE}
|
||||
fi
|
||||
}
|
||||
|
||||
pango_and_cairo_download() {
|
||||
local REQUIRED_VERSION=$1
|
||||
|
||||
if ! [ -d "$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION" ]; then
|
||||
echo "==> Downloading MacCompileStuff for $REQUIRED_VERSION branch"
|
||||
wget "https://github.com/hrubymar10/MacCompileStuff/archive/$REQUIRED_VERSION.zip" -q --show-progress
|
||||
unzip -q "$REQUIRED_VERSION.zip"
|
||||
rm "$REQUIRED_VERSION.zip"
|
||||
else
|
||||
echo "==> Using MacCompileStuff for $REQUIRED_VERSION branch from temp"
|
||||
fi
|
||||
|
||||
if [ -d "$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION/Headers/cairo" ]; then
|
||||
cairo_headers_path="$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION/Headers/cairo"
|
||||
else
|
||||
echo "Error: Can't find Cairo's headers! Please report this here: https://github.com/hrubymar10/MacCompileStuff/issues/new" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION/Headers/pango" ]; then
|
||||
pango_headers_path="$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION/Headers/pango"
|
||||
else
|
||||
echo "Error: Can't find Pango's headers! Please report this here: https://github.com/hrubymar10/MacCompileStuff/issues/new" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION/lib/libcairo.2.dylib" ]; then
|
||||
libcairo_path="$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION/lib/libcairo.2.dylib"
|
||||
else
|
||||
echo "Error: Can't find libcairo.2.dylib! Please report this here: https://github.com/hrubymar10/MacCompileStuff/issues/new" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION/lib/libpango-1.0.0.dylib" ]; then
|
||||
libpango_path="$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION/lib/libpango-1.0.0.dylib"
|
||||
else
|
||||
echo "Error: Can't find libpango-1.0.0.dylib! Please report this here: https://github.com/hrubymar10/MacCompileStuff/issues/new" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION/lib/libpangocairo-1.0.0.dylib" ]; then
|
||||
libpangocairo_path="$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION/lib/libpangocairo-1.0.0.dylib"
|
||||
else
|
||||
echo "Error: Can't find libpangocairo-1.0.0.dylib! Please report this here: https://github.com/hrubymar10/MacCompileStuff/issues/new" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION/lib/libpangoft2-1.0.0.dylib" ]; then
|
||||
libpangoft2_path="$MY_PATH/temp/MacCompileStuff-$REQUIRED_VERSION/lib/libpangoft2-1.0.0.dylib"
|
||||
else
|
||||
echo "Error: Can't find libpangoft2-1.0.0.dylib! Please report this here: https://github.com/hrubymar10/MacCompileStuff/issues/new" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
framework_install() {
|
||||
local PACKAGE=$1
|
||||
local REQUIRED_VERSION=$2
|
||||
local SHA256=$3
|
||||
path="none"
|
||||
if [ -d "/Library/Frameworks/$PACKAGE.framework" ]; then
|
||||
VERSION=`defaults read /Library/Frameworks/$PACKAGE.framework/Versions/A/Resources/Info.plist CFBundleVersion`
|
||||
if [ "$VERSION" == "$REQUIRED_VERSION" ]; then
|
||||
echo "==> Using $PACKAGE.framework from /Library/Frameworks"
|
||||
path="/Library/Frameworks/$PACKAGE.framework"
|
||||
fi
|
||||
fi
|
||||
if [ "$path" == "none" ]; then
|
||||
if [ -d "$MY_PATH/temp/$PACKAGE.framework" ]; then
|
||||
VERSION=`defaults read $MY_PATH/temp/$PACKAGE.framework/Versions/A/Resources/Info.plist CFBundleVersion`
|
||||
if [ "$VERSION" == "$REQUIRED_VERSION" ]; then
|
||||
echo "==> Using $PACKAGE.framework from temp"
|
||||
path="$MY_PATH/temp/$PACKAGE.framework"
|
||||
else
|
||||
echo "==> Found old $PACKAGE.framework in temp"
|
||||
rm -rf $PACKAGE.framework
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ "$path" == "none" ]; then
|
||||
echo "==> Downloading $PACKAGE $REQUIRED_VERSION"
|
||||
if [ -f "$PACKAGE-$REQUIRED_VERSION.dmg" ]; then
|
||||
rm "$PACKAGE-$REQUIRED_VERSION.dmg"
|
||||
fi
|
||||
if [ "$PACKAGE" == "SDL2" ]; then
|
||||
wget "https://www.libsdl.org/release/$PACKAGE-$REQUIRED_VERSION.dmg" -q --show-progress
|
||||
else
|
||||
wget "https://www.libsdl.org/projects/$(echo "$PACKAGE" | sed -e 's/SDL2/SDL/g')/release/$PACKAGE-$REQUIRED_VERSION.dmg" -q --show-progress
|
||||
fi
|
||||
if [ "$(shasum -a 256 $PACKAGE-$REQUIRED_VERSION.dmg | awk '{print $1}')" != $SHA256 ]; then
|
||||
echo "Error: SHA256 Checksum of $PACKAGE-$REQUIRED_VERSION.dmg doesn't match!" >&2
|
||||
exit 1
|
||||
fi
|
||||
hdiutil attach "$PACKAGE-$REQUIRED_VERSION.dmg" > /dev/null
|
||||
cp -Rf /Volumes/$PACKAGE/$PACKAGE.framework $PACKAGE.framework
|
||||
hdiutil detach /Volumes/$PACKAGE > /dev/null
|
||||
path="$MY_PATH/temp/$PACKAGE.framework"
|
||||
fi
|
||||
}
|
||||
|
||||
edit_dylib_deps() {
|
||||
DYLIB=$1
|
||||
DEPS=$(otool -L ${DYLIB} | awk '{print $1;}' | tail -n +2)
|
||||
|
||||
for DEP in $DEPS; do
|
||||
DEP_BASE=$(basename ${DEP})
|
||||
if [ "$DEP_BASE" == "$(basename $DYLIB)" ]; then
|
||||
continue
|
||||
fi
|
||||
# Is this our redistributable file?
|
||||
if [ -f $(dirname ${DYLIB})/${DEP_BASE} ]; then
|
||||
install_name_tool -change "${DEP}" "@loader_path/${DEP_BASE}" ${DYLIB}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
time_interval_to_string() {
|
||||
local START=$1
|
||||
local END=$2
|
||||
|
@ -202,104 +55,32 @@ if ! [ -d "Wesnoth.xcodeproj" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if xcode-select --install 2>&1 | grep installed; then
|
||||
echo "==> Xcode Command Line Tools are installed..."
|
||||
else
|
||||
echo "==> Xcode Command Line Tools aren't installed, installing..."
|
||||
xcode-select --install
|
||||
fi
|
||||
|
||||
if ! [ -x "$(command -v brew)" ]; then
|
||||
echo 'Error: Homebrew is not installed. See https://brew.sh/' >&2
|
||||
if ! [ -x "$(command -v git)" ]; then
|
||||
echo 'Error: Git is not installed. Use for example Homebrew to install git. https://brew.sh/' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BREW_PACKAGES="boost fontconfig freetype gettext glib graphite2 harfbuzz libffi libpng openssl@1.1 pcre pixman readline wget"
|
||||
for PACKAGE in ${BREW_PACKAGES}; do
|
||||
brew_install ${PACKAGE}
|
||||
done
|
||||
|
||||
if ! [ -d temp ]; then
|
||||
mkdir temp
|
||||
fi
|
||||
cd temp
|
||||
pango_and_cairo_download "master"
|
||||
if ! [ -d MacCompileStuff ]; then
|
||||
git clone -b master https://github.com/hrubymar10/MacCompileStuff MacCompileStuff-master
|
||||
fi
|
||||
cd MacCompileStuff-master
|
||||
git pull
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
if [ -d "Headers" ]; then
|
||||
if ! [ -L "Headers" ]; then
|
||||
rm -rf Headers
|
||||
ln -s temp/MacCompileStuff-master/Headers
|
||||
fi
|
||||
mkdir Headers
|
||||
cd Headers
|
||||
ln -s "$cairo_headers_path"
|
||||
ln -s "$pango_headers_path"
|
||||
ln -s /usr/local/opt/boost/include/boost
|
||||
ln -s /usr/local/opt/fontconfig/include/fontconfig
|
||||
ln -s /usr/local/opt/glib/include/glib-2.0
|
||||
ln -s /usr/local/opt/glib/lib/glib-2.0/include/glibconfig.h
|
||||
ln -s /usr/local/opt/gettext/include/libintl.h
|
||||
ln -s /usr/local/opt/openssl@1.1/include/openssl
|
||||
ln -s /usr/local/opt/readline/include/readline
|
||||
cd ..
|
||||
|
||||
if ! [ -d temp ]; then
|
||||
mkdir temp
|
||||
fi
|
||||
cd temp
|
||||
###SDL2
|
||||
framework_install "SDL2" "$sdl2_required_version" "$sdl2_dmg_sha256"
|
||||
sdl2_path="$path"
|
||||
###/SDL2
|
||||
|
||||
###SDL2_image
|
||||
framework_install "SDL2_image" "$sdl2_image_required_version" "$sdl2_image_dmg_sha256"
|
||||
sdl2_image_path="$path"
|
||||
###/SDL2_image
|
||||
|
||||
###SDL2_mixer
|
||||
framework_install "SDL2_mixer" "$sdl2_mixer_required_version" "$sdl2_mixer_dmg_sha256"
|
||||
sdl2_mixer_path="$path"
|
||||
###/SDL2_mixer
|
||||
|
||||
###SDL2_net
|
||||
framework_install "SDL2_net" "$sdl2_net_required_version" "$sdl2_net_dmg_sha256"
|
||||
sdl2_net_path="$path"
|
||||
###/SDL2_net
|
||||
cd ..
|
||||
|
||||
if [ -d "lib" ]; then
|
||||
if ! [ -L "lib" ]; then
|
||||
rm -rf lib
|
||||
ln -s temp/MacCompileStuff-master/lib
|
||||
fi
|
||||
mkdir lib
|
||||
cd lib
|
||||
cp "$libcairo_path" ./
|
||||
cp "$libpango_path" "$libpangocairo_path" "$libpangoft2_path" ./
|
||||
cp /usr/local/opt/boost/lib/libboost_chrono-mt.dylib /usr/local/opt/boost/lib/libboost_filesystem-mt.dylib /usr/local/opt/boost/lib/libboost_iostreams-mt.dylib /usr/local/opt/boost/lib/libboost_locale-mt.dylib /usr/local/opt/boost/lib/libboost_program_options-mt.dylib /usr/local/opt/boost/lib/libboost_random-mt.dylib /usr/local/opt/boost/lib/libboost_regex-mt.dylib /usr/local/opt/boost/lib/libboost_system-mt.dylib /usr/local/opt/boost/lib/libboost_timer-mt.dylib /usr/local/opt/boost/lib/libboost_unit_test_framework-mt.dylib ./
|
||||
cp /usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib ./
|
||||
cp /usr/local/opt/libffi/lib/libffi.6.dylib ./
|
||||
cp /usr/local/opt/fontconfig/lib/libfontconfig.1.dylib ./
|
||||
cp /usr/local/opt/freetype/lib/libfreetype.6.dylib ./
|
||||
cp /usr/local/opt/glib/lib/libglib-2.0.0.dylib /usr/local/opt/glib/lib/libgmodule-2.0.0.dylib /usr/local/opt/glib/lib/libgobject-2.0.0.dylib /usr/local/opt/glib/lib/libgthread-2.0.0.dylib ./
|
||||
cp /usr/local/opt/graphite2/lib/libgraphite2.3.0.1.dylib ./libgraphite2.3.dylib
|
||||
cp /usr/local/opt/harfbuzz/lib/libharfbuzz.0.dylib ./
|
||||
cp /usr/local/opt/gettext/lib/libintl.8.dylib ./
|
||||
cp /usr/local/opt/pcre/lib/libpcre.1.dylib ./
|
||||
cp /usr/local/opt/pixman/lib/libpixman-1.0.dylib ./
|
||||
cp /usr/local/opt/libpng/lib/libpng16.16.dylib ./
|
||||
cp /usr/local/opt/readline/lib/libreadline.7.0.dylib ./
|
||||
chmod 755 *
|
||||
|
||||
for filename in * ; do
|
||||
install_name_tool -id "@executable_path/../Frameworks/$filename" "$filename"
|
||||
edit_dylib_deps $filename
|
||||
done
|
||||
|
||||
ln -s "$sdl2_path"
|
||||
ln -s "$sdl2_image_path"
|
||||
ln -s "$sdl2_mixer_path"
|
||||
ln -s "$sdl2_net_path"
|
||||
|
||||
|
||||
|
||||
echo "==> DONE ..."
|
||||
echo
|
||||
|
|
|
@ -1,23 +1,10 @@
|
|||
# Building with Xcode
|
||||
|
||||
## Types of builds and requirements
|
||||
Currently there are two types of builds:
|
||||
|
||||
* **local builds** - **Recommended** - useful for regular builds which should work mainly on actual system and hardware. They are easiest to reproduce.
|
||||
* **package builds** - useful (only) for packagers. These builds are trying to be as compatible as possible. They depends on `MacCompileStuff` which contains precompiled universal but sometimes outdated libraries.
|
||||
|
||||
### Requirements for local builds
|
||||
* Xcode 7.2.1 or higher...
|
||||
* Mac OS X [10.10.5](https://docs.brew.sh/Installation#2) or higher...
|
||||
* `scons` and `gettext` (if you want to compile translations)
|
||||
* Homebrew from https://brew.sh/
|
||||
|
||||
### Requirements for package builds
|
||||
### Requirements for building Wesnoth
|
||||
* Xcode 5.1.1 or higher...
|
||||
* Mac OS X 10.8.5 or higher...
|
||||
* `git`
|
||||
* `scons` and `gettext` (if you want to compile translations)
|
||||
* The Headers and lib folders, which can be found in the MacCompileStuff repository here:
|
||||
https://github.com/hrubymar10/MacCompileStuff/tree/master
|
||||
|
||||
## Targets
|
||||
* **Wesnoth**:
|
||||
|
@ -46,9 +33,7 @@ Builds for maximum compiling speed, and uses the current OS as the SDK. If you j
|
|||
## Step by step building
|
||||
1. Obtain sources from github using `git clone https://github.com/wesnoth/wesnoth` or use your favourite git program
|
||||
2. Use `Finder` to navigate into `wesnoth/projectfiles/Xcode` . And now, there will be 2 options.
|
||||
|
||||
3. If you are going to build **local build** you can just double click on `Fix_Xcode_Dependencies` script and wait until it will be done.
|
||||
4. If you are going to build **package build** you must download `MacCompileStuff` and extract it here.
|
||||
3. Double click on `Fix_Xcode_Dependencies` script and wait until it will be done.
|
||||
5. (Optional) Compile translations as it is described in **Translations** section.
|
||||
6. Now you can open `Wesnoth.xcodeproj` file in Xcode.
|
||||
|
||||
|
@ -58,11 +43,10 @@ To compile translations you need `gettext-tools` and `scons`. You can obtain the
|
|||
## Packaging
|
||||
When compiling Wesnoth for an official release, the following steps should be taken:
|
||||
|
||||
* You must use **package build**!
|
||||
* Update version numbers in Info.plist (if not already by the release manager).
|
||||
* Update the changelog in SDLMain.nib with `changelog.md`.
|
||||
* Rebuild translations `scons translations`.
|
||||
* Rebuild all in XCode (clean all, then build). Be sure to set it to release configuration first!
|
||||
* Rebuild all in XCode (clean all, then build). Be sure to set it to RELEASE configuration first!
|
||||
* Download old `.dmg` release.
|
||||
* Convert it using Disk Utility to Read and Write disk image and mount it.
|
||||
* Delete old `Wesnoth.app` and copy new `Wesnoth.app`.
|
||||
|
|
Loading…
Add table
Reference in a new issue