openbsd-ports/www/tidy/patches/patch-build_gmake_Makefile
pvalchev ae882a6fda update to tidy-051026
build shared library (to be used by outside apps like php, etc)
fix makefile to allow fake to work w/ that.

based on diff from Dan Brosemer <odin@svartalfheim.net>, thx
2006-10-18 18:22:56 +00:00

110 lines
3.6 KiB
Plaintext

--- build/gmake/Makefile.orig Fri Jul 15 08:58:10 2005
+++ build/gmake/Makefile Wed Oct 18 19:34:22 2006
@@ -58,8 +58,8 @@ SHELL=/bin/sh
PROJECT=tidy
# Installation variables. Spaces OK, only dir create and file copy operations.
-runinst_prefix=/usr/local
-devinst_prefix=/usr/local
+runinst_prefix=${PREFIX}
+devinst_prefix=${PREFIX}
bininst = ${runinst_prefix}/bin
libinst = ${devinst_prefix}/lib
@@ -79,13 +79,13 @@ DOCDIR = ${TOPDIR}/htmldoc
# CFLAGS etc..
# For optimised builds, flags such as "-O2" should be added and -D_DEBUG=1
# disabled.
-CC= gcc
-CFLAGS= -g -Wall -Wno-switch -Wno-parentheses -I $(INCDIR)
+#CC= gcc
+CFLAGS+= -fPIC -I $(INCDIR)
# flags only supported with gcc 3.x
# CFLAGS += -Wunused-parameter
OTHERCFLAGS=
-OTHERCFLAGS+= -D_DEBUG=1
+#OTHERCFLAGS+= -D_DEBUG=1
# OTHERCFLAGS+= -DSUPPORT_ACCESSIBILITY_CHECKS=1 -DSUPPORT_UTF16_ENCODINGS=1 -DSUPPORT_ASIAN_ENCODINGS=1
ifdef SUPPORT_UTF16_ENCODINGS
CFLAGS += -DSUPPORT_UTF16_ENCODINGS=$(SUPPORT_UTF16_ENCODINGS)
@@ -112,10 +112,12 @@ TIDY_MINOR = 0
# This will come from autoconf again
LIBPREFIX = lib
LIBSUFFIX = .a
+SHAREDLIBSUFFIX = .so
OBJSUF = .o
LIBRARY = $(LIBDIR)/$(LIBPREFIX)$(PROJECT)$(LIBSUFFIX)
-AR=ar -r
+SHAREDLIBRARY = $(LIBDIR)/$(LIBPREFIX)$(PROJECT)$(SHAREDLIBSUFFIX).$(TIDY_MAJOR).$(TIDY_MINOR)
+#AR=ar -r
XSLTPROC = xsltproc
@@ -158,17 +160,21 @@ LIBHFILES= \
$(SRCDIR)/tidy-int.h
-all: $(LIBRARY) $(EXES)
+all: $(LIBRARY) $(SHAREDLIBRARY) $(EXES)
doc: $(DOCS)
$(LIBRARY): $(OBJFILES)
if [ ! -d $(LIBDIR) ]; then mkdir $(LIBDIR); fi
- $(AR) $@ $(OBJFILES)
+ $(AR) -r $@ $(OBJFILES)
ifdef RANLIB
$(RANLIB) $@
endif
+$(SHAREDLIBRARY): $(OBJFILES)
+ if [ ! -d $(LIBDIR) ]; then mkdir $(LIBDIR); fi
+ $(CC) -shared -fPIC -o $(SHAREDLIBRARY) $(OBJFILES)
+
$(OBJDIR)/%$(OBJSUF): $(SRCDIR)/%.c $(HFILES) $(LIBHFILES) Makefile
if [ ! -d $(OBJDIR) ]; then mkdir $(OBJDIR); fi
$(CC) $(CFLAGS) $(OTHERCFLAGS) -o $@ -c $<
@@ -182,10 +188,10 @@ $(BINDIR)/tab2space: $(APPDIR)/tab2space
$(CC) $(CFLAGS) $(OTHERCFLAGS) -o $@ $(APPDIR)/tab2space.c $(LIBS)
$(HELPXML): $(BINDIR)/$(PROJECT)
- $(BINDIR)/$(PROJECT) -xml-help > $@
+ LD_LIBRARY_PATH=$(libinst) $(bininst)/$(PROJECT) -xml-help > $@
$(CONFIGXML): $(BINDIR)/$(PROJECT)
- $(BINDIR)/$(PROJECT) -xml-config > $@
+ LD_LIBRARY_PATH=$(libinst) $(bininst)/$(PROJECT) -xml-config > $@
$(DOCDIR)/quickref.html: $(DOCDIR)/quickref-html.xsl $(CONFIGXML)
$(XSLTPROC) -o $@ $(DOCDIR)/quickref-html.xsl $(CONFIGXML)
@@ -205,19 +211,20 @@ clean:
if [ "$(BINDIR)" != "$(TOPDIR)" -a -d $(BINDIR) ]; then rmdir $(BINDIR); fi
installhdrs: $(HFILES)
- if [ ! -d "$(incinst)" ]; then mkdir -p "$(incinst)"; fi
+ if [ ! -d "$(incinst)" ]; then ${BSD_INSTALL_DATA_DIR} "$(incinst)"; fi
cp -f $(HFILES) "$(incinst)/"
installib: $(LIBRARY)
if [ ! -d "$(libinst)" ]; then mkdir -p "$(libinst)"; fi
- cp -f $(LIBRARY) "$(libinst)/"
+ ${BSD_INSTALL_DATA} $(LIBRARY) "$(libinst)/"
+ ${BSD_INSTALL_DATA} $(SHAREDLIBRARY) "$(libinst)/"
installexes: $(EXES)
- if [ ! -d "$(bininst)" ]; then mkdir -p "$(bininst)"; fi
- cp -f $(EXES) "$(bininst)/"
+ if [ ! -d "$(bininst)" ]; then ${BSD_INSTALL_PROGRAM_DIR} "$(bininst)"; fi
+ ${BSD_INSTALL_PROGRAM} $(EXES) "$(bininst)/"
installmanpage: $(DOCDIR)/tidy.1
- if [ ! -d "$(maninst)/man1" ]; then mkdir -p "$(maninst)/man1"; fi;
- cp -f $(DOCDIR)/tidy.1 "$(maninst)/man1/tidy.1";
+ if [ ! -d "$(maninst)/man1" ]; then ${BSD_INSTALL_MAN_DIR} "$(maninst)/man1"; fi;
+ ${BSD_INSTALL_MAN} $(DOCDIR)/tidy.1 "$(maninst)/man1/tidy.1";
-install: installhdrs installib installmanpage installexes
+install: installib installexes installmanpage installhdrs