Commit 9f65b16e authored by Ralph Giles's avatar Ralph Giles
Browse files

Add a makefile for cross-compiling on mingw.

This builds win32 versions of the library and examples
on linux using the mingw-gcc cross toolchain and wine.

It also automates downloading and building the
required dependencies. Update the _URL and _SHA
variables to build against newer upstream releases.

Thanks to Ron and Mark Harris for help with the makefile.
parent 0b2fe85a
# Cross-compile opusfile under mingw
TOOL_PREFIX ?= i686-w64-mingw32
# To build opusfile under mingw, we first need to build:
DEPS = ogg opus ssl
ogg_URL :=
ogg_SHA := 3f687ccdd5ac8b52d76328fbbfebc70c459a40ea891dbf3dccb74a210826e79b
opus_URL :=
opus_SHA := 9b84ff56bd7720d5554103c557664efac2b8b18acc4bbcc234cb881ab9a3371e
ssl_URL :=
ssl_SHA := b3658b84e9ea606a5ded3c972a5517cd785282e7ea86b20c78aa4b773a047fb7
libopusfile-0.dll: ../unix/Makefile $(DEPS)
PKG_CONFIG_PATH=${PWD}/lib/pkgconfig \
$(MAKE) -f $<
opusfile: $(DEPS)
../configure --host=$(TOOL_PREFIX) --prefix=${PWD} \
$(RM) -r objs
# Generate rules to download and verify each dependency.
define WGET_template =
# Generate unpacked tarball name from the url.
$(1)_DIR := $$(basename $$(basename $$(notdir $$($(1)_URL))))
# Verify and unpack tarball.
$$($(1)_DIR): $$(notdir $$($(1)_URL))
@if test "$$($(1)_SHA)" = "$$$$(sha256sum $$< | cut -f 1 -d ' ')"; \
then \
echo "+ $$< checksum verified."; \
else \
echo "! $$< checksum didn't match!"; \
$(RM) $$<; exit 1; \
tar xf $$<
# Fetch tarball from the url.
$$(notdir $$($(1)_URL)):
wget $$($(1)_URL)
# Hook project-specific build rule.
$(1): $(1)_BUILD
$(foreach dep,$(DEPS),$(eval $(call WGET_template,$(dep))))
# Build scripts for each specific target.
# NOTE: 'make check' generally requires wine with cross-compiling.
ogg_BUILD: $(ogg_DIR)
cd $< && ./configure --host=$(TOOL_PREFIX) --prefix=${PWD}
$(MAKE) -C $< check
$(MAKE) -C $< install
opus_BUILD: $(opus_DIR)
cd $< && ./configure --host=$(TOOL_PREFIX) --prefix=${PWD}
$(MAKE) -C $< check
$(MAKE) -C $< install
ssl_BUILD: $(ssl_DIR)
cd $< && ./Configure shared mingw64 no-asm \
--prefix=${PWD} \
$(MAKE) -C $< depend
$(MAKE) -C $<
$(MAKE) -C $< install
# CROSS_COMPILE="i686-w64-mingw32-" ./Configure mingw no-asm no-shared --prefix=$PWD/mingw && make depend && make -j8 && make install
= Cross-compiling under mingw =
Just running 'make' in this directory should download
and build opusfile and it's dependencies. Some mingw
libraries need to be compiled into the final package.
== Generic instructions ==
To build opusfile under mingw, you need to first build:
For 'make check' to work, you may need wine installed.
To build openssl, try:
CROSS_COMPILE="i686-w64-mingw32-" ./Configure mingw no-asm no-shared --prefix=$PWD/mingw && make depend && make -j8 && make install
To build opusfile, try:
CC=i686-w64-mingw32-gcc PKG_CONFIG_PATH=$PWD/lib/pkgconfig RANLIB=i686-w64-mingw32-ranlib make -f ../unix/Makefile
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment