Skip to content

Instantly share code, notes, and snippets.

@ant32
Last active December 20, 2015 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ant32/6109115 to your computer and use it in GitHub Desktop.
Save ant32/6109115 to your computer and use it in GitHub Desktop.
mingw-w64-bullet PKGBUILD
# Maintainer: naelstrof <naelstrof@gmail.com>
# Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Paul Bienkowski <opatutlol@aol.com>
# Contributor: Christoph Zeiler <archNOSPAM_at_moonblade.dot.org>
pkgname=mingw-w64-bullet
pkgver=2.81
pkgrel=1
pkgdesc="A 3D Collision Detection and Rigid Body Dynamics Library for games and animation (mingw-w64)"
arch=('any')
url="http://www.bulletphysics.com/Bullet/"
license=('custom:zlib')
depends=('mingw-w64-crt')
options=(!strip !buildflags)
optdepends=('bullet-docs: documentation')
makedepends=('cmake' 'mingw-w64-gcc')
source=("http://bullet.googlecode.com/files/bullet-${pkgver}-rev2613.tgz"
"http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/gcc-4.7-release/i686-w64-mingw32-gcc-4.7.4-release-linux64_rubenvb.tar.xz"
"http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/gcc-4.7-release/x86_64-w64-mingw32-gcc-4.7.4-release-linux64_rubenvb.tar.xz")
md5sums=('cec9c9a79c2804dbf6385dd7d061346c'
'30578855ad61011b902ebfd79f43adbc'
'5fb5e8ce6b7c4d4c6144e9b65bfc139c')
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
build() {
cd ${srcdir}/bullet-${pkgver}-rev2613
#Requires fpermissive to allow losing precision in casts. (Should be safe)
echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")' >> CMakeLists.txt
unset LDFLAGS
original_path=$PATH
mv "${srcdir}/mingw64" "${srcdir}/x86_64-w64-mingw32-mingw"
mv "${srcdir}/mingw32" "${srcdir}/i686-w64-mingw32-mingw"
for _arch in ${_architectures}; do
export PATH=${srcdir}/${_arch}-mingw/bin:${srcdir}/${_arch}-mingw/${_arch}/bin:$original_path
mkdir -p ${srcdir}/build-${_arch} && cd ${srcdir}/build-${_arch}
echo "SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_C_COMPILER ${_arch}-gcc)
SET(CMAKE_CXX_COMPILER ${_arch}-g++)
SET(CMAKE_RC_COMPILER ${_arch}-windres)
SET(CMAKE_FIND_ROOT_PATH /usr/${_arch})
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" > temp.cmake
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=temp.cmake \
-DCMAKE_INSTALL_PREFIX=/usr/${_arch} \
-DBUILD_SHARED_LIBS=1 \
-DBUILD_DEMOS=0 \
-DBUILD_EXTRAS=1 \
-DINSTALL_LIBS=1 \
-DUSE_GLUT=0 \
-DINSTALL_EXTRA_LIBS=1 \
-DCMAKE_BUILD_TYPE=Release \
../bullet-${pkgver}-rev2613
make
done
}
package() {
original_path=$PATH
for _arch in ${_architectures}; do
export PATH=${srcdir}/${_arch}-mingw/bin:${srcdir}/${_arch}-mingw/${_arch}/bin:$original_path
cd ${srcdir}/build-${_arch}
make DESTDIR=${pkgdir} install
install -Dm644 ${srcdir}/bullet-${pkgver}-rev2613/BulletLicense.txt ${pkgdir}/usr/${_arch}/share/licenses/${pkgname}/LICENSE
mkdir -p $pkgdir/usr/${_arch}/bin
mv ${pkgdir}/usr/${_arch}/lib/*.dll $pkgdir/usr/${_arch}/bin/
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment