Skip to content

Commit

Permalink
Add physfs 2+ cross compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Safety0ff committed Mar 2, 2011
1 parent a6e2291 commit eb60d35
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 2 deletions.
1 change: 1 addition & 0 deletions win32/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ EXTRA_DIST = __BUILD_SCRIPT \
libs/iconv/Makefile \
libs/ogg/Makefile \
libs/png/Makefile \
libs/physfs/Makefile \
libs/quesoglc/Makefile \
libs/quesoglc/patches \
libs/sdl/Makefile \
Expand Down
23 changes: 23 additions & 0 deletions win32/Toolchain-mingw32.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)

SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)

# Define paths to search for libraries
SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc/ ${CMAKE_SOURCE_DIR}/win32/build/libs/)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# Don't search in native paths, just the specified root paths
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

# FIXME CMake's defaults struggle to find these
SET(OPENAL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/win32/build/libs/include/AL)
SET(OPENAL_LIBRARY ${CMAKE_SOURCE_DIR}/win32/build/libs/lib/libopenal32.a)
# Our openal lib doesn't have correct capitalisation (e.g. OpenAL or al or openal or OpenAL32) , which causes issues.

SET(SDL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/win32/build/libs/include/SDL)

SET(NEED_DEP_DEPS TRUE) # Our CC dev pkg don't link the deps of the deps, so we need to do this

SET(MINGW TRUE) # just in case...
2 changes: 1 addition & 1 deletion win32/libs/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBDIRS=dejavu devpkg expat freetype2 gettext iconv zlib fontconfig ogg png quesoglc sdl vorbis theora
SUBDIRS=dejavu devpkg expat freetype2 gettext iconv zlib physfs fontconfig ogg png quesoglc sdl vorbis theora

all: all-recursive
build: build-recursive
Expand Down
2 changes: 1 addition & 1 deletion win32/libs/devpkg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE)
echo mkdir -p $(TOPDIR)/build/libs ; \
mkdir -p $(TOPDIR)/build/libs || exit ; \
}
tar -x -j -C $(TOPDIR)/build/libs -f $^
tar -x --keep-newer-files -j -C $(TOPDIR)/build/libs -f $^
touch extract-stamp

all: build
Expand Down
30 changes: 30 additions & 0 deletions win32/libs/physfs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
PKG_NAME:=physfs
PKG_VERSION=2.0.2

PKG_SOURCEBASE:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_SOURCEBASE).tar.gz
PKG_SOURCE_URL:= \
http://icculus.org/physfs/downloads/
PKG_MD5SUM:=4e8927c3d30279b03e2592106eb9184a

TARGET:=$(TOPDIR)/build/libs/lib/libphysfs.a

include $(TOPDIR)/rules.mk

extract-stamp: $(DOWNLOADS)/$(PKG_SOURCE)
tar xvzf $^
touch extract-stamp

$(PKG_SOURCEBASE)/Makefile: extract-stamp
cd $(PKG_SOURCEBASE) && cmake -DCMAKE_TOOLCHAIN_FILE=`pwd`/../$(TOPDIR)/Toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=`pwd`/../$(TOPDIR)/build/libs -DPHYSFS_BUILD_SHARED=FALSE -DPHYSFS_INTERNAL_ZLIB=FALSE -DZLIB_INCLUDE_DIR=`pwd`/../$(TOPDIR)/build/libs/include -DZLIB_LIBRARY=`pwd`/../$(TOPDIR)/build/libs/lib/libz.a -DPHYSFS_BUILD_TEST=FALSE -DPHYSFS_BUILD_WX_TEST=FALSE .

$(TARGET): $(PKG_SOURCEBASE)/Makefile
$(MAKE) -C $(PKG_SOURCEBASE) $(MAKE_FLAGS) install

all: build
build: $(TARGET)

clean:
$(MAKE) -C $(PKG_SOURCEBASE) clean

.PHONY: all build clean

0 comments on commit eb60d35

Please sign in to comment.