Commit 96d081c1 authored by Hendricks266's avatar Hendricks266 Committed by Erik de Castro Lopo
Browse files

Fix building with MSYS and MinGW(-w64); Improve Makefile.lite build system



This is a patch to allow building of the project using MSYS, MinGW, and MinGW-w64 with the following invocation:

make -f Makefile.lite libFLAC libFLAC++ flac metaflac test_libs_common test_libFLAC test_libFLAC++ test_grabbag test_seeking test_streams utils examples

This patch addresses eight points:
1. `uname -p` in MSYS returns "unknown" so we must use `gcc -dumpmachine` to gain information about the target, 32-bit or 64-bit.
2. MinGW-w64 does not ship with a working iconv.h, so we must disable it under this specific compiler.
3. The code requires <inttypes.h> in a handful of C files, but config.mk did not contain -DHAVE_INTTYPES_H, which under the full build process (I assume) is added by autoconf.
4. The compiler complained when lround() in lpc.c was static, so it is no longer static.
5. Additional scattered linking directives (and reordering) (particularly FLAC, grabbag, and replaygain_analysis) were necessary to build some of the components.
6. The Makefile.lite build system benefited from some cleanup, particularly by rigorously defining all entries, factoring redundancy, and establishing dependencies. (Some typos were fixed too.)
7. Shared objects on Windows use .dll, not .so. (Added *.dll, *.dylib, and *.exe to .gitignore.)
8. To allow more freedom using Makefile.lite without configure, I added the variables USE_OGG and USE_ICONV which can toggle these two components in the build process.
ex: make -f Makefile.lite examples USE_OGG=0 USE_ICONV=0

