--- libmpeg3-1.7.old/Makefile +++ libmpeg3-1.7/Makefile @@ -1,12 +1,11 @@ -CC = gcc -NASM = nasm +CC = gcc +NASM = nasm USE_MMX = 0 USE_CSS = 1 -A52DIR := $(shell expr a52dec* ) - +A52DIR = /usr/local/include/a52dec ifeq ("$(PREFIX)", "") -PREFIX=/usr +PREFIX=/usr/local endif ifeq ($(origin CFLAGS), environment) @@ -15,37 +14,31 @@ HAVE_CFLAGS := n endif - OBJDIR := $(shell uname --machine) - - - ifeq ($(OBJDIR), alpha) USE_MMX = 0 - ifneq ($(HAVE_CFLAGS), y) - CFLAGS := -O4 -arch ev67 -ieee -accept c99_keywords -gcc_messages - endif + # In which gcc could you use these flags? + #CFLAGS := -O4 -arch ev67 -mieee -accept c99_keywords -gcc_messages + ADD_CFLAGS := -O4 -mieee endif -ifeq ($(OBJDIR), i686) - USE_MMX = 1 - ifneq ($(HAVE_CFLAGS), y) - CFLAGS := -O2 -fomit-frame-pointer -falign-loops=2 -falign-jumps=2 -falign-functions=2 -I/usr/local/include - endif - CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE +ifeq ($(OBJDIR), i386) + USE_MMX = 0 + ADD_CFLAGS := -O2 -fomit-frame-pointer -falign-loops=2 -falign-jumps=2 -falign-functions=2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE endif ifeq ($(OBJDIR), x86_64) - ifneq ($(HAVE_CFLAGS), y) - CFLAGS := -O2 -fomit-frame-pointer -I/usr/local/include - endif - CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE - + ADD_CFLAGS := -O2 -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE endif +ifndef ADD_CFLAGS + # This is not a "supported" architecture. Fall on defaults. + ADD_CFLAGS := -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE +endif +CFLAGS += $(ADD_CFLAGS) ifeq ($(USE_CSS), 1) CFLAGS += -DHAVE_CSS @@ -53,32 +46,11 @@ ifeq ($(USE_MMX), 1) CFLAGS += -DHAVE_MMX - ASMOBJS = $(OBJDIR)/video/mmxidct.o + ASMOBJS = $(OBJDIR)/video/mmxidct.o NASMOBJS = $(OBJDIR)/video/reconmmx.o endif - - - - - -CFLAGS += \ - -I. \ - -I$(A52DIR)/include \ - -I$(A52DIR)/liba52 - - - -CFLAGS += -g - - - - - - - - - +CFLAGS += -I. -I$(A52DIR) OBJS = \ $(OBJDIR)/audio/ac3.o \ @@ -117,52 +89,37 @@ $(OBJDIR)/video/vlc.o \ $(OBJDIR)/workarounds.o -#OBJS = \ -# $(OBJDIR)/audio/ac3.o \ -# $(OBJDIR)/audio/bit_allocation.o \ -# $(OBJDIR)/audio/exponents.o \ -# $(OBJDIR)/audio/header.o \ -# $(OBJDIR)/audio/huffman.o \ -# $(OBJDIR)/audio/layer2.o \ -# $(OBJDIR)/audio/layer3.o \ -# $(OBJDIR)/audio/mantissa.o \ -# $(OBJDIR)/audio/pcm.o \ -# $(OBJDIR)/audio/tables.o \ - - - - DIRS := \ $(OBJDIR)/audio \ $(OBJDIR)/video -include Makefile.a52 - -DIRS += $(A52DIRS) - +SOBJS = $(OBJS:.o=.lo) +.SUFFIXES: .lo -OUTPUT = $(OBJDIR)/libmpeg3.a -UTILS = $(OBJDIR)/mpeg3dump $(OBJDIR)/mpeg3peek $(OBJDIR)/mpeg3toc $(OBJDIR)/mpeg3cat +version=1.5.4 +major=1 +SHLIB=libmpeg3.so +SHLIB_FULLNAME=$(SHLIB).$(version) +SHLIB_SONAME=$(SHLIB).$(major) + +OUTPUT = $(OBJDIR)/$(SHLIB_FULLNAME) +UTILS = \ + $(OBJDIR)/mpeg3dump $(OBJDIR)/mpeg3peek $(OBJDIR)/mpeg3toc \ + $(OBJDIR)/mpeg3cat -#$(OBJDIR)/mpeg3split - - -LIBS = -lm -lpthread - -$(shell if ! test -d $(OBJDIR) \; then mkdir -p $(OBJDIR) \; fi ) +LIBS = -lm -lpthread -la52 +$(shell mkdir -p $(OBJDIR) ) $(shell echo $(CFLAGS) > $(OBJDIR)/c_flags) -$(shell echo $(A52CFLAGS) > $(OBJDIR)/a52_flags) -$(shell echo $(OBJS) $(ASMOBJS) $(A52OBJS) $(NASMOBJS) > $(OBJDIR)/objs) +$(shell echo $(OBJS) $(ASMOBJS) $(NASMOBJS) > $(OBJDIR)/objs) $(shell mkdir -p $(DIRS) ) all: $(OUTPUT) $(UTILS) - -$(OUTPUT): $(OBJS) $(ASMOBJS) $(NASMOBJS) $(A52OBJS) - ar rcs $(OUTPUT) `cat $(OBJDIR)/objs` - - +$(OUTPUT): $(SOBJS) + gcc -shared -fPIC -o $(OUTPUT) \ +$(LIBS) $(SOBJS) $(LIBS) \ +-Wl,-soname -Wl,$(SHLIB_SONAME) $(OBJDIR)/mpeg3dump: $(OUTPUT) mpeg3dump.c $(CC) `cat $(OBJDIR)/c_flags` -o $(OBJDIR)/mpeg3dump mpeg3dump.c $(OUTPUT) $(LIBS) @@ -176,9 +133,6 @@ $(OBJDIR)/mpeg3cat: $(OUTPUT) mpeg3cat.c $(CC) `cat $(OBJDIR)/c_flags` -o $(OBJDIR)/mpeg3cat mpeg3cat.c $(OUTPUT) $(LIBS) -#$(OBJDIR)/mpeg3split: $(OUTPUT) -# $(CC) `cat $(OBJDIR)/c_flags` -o $(OBJDIR)/mpeg3split mpeg3split.c $(OUTPUT) $(LIBS) - $(OBJDIR)/mpeg2qt: $(OUTPUT) $(CC) `cat $(OBJDIR)/c_flags` -o $(OBJDIR)/mpeg2qt mpeg2qt.c \ $(OUTPUT) \ @@ -191,9 +145,15 @@ -ldl install: - cp $(UTILS) $(PREFIX)/bin -# cp $(OUTPUT) $(PREFIX)/lib -# cp libmpeg3.h mpeg3private.h $(PREFIX)/include + install -d $(PREFIX)/bin + install -m 755 $(UTILS) $(PREFIX)/bin + install -d $(PREFIX)/lib + cp -dp $(OUTPUT) $(PREFIX)/lib + install -d $(PREFIX)/include/audio + install -d $(PREFIX)/include/video + install -m 644 *.h $(PREFIX)/include + install -m 644 audio/*.h $(PREFIX)/include/audio + install -m 644 video/*.h $(PREFIX)/include/video clean: rm -rf $(OBJDIR) @@ -206,13 +166,13 @@ cat *.c *.h audio/*.c audio/*.h video/*.c video/*.h | wc $(OBJS): - $(CC) -c `cat $(OBJDIR)/c_flags` $(subst $(OBJDIR)/,, $*.c) -o $*.o + $(CC) -c -D_REENTRANT `cat $(OBJDIR)/c_flags` $(subst $(OBJDIR)/,, $*.c) -o $*.o +$(SOBJS): + $(CC) -c -D_REENTRANT -fPIC `cat $(OBJDIR)/c_flags` $(subst $(OBJDIR)/,, $*.c) -o $*.lo $(ASMOBJS): $(CC) -c `cat $(OBJDIR)/c_flags` $(subst $(OBJDIR)/,, $*.S) -o $*.o $(NASMOBJS): $(NASM) -f elf $(subst $(OBJDIR)/,, $*.s) -o $*.o -$(A52OBJS): - $(CC) -c `cat $(OBJDIR)/a52_flags` $(subst $(OBJDIR)/,, $*.c) -o $*.o $(OBJDIR)/libmpeg3.o: libmpeg3.c $(OBJDIR)/mpeg3atrack.o: mpeg3atrack.c @@ -222,41 +182,37 @@ $(OBJDIR)/mpeg3dump.o: mpeg3dump.c $(OBJDIR)/mpeg3ifo.o: mpeg3ifo.c $(OBJDIR)/mpeg3io.o: mpeg3io.c -$(OBJDIR)/mpeg3strack.o: mpeg3strack.c +$(OBJDIR)/mpeg3strack.o: mpeg3strack.c $(OBJDIR)/mpeg3title.o: mpeg3title.c $(OBJDIR)/mpeg3toc3.o: mpeg3toc3.c $(OBJDIR)/mpeg3toc.o: mpeg3toc.c -$(OBJDIR)/mpeg3tocutil.o: mpeg3tocutil.c +$(OBJDIR)/mpeg3tocutil.o: mpeg3tocutil.c $(OBJDIR)/mpeg3vtrack.o: mpeg3vtrack.c $(OBJDIR)/audio/ac3.o: audio/ac3.c -$(OBJDIR)/audio/bit_allocation.o: audio/bit_allocation.c +$(OBJDIR)/audio/bit_allocation.o: audio/bit_allocation.c $(OBJDIR)/audio/dct.o: audio/dct.c -$(OBJDIR)/audio/exponents.o: audio/exponents.c +$(OBJDIR)/audio/exponents.o: audio/exponents.c $(OBJDIR)/audio/header.o: audio/header.c $(OBJDIR)/audio/huffman.o: audio/huffman.c $(OBJDIR)/audio/layer2.o: audio/layer2.c $(OBJDIR)/audio/layer3.o: audio/layer3.c -$(OBJDIR)/audio/mantissa.o: audio/mantissa.c -$(OBJDIR)/audio/mpeg3audio.o: audio/mpeg3audio.c +$(OBJDIR)/audio/mantissa.o: audio/mantissa.c +$(OBJDIR)/audio/mpeg3audio.o: audio/mpeg3audio.c $(OBJDIR)/audio/pcm.o: audio/pcm.c -$(OBJDIR)/audio/synthesizers.o: audio/synthesizers.c +$(OBJDIR)/audio/synthesizers.o: audio/synthesizers.c $(OBJDIR)/audio/tables.o: audio/tables.c -$(OBJDIR)/video/getpicture.o: video/getpicture.c +$(OBJDIR)/video/getpicture.o: video/getpicture.c $(OBJDIR)/video/headers.o: video/headers.c $(OBJDIR)/video/idct.o: video/idct.c -$(OBJDIR)/video/macroblocks.o: video/macroblocks.c +$(OBJDIR)/video/macroblocks.o: video/macroblocks.c $(OBJDIR)/video/mmxtest.o: video/mmxtest.c $(OBJDIR)/video/motion.o: video/motion.c -$(OBJDIR)/video/mpeg3cache.o: video/mpeg3cache.c -$(OBJDIR)/video/mpeg3video.o: video/mpeg3video.c +$(OBJDIR)/video/mpeg3cache.o: video/mpeg3cache.c +$(OBJDIR)/video/mpeg3video.o: video/mpeg3video.c $(OBJDIR)/video/output.o: video/output.c -$(OBJDIR)/video/reconstruct.o: video/reconstruct.c +$(OBJDIR)/video/reconstruct.o: video/reconstruct.c $(OBJDIR)/video/seek.o: video/seek.c $(OBJDIR)/video/slice.o: video/slice.c -$(OBJDIR)/video/subtitle.o: video/subtitle.c +$(OBJDIR)/video/subtitle.o: video/subtitle.c $(OBJDIR)/video/vlc.o: video/vlc.c $(OBJDIR)/workarounds.o: workarounds.c - - - -include depend.a52 --- libmpeg3-1.7.old/audio/Makefile +++ libmpeg3-1.7/audio/Makefile @@ -18,7 +18,7 @@ all: $(OBJS) .c.o: - $(CC) -c `./c_flags` $*.c + $(CC) -c -fPIC `./c_flags` $*.c .s.o: $(CC) -f elf $*.s --- libmpeg3-1.7.old/mpeg3ifo.c +++ libmpeg3-1.7/mpeg3ifo.c @@ -534,7 +534,7 @@ // Skip CLUT // Skip PGC commands // Program map - if(program_map(file, cell_hdr_start, &cell_hdr)) + if(program_map(file, cell_hdr_start, (unsigned char **) &cell_hdr)) ; // Cell Positions --- libmpeg3-1.7.old/mpeg3private.h +++ libmpeg3-1.7/mpeg3private.h @@ -7,7 +7,10 @@ #include - +/* We need this define to access stat64 struct on Alpha */ +#ifndef __USE_LARGEFILE64 +#define __USE_LARGEFILE64 +#endif /* Constants */ --- libmpeg3-1.7.old/video/Makefile +++ libmpeg3-1.7/video/Makefile @@ -19,7 +19,7 @@ all: $(OBJS) $(MMXOBJS2) .c.o: - $(CC) -c `./c_flags` $*.c + $(CC) -c -fPIC `./c_flags` $*.c .s.o: $(NASM) -f elf $*.s