Commit 82fdcfcf authored by Nico Sabbi's avatar Nico Sabbi

fix configure2 and Makefile to compile libdvdread

parent efa9e924
......@@ -9,44 +9,32 @@ LD=ld
RANLIB=ranlib
VPATH+= $(SRC_PATH_BARE)/src
SRCS = dvdnav.c highlight.c navigation.c read_cache.c remap.c searching.c settings.c
VPATH+= $(SRC_PATH_BARE)/src/vm
SRCS+= decoder.c vm.c vmcmd.c
HEADERS = src/dvd_types.h src/dvdnav.h src/dvdnav_events.h
CFLAGS += $(USEDEBUG) -Wall -funsigned-char
CFLAGS += -I$(CURDIR) -I$(SRC_PATH)/src -I$(SRC_PATH)/src/vm
CFLAGS += -DDVDNAV_COMPILE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS += -I$(CURDIR) -I$(SRC_PATH)/src
CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS += -DHAVE_CONFIG_H -DHAVE_DLFCN_H
L=libdvdnav
MINI_L=libdvdnavmini
ifeq ($(DVDREAD),internal)
L=libdvdread
DVDREAD_L=libdvdread
DVDREAD_LIB = $(DVDREAD_L).a
DVDREAD_SHLIB = $(DVDREAD_L).so
VPATH+= $(SRC_PATH_BARE)/src/libdvdread
DVDREAD_HEADERS = src/libdvdread/dvd_reader.h \
src/libdvdread/ifo_print.h \
src/libdvdread/ifo_read.h \
src/libdvdread/ifo_types.h \
src/libdvdread/nav_print.h \
src/libdvdread/nav_read.h \
src/libdvdread/dvd_udf.h \
src/libdvdread/nav_types.h \
src/libdvdread/bitreader.h
VPATH+= $(SRC_PATH_BARE)/src
DVDREAD_HEADERS = src/dvd_reader.h \
src/ifo_print.h \
src/ifo_read.h \
src/ifo_types.h \
src/nav_print.h \
src/nav_read.h \
src/dvd_udf.h \
src/nav_types.h \
src/bitreader.h
DVDREAD_SRCS = dvd_input.c dvd_reader.c dvd_udf.c ifo_print.c ifo_read.c \
md5.c nav_print.c nav_read.c bitreader.c
CFLAGS += -I$(SRC_PATH)/src/libdvdread
else
CFLAGS += -I$(DVDREAD_DIR)
endif
CFLAGS += -I$(SRC_PATH)/src
LIB = $(L).a
SHLIB = $(L).so
MINI_SHLIB = $(MINI_L).so
.OBJDIR= obj
DEPFLAG = -M
......@@ -61,13 +49,13 @@ DVDREAD_DEPS= ${DVDREAD_OBJS:%.o=%.d}
BUILDDEPS = Makefile config.mak
ifeq ($(BUILD_SHARED),yes)
all: $(SHLIB) $(MINI_SHLIB) $(DVDREAD_SHLIB) dvdnav-config dvdread-config
install: $(SHLIB) $(DVDREAD_SHLIB) install-shared install-dvdnav-config install-dvdread-config
all: $(SHLIB) $(DVDREAD_SHLIB) dvdread-config
install: $(SHLIB) $(DVDREAD_SHLIB) install-shared install-dvdread-config
endif
ifeq ($(BUILD_STATIC),yes)
all: $(LIB) $(DVDREAD_LIB) dvdnav-config dvdread-config
install: $(LIB) $(DVDREAD_LIB) install-static install-dvdnav-config install-dvdread-config
all: $(LIB) $(DVDREAD_LIB) dvdread-config
install: $(LIB) $(DVDREAD_LIB) install-static install-dvdread-config
endif
install: install-headers
......@@ -90,28 +78,12 @@ $(SRCS) $(DVDREAD_SRCS): version.h
$(.OBJDIR):
mkdir $(.OBJDIR)
${LIB}: version.h $(.OBJDIR) $(OBJS) $(BUILDDEPS)
cd $(.OBJDIR) && $(AR) rc $@ $(OBJS)
cd $(.OBJDIR) && $(RANLIB) $@
ifeq ($(DVDREAD),internal)
${DVDREAD_LIB}: version.h $(.OBJDIR) $(DVDREAD_OBJS) $(BUILDDEPS)
cd $(.OBJDIR) && $(AR) rc $@ $(DVDREAD_OBJS)
cd $(.OBJDIR) && $(RANLIB) $@
endif
ifeq ($(DVDREAD),internal)
${SHLIB}: version.h $(.OBJDIR) $(SHOBJS) $(BUILDDEPS) $(DVDREAD_SHLIB)
cd $(.OBJDIR) && $(CC) $(SHLDFLAGS) -L. -Wl,-soname=$(SHLIB).$(SHLIB_MAJOR) -o $@ $(SHOBJS) -ldvdread $(THREADLIB)
else
${SHLIB}: version.h $(.OBJDIR) $(SHOBJS) $(BUILDDEPS)
cd $(.OBJDIR) && $(CC) $(SHLDFLAGS) -Wl,-soname=$(SHLIB).$(SHLIB_MAJOR) -o $@ $(SHOBJS) -ldvdread $(THREADLIB)
endif
${MINI_SHLIB}: version.h $(.OBJDIR) $(SHOBJS) $(BUILDDEPS)
cd $(.OBJDIR) && $(CC) $(SHLDFLAGS) -Wl,-soname=$(MINI_SHLIB).$(SHLIB_MAJOR) -o $@ $(SHOBJS) $(THREADLIB)
ifeq ($(DVDREAD),internal)
${DVDREAD_SHLIB}: version.h $(.OBJDIR) $(DVDREAD_SHOBJS) $(BUILDDEPS)
cd $(.OBJDIR) && $(CC) $(SHLDFLAGS) -ldl -Wl,-soname=$(DVDREAD_SHLIB).$(SHLIB_MAJOR) -o $@ $(DVDREAD_SHOBJS)
endif
.c.so: $(BUILDDEPS)
cd $(.OBJDIR) && $(CC) -fPIC -DPIC -MD $(CFLAGS) -c -o $@ $<
......@@ -123,46 +95,32 @@ endif
# Install targets
install-headers:
install -d $(DESTDIR)$(incdir)
install -m 644 $(HEADERS) $(DESTDIR)$(incdir)
ifeq ($(DVDREAD),internal)
install -d $(DESTDIR)$(dvdread_incdir)
install -m 644 $(DVDREAD_HEADERS) $(DESTDIR)$(dvdread_incdir)
endif
install-shared: $(SHLIB)
install -d $(DESTDIR)$(shlibdir)
install $(INSTALLSTRIP) -m 755 $(.OBJDIR)/$(SHLIB) \
$(DESTDIR)$(shlibdir)/$(SHLIB).$(SHLIB_VERSION)
install $(INSTALLSTRIP) -m 755 $(.OBJDIR)/$(MINI_SHLIB) \
$(DESTDIR)$(shlibdir)/$(MINI_SHLIB).$(SHLIB_VERSION)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(SHLIB).$(SHLIB_VERSION) $(SHLIB).$(SHLIB_MAJOR)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(MINI_SHLIB).$(SHLIB_VERSION) $(MINI_SHLIB).$(SHLIB_MAJOR)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(SHLIB).$(SHLIB_MAJOR) $(SHLIB)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(MINI_SHLIB).$(SHLIB_MAJOR) $(MINI_SHLIB)
ifeq ($(DVDREAD),internal)
install $(INSTALLSTRIP) -m 755 $(.OBJDIR)/$(DVDREAD_SHLIB) \
$(DESTDIR)$(shlibdir)/$(DVDREAD_SHLIB).$(SHLIB_VERSION)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(DVDREAD_SHLIB).$(SHLIB_VERSION) $(DVDREAD_SHLIB).$(SHLIB_MAJOR)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(DVDREAD_SHLIB).$(SHLIB_MAJOR) $(DVDREAD_SHLIB)
endif
install-static: $(LIB)
install -d $(DESTDIR)$(libdir)
install $(INSTALLSTRIP) -m 755 $(.OBJDIR)/$(LIB) $(DESTDIR)$(libdir)/$(LIB)
ifeq ($(DVDREAD),internal)
install $(INSTALLSTRIP) -m 755 $(.OBJDIR)/$(DVDREAD_LIB) $(DESTDIR)$(libdir)/$(DVDREAD_LIB)
endif
# Clean targets
......@@ -175,22 +133,6 @@ distclean: clean
find . -name "*~" | xargs rm -rf
rm -rf config.mak
dvdnav-config: $(.OBJDIR)
@echo '#!/bin/sh' > $(.OBJDIR)/dvdnav-config
@echo 'prefix='$(PREFIX) >> $(.OBJDIR)/dvdnav-config
@echo 'libdir='$(shlibdir) >> $(.OBJDIR)/dvdnav-config
@echo 'version='$(SHLIB_VERSION) >> $(.OBJDIR)/dvdnav-config
@echo 'dvdread='$(DVDREAD) >> $(.OBJDIR)/dvdnav-config
@echo 'dvdreaddir='$(DVDREAD_DIR) >> $(.OBJDIR)/dvdnav-config
@echo 'threadlib='$(THREADLIB) >> $(.OBJDIR)/dvdnav-config
@echo >> $(.OBJDIR)/dvdnav-config
cat $(SRC_PATH_BARE)/misc/dvdnav-config2.sh >> $(.OBJDIR)/dvdnav-config
chmod 0755 $(.OBJDIR)/dvdnav-config
install-dvdnav-config: dvdnav-config
install -d $(DESTDIR)$(PREFIX)/bin
install -m 0755 $(.OBJDIR)/dvdnav-config $(DESTDIR)$(PREFIX)/bin/dvdnav-config
dvdread-config: $(.OBJDIR)
@echo '#!/bin/sh' > $(.OBJDIR)/dvdread-config
@echo 'prefix='$(PREFIX) >> $(.OBJDIR)/dvdread-config
......
#!/bin/sh
dvdnav_sh_version=4.1.2
dvdnav_sh_major=`echo $dvdnav_sh_version | awk -F. '{print $1}'`
dvdread_sh_version=4.1.2
dvdread_sh_major=`echo $dvdread_sh_version | awk -F. '{print $1}'`
cc=gcc
make=make
......@@ -27,14 +27,13 @@ show_help(){
echo " --prefix=PREFIX install in PREFIX [$PREFIX]"
echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]"
echo " --incdir=DIR install includes in DIR [PREFIX/include/dvdnav]"
echo " --incdir=DIR install includes in DIR [PREFIX/include/libdvdread]"
echo " --enable-static build static libraries [default=yes]"
echo " --disable-static do not build static libraries [default=no]"
echo " --enable-shared build shared libraries [default=no]"
echo " --disable-shared do not build shared libraries [default=yes]"
echo " --enable-debug compile with debug symbols [default=yes]"
echo " --disable-debug compile without debug symbols [default=no]"
echo " --with-dvdread=PATH compile libdvdnav with an external libdvdread"
echo "Advanced options (experts only):"
echo " --cc=CC use C compiler CC [$cc]"
echo " --make=MAKE use specified make [$make]"
......@@ -48,13 +47,10 @@ show_help(){
SHARED=yes
STATIC=yes
DVDREAD=internal
dvdread_dir=src/libdvdread/
PREFIX=/usr/local/
INSTALLSTRIP=-s
USEDEBUG=-g
optimizations="-O3"
threadlib="-lpthread"
for opt do
optval=`echo $opt | cut -d '=' -f 2-`
......@@ -67,8 +63,6 @@ for opt do
;;
--disable-static) STATIC=no
;;
--with-dvdread=*) DVDREAD="$optval"
;;
--prefix=*) PREFIX="$optval"
;;
--libdir=*) libdir="$optval"
......@@ -102,17 +96,7 @@ PREFIX=`cd $PREFIX && pwd`
test -z "$libdir" && libdir=$PREFIX/lib
test -z "$shlibdir" && shlibdir=$PREFIX/lib
test -z "$incdir" && incdir=$PREFIX/include/dvdnav && dvdread_incdir=$PREFIX/include/libdvdread
if [ "$DVDREAD" != "internal" ] ; then
if [ -d "$DVDREAD" -a -f "$DVDREAD/dvd_reader.h" ] ; then
dvdread_dir="$DVDREAD"
DVDREAD=external
else
DVDREAD=internal
fi
fi
test -z "$incdir" && dvdread_incdir=$PREFIX/include/libdvdread
targetos=`uname -s`
case $targetos in
......@@ -131,11 +115,10 @@ libdir=$libdir
shlibdir=$shlibdir
incdir=$incdir
dvdread_incdir=$dvdread_incdir
THREADLIB=$threadlib
BUILD_SHARED=$SHARED
BUILD_STATIC=$STATIC
SHLIB_VERSION=$dvdnav_sh_version
SHLIB_MAJOR=$dvdnav_sh_major
SHLIB_VERSION=$dvdread_sh_version
SHLIB_MAJOR=$dvdread_sh_major
CC=$cc
MAKE=$make
CFLAGS=$optimizations $cflags
......@@ -143,8 +126,6 @@ LDFLAGS=$ldflags
SHLDFLAGS=$SHLDFLAGS
INSTALLSTRIP=$INSTALLSTRIP
USEDEBUG=$USEDEBUG
DVDREAD=$DVDREAD
DVDREAD_DIR=$dvdread_dir
SRC_PATH="$source_path"
SRC_PATH_BARE=$source_path
......
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