Merge branch 'stable'

Conflicts:
	.gitmodules
This commit is contained in:
proller 2014-12-03 21:33:55 +03:00
commit 900c39df79
9 changed files with 259 additions and 0 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "src/enet"]
path = src/enet
url = https://github.com/freeminer/enet.git
[submodule "build/osx/releases/dylibbundler"]
path = build/osx/releases/dylibbundler
url = https://github.com/auriamg/macdylibbundler.git

80
build/osx/README.md Normal file
View File

@ -0,0 +1,80 @@
## Script for automatic building of freeminer for OS X from GitHub
Originally was here https://github.com/mdoege/mtmake-osx
### Usage
Start Terminal.app (or any other terminal emulator for OS X) and install all dependencies (see below). It is recommended to use Homebrew for this, except for e.g. Xcode which you can download from Apple's Mac App Store for free.
Then clone the mtmake-osx build scripts from GitHub and start the compilation process like this:
git clone --recursive https://github.com/freeminer/freeminer
cd build/osx
bash make_mac.sh
This will compile freeminer, updating the app in releases/ and creating a ZIP file with the app bundle.
### Downloading mtmake-osx from GitHub as a ZIP file
(This section only applies if you cannot clone mtmake-osx with git for some reason.)
You cannot just go to the GitHub page and right click the script and do "save as...". This just saves the html page with the script. The entire folder provided on the GitHub page is required. Download the [zip file](https://github.com/mdoege/mtmake-osx/archive/master.zip), extract it, navigate inside it with a terminal and type ./make_mac.sh. The zip file with the application can be found in the "releases" folder.
### How it works
The script
* updates freeminer OS X executable and shared files
* does not change libraries (which is why a previous version of freeminer.app with its modified dynamic libraries is included)
### Dependencies
Install these pacakges with [Homebrew](http://brew.sh/) ("brew install cmake freetype gettext hiredis irrlicht jpeg leveldb libogg libvorbis luajit msgpack")
(snappy and libpng will get installed by brew automatically too.)
You need Xcode 5 and the Xcode Command Line Tools. You should get prompted for installation of the latter if you run the build script for the first time. Alternatively, start Xcode, go to Xcode->Preferences->Downloads and install a component named "Command Line Tools".
You will also have to install [XQuartz](http://xquartz.macosforge.org/) for X11 support.
If git is not installed, you can get it via Homebrew too: "brew install git"
Note that for compatibility with older CPUs (like Core 2) it is necessary to install
dependencies from bottles, because those are automatically compiled by Homebrew
to work on all CPUs supported by OS X Mavericks.
### Playing the game
* Use two finger tap for right click
* Use "e" for sneak/climb down (activate in 'Settings -> Change keys')
* If you would like to start the freeminer server from a terminal, run "/Applications/freeminer.app/Contents/Resources/bin/freeminer --server".
### How to update dynamic libraries (rarely needed)
The build_libs.sh script (in releases/) will rebuild the libs folder. This means that dynamic libraries which the MT executable depends on will get copied into the bundle directory.
Normally this should only be necessary if the libraries your executable got linked to have a different version number than the ones already in the bundle. Build_libs.sh will copy the libraries from e.g. the Homebrew folder (/usr/local/Cellar/) into the bundle and change their install names, so that every library in the bundle will match the globally installed libraries on your system.
Note that build_libs.sh needs an existing MT binary in freeminer-git/bin/ to scan for its dynamic library dependencies! So first you need to build MT itself successfully before you can then rebuild the libs folder.
Also, don't forget to create an updated ZIP file with update_zip.sh after running build_libs.sh if you intend to distribute the ZIP file!
Below are some explanations for manually updating libraries without the use of build_libs.sh. Normally this should not be needed but it explains what build_libs.sh does.
This command will create the libs directory and change library path names:
dylibbundler -x freeminer.app/Contents/Resources/bin/freeminer -b -d ./freeminer.app/Contents/libs/ \
-p @executable_path/../../libs/ -cd
(Note that this only works with an unmodified minetet binary that has not had its own link s changed by e.g. the dylibbundler invocation in make_mac.sh itself.)
Check if all no libraries point to Homebrew Cellar direcory any more:
$ for x in *.dylib ; do otool -L $x|grep Cell; done
Update a library reference that was not updated by dylibbundler with:
$ install_name_tool -change /usr/local/Cellar/libvorbis/1.3.4/lib/libvorbis.0.dylib \
@executable_path/../../libs/libvorbis.0.dylib libvorbisfile.3.dylib

95
build/osx/make_mac.sh Executable file
View File

@ -0,0 +1,95 @@
#!/bin/sh
STARTDIR=`pwd`
BRANCH='stable'
brew install cmake freetype gettext hiredis irrlicht jpeg leveldb libogg libvorbis luajit msgpack
git submodule update --init --recursive
# Clone MT source code if not already there
if [ ! -d "freeminer-git" ]; then
git clone --recursive -b $BRANCH https://github.com/freeminer/freeminer freeminer-git
fi
# Get default if it is not already there
if [ ! -d "default" ]; then
git clone --recursive https://github.com/freeminer/default
fi
# Update default from GitHub
(cd default && git pull)
# Get Carbone if it is not already there
if [ ! -d "carbone" ]; then
git clone --recursive https://git.gitorious.org/calinou/carbone.git
fi
# Update Carbone
(cd carbone && git pull)
# Get Voxelgarden if it is not already there
if [ ! -d "Voxelgarden" ]; then
git clone https://github.com/CasimirKaPazi/Voxelgarden.git
fi
# Update Voxelgarden
(cd Voxelgarden && git pull)
# Update source code and set version string
cd freeminer-git
git checkout --force $BRANCH --
git pull
git submodule update --init --recursive
gitver=`git log -1 --format='%cd.%h' --date=short | tr -d -`
#patch -p1 <../u64.patch
rm -f CMakeCache.txt
cmake . -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=0 -DENABLE_FREETYPE=on -DENABLE_LEVELDB=on -DENABLE_GETTEXT=on -DENABLE_REDIS=on -DBUILD_SERVER=NO -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_CXX_FLAGS="-mmacosx-version-min=10.10 -march=core2 -msse4.1" -DCMAKE_C_FLAGS="-mmacosx-version-min=10.10 -march=core2 -msse4.1" -DCUSTOM_GETTEXT_PATH=/usr/local/opt/gettext -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/lib"
make clean
make VERBOSE=1
if [ ! -f "bin/freeminer" ]; then
echo "compile fail"
exit
fi
cp -p bin/freeminer ../releases/freeminer.app/Contents/Resources/bin
cd ../releases
make -C dylibbundler
# Change library paths in binary to point to bundle directory
./dylibbundler/dylibbundler -x freeminer.app/Contents/Resources/bin/freeminer -d ./freeminer.app/Contents/libs/ -p @executable_path/../../libs/
echo "======== otool ======="
# Print library paths which should now point to the executable path
otool -L freeminer.app/Contents/Resources/bin/freeminer | grep executable
# Remove shared directories...
mkdir -p freeminer.app/Contents/Resources/bin/share/games
(cd freeminer.app/Contents/Resources/bin/share && rm -fr builtin client fonts locale textures)
# ...and copy new ones from source code directory
for i in builtin client fonts locale textures
do
cp -pr ../freeminer-git/$i freeminer.app/Contents/Resources/bin/share
done
# Copy subgames into games directory
rm -fr freeminer.app/Contents/Resources/bin/share/games/*
(cd freeminer.app/Contents/Resources/bin/share/games && mkdir default carbone Voxelgarden)
cp -pr $STARTDIR/default/* freeminer.app/Contents/Resources/bin/share/games/default/
cp -pr $STARTDIR/carbone/* freeminer.app/Contents/Resources/bin/share/games/carbone/
cp -pr $STARTDIR/Voxelgarden/* freeminer.app/Contents/Resources/bin/share/games/Voxelgarden/
# Create updated Info.plist with new version string
sysver=`sw_vers -productVersion`
sed -e "s/GIT_VERSION/$gitver/g" -e "s/MACOSX_DEPLOYMENT_TARGET/$sysver/g" Info.plist > freeminer.app/Contents/Info.plist
# Compress app bundle as a ZIP file
fname=freeminer-osx-bin-$gitver.zip
rm -f $fname
zip -9 -r $fname freeminer.app

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>freeminer</string>
<key>CFBundleIconFile</key>
<string>freeminer.icns</string>
<key>CFBundleIdentifier</key>
<string>freeminer.freeminer</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>freeminer</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>GIT_VERSION</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>GIT_VERSION</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>LSMinimumSystemVersion</key>
<string>MACOSX_DEPLOYMENT_TARGET</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
#!/bin/sh
# Build a new version of "libs/" folder with dynamic libraries
# Move old folder out of the way and copy unmodified binary to current folder
if [ -d "freeminer.app/Contents/libs" ]; then
mv freeminer.app/Contents/libs freeminer.app/Contents/libs.old
fi
cp ../freeminer-git/bin/freeminer .
# Run dylibbundler; this copies the libraries and adjusts their paths
dylibbundler/dylibbundler -x freeminer -b -d ./freeminer.app/Contents/libs/ -p @executable_path/../../libs/ -cd
rm freeminer
# dylibbundler does not update libvorbisfile correctly, so fix this here
install_name_tool -change /usr/local/Cellar/libvorbis/1.3.4/lib/libvorbis.0.dylib @executable_path/../../libs/libvorbis.0.dylib freeminer.app/Contents/libs/libvorbisfile.3.dylib
# This command should *not* print any libraries that still point to Homebrew's Cellar
echo "*** The following command should not print anything."
echo "*** If it does, please fix the offending library with install_name_tool!"
cd freeminer.app/Contents/libs
for x in *.dylib ; do otool -L $x|grep Cell; done

View File

@ -0,0 +1,4 @@
#!/bin/bash
tmp="`pwd`/$0"
bundle=`dirname "$tmp"`
exec "$bundle/../Resources/bin/freeminer"

13
build/osx/update_zip.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# Create an updated ZIP file from freeminer.app folder
cd freeminer-git
gitver=`git log -1 --format='%cd.%h' --date=short | tr -d -`
cd ../releases
# Compress app bundle as a ZIP file
fname=freeminer-osx-bin-$gitver.zip
rm -f $fname
zip -9 -r $fname freeminer.app

View File

@ -1546,6 +1546,11 @@ u32 Map::timerUpdate(float uptime, float unload_timeout,
else
{
#ifndef SERVER
if (block->mesh_old)
block->mesh_old = nullptr;
#endif
if (!block->m_uptime_timer_last) // not very good place, but minimum modifications
block->m_uptime_timer_last = uptime - 0.1;
block->incrementUsageTimer(uptime - block->m_uptime_timer_last);