These improvements make use of some use-time Makefile variable expansion.
Signed-off-by: Erik de Castro Lopo's avatarErik de Castro Lopo <erikd@mega-nerd.com>
parent 0da96d3c
......@@ -20,14 +20,15 @@
#
topdir = ../..
libdir = $(topdir)/obj/$(BUILD)/lib
LIB_NAME = libxmms-flac
INCLUDES = -I./include -I$(topdir)/include -I.. $(shell xmms-config --cflags)
# refer to the static libs explicitly
ifeq ($(OS),Darwin)
LIBS = $(topdir)/obj/$(BUILD)/lib/libFLAC.a $(topdir)/obj/$(BUILD)/lib/libplugin_common.a $(topdir)/obj/$(BUILD)/lib/libgrabbag.a $(topdir)/obj/$(BUILD)/lib/libreplaygain_analysis.a $(topdir)/obj/$(BUILD)/lib/libreplaygain_synthesis.a $(OGG_LIB_DIR)/libogg.a -liconv -lstdc++ -lz
LIBS = $(libdir)/libFLAC.a $(libdir)/libplugin_common.a $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libreplaygain_synthesis.a $(OGG_EXPLICIT_LIBS) $(ICONV_LIBS) -lm -lstdc++ -lz
else
LIBS = $(topdir)/obj/$(BUILD)/lib/libFLAC.a $(topdir)/obj/$(BUILD)/lib/libplugin_common.a $(topdir)/obj/$(BUILD)/lib/libgrabbag.a $(topdir)/obj/$(BUILD)/lib/libreplaygain_analysis.a $(topdir)/obj/$(BUILD)/lib/libreplaygain_synthesis.a -L$(OGG_LIB_DIR) -logg -lstdc++ -lz
LIBS = $(libdir)/libFLAC.a $(libdir)/libplugin_common.a $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libreplaygain_synthesis.a $(OGG_LIBS) -lm -lsupc++ -lz
endif
SRCS_C = \
......
......@@ -16,7 +16,7 @@
# distribution.
.PHONY: all getopt grabbag replaygain_analysis replaygain_synthesis utf8
all: getopt grabbag replaygain_analysis replaygain_synthesis utf8
all: getopt replaygain_analysis grabbag replaygain_synthesis utf8
DEFAULT_CONFIG = release
......@@ -33,10 +33,10 @@ release : all
getopt:
(cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))
grabbag:
replaygain_analysis:
(cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))
replaygain_analysis:
grabbag:
(cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG))
replaygain_synthesis:
......
......@@ -3,11 +3,19 @@
#
topdir = ../../..
libdir = $(topdir)/obj/$(BUILD)/lib
ifeq ($(OS),Darwin)
EXPLICIT_LIBS = $(libdir)/libFLAC.a $(libdir)/libreplaygain_analysis.a $(OGG_EXPLICIT_LIBS) -lm
else
LIBS = -lFLAC -lreplaygain_analysis $(OGG_LIBS) -lm
endif
LIB_NAME = libgrabbag
INCLUDES = -I$(topdir)/include
SRCS_C = \
alloc.c \
cuesheet.c \
file.c \
picture.c \
......
......@@ -3,8 +3,16 @@
#
topdir = ../../..
libdir = $(topdir)/obj/$(BUILD)/lib
LIB_NAME = libutf8
ifeq ($(OS),Darwin)
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(ICONV_LIBS)
else
LIBS = -lgrabbag $(ICONV_LIBS)
endif
INCLUDES = -I$(topdir)/include -I$(topdir)/include/share
SRCS_C = \
......
......@@ -27,9 +27,9 @@ PROGRAM_NAME = test_cuesheet
INCLUDES = -I./include -I$(topdir)/include
ifeq ($(OS),Darwin)
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
else
LIBS = -lgrabbag -lreplaygain_analysis -lFLAC -L$(OGG_LIB_DIR) -logg -lm
LIBS = -lgrabbag -lreplaygain_analysis -lFLAC $(OGG_LIBS) -lm
endif
SRCS_C = \
......
......@@ -27,9 +27,9 @@ PROGRAM_NAME = test_picture
INCLUDES = -I./include -I$(topdir)/include
ifeq ($(OS),Darwin)
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
else
LIBS = -lgrabbag -lreplaygain_analysis -lFLAC -L$(OGG_LIB_DIR) -logg -lm
LIBS = -lgrabbag -lreplaygain_analysis -lFLAC $(OGG_LIBS) -lm
endif
SRCS_C = \
......
......@@ -27,9 +27,9 @@ PROGRAM_NAME = test_libFLAC++
INCLUDES = -I$(topdir)/include
ifeq ($(OS),Darwin)
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libtest_libs_common.a $(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libtest_libs_common.a $(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
else
LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC++ -lFLAC -L$(OGG_LIB_DIR) -logg -lm
LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC++ -lFLAC $(OGG_LIBS) -lm
endif
SRCS_CPP = \
......
......@@ -27,9 +27,9 @@ PROGRAM_NAME = test_libFLAC
INCLUDES = -I../libFLAC/include -I$(topdir)/include
ifeq ($(OS),Darwin)
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libtest_libs_common.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libtest_libs_common.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
else
LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC -L$(OGG_LIB_DIR) -logg -lm
LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC $(OGG_LIBS) -lm
endif
SRCS_C = \
......
......@@ -24,6 +24,12 @@ libdir = $(topdir)/obj/$(BUILD)/lib
LIB_NAME = libtest_libs_common
ifeq ($(OS),Darwin)
EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
else
LIBS = -lFLAC $(OGG_LIBS) -lm
endif
INCLUDES = -I$(topdir)/include
SRCS_C = \
......
......@@ -27,9 +27,9 @@ PROGRAM_NAME = test_seeking
INCLUDES = -I../libFLAC/include -I$(topdir)/include
ifeq ($(OS),Darwin)
EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
else
LIBS = -lFLAC -L$(OGG_LIB_DIR) -logg -lm
LIBS = -lFLAC $(OGG_LIBS) -lm
endif
SRCS_C = \
......
......@@ -27,9 +27,9 @@ PROGRAM_NAME = flacdiff
INCLUDES = -I$(topdir)/include
ifeq ($(OS),Darwin)
EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm
EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
else
LIBS = -lFLAC++ -lFLAC -L$(OGG_LIB_DIR) -logg -lm
LIBS = -lFLAC++ -lFLAC $(OGG_LIBS) -lm
endif
SRCS_CPP = \
......
# flactimer - Runs a command and prints timing information
# Copyright (C) 2007,2008,2009 Josh Coalson
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# GNU makefile
#
topdir = ../../..
libdir = $(topdir)/obj/$(BUILD)/lib
PROGRAM_NAME = flactimer
INCLUDES = -I$(topdir)/include
ifeq ($(OS),Darwin)
EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm
else
LIBS = -lFLAC++ -lFLAC $(OGG_LIBS) -lm
endif
SRCS_CPP = \
main.cpp
include $(topdir)/build/exe.mk
LINK = $(CCC) $(LINKAGE)
# DO NOT DELETE THIS LINE -- make depend depends on it.
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