makefile: fixed DESTDIR

Modified the Makefile so that it actually works. As it is now, symlinks
will point to the fully qualified path of wherever your DESTDIR was: so
one would end up with symlinks like:

    /usr/local/lib/libhttp_parser.so.2.7

pointing to:

    /tmp/http-parser-git/pkg/http-parser-git/usr/local/lib/libhttp_parser.so.2.7.1.

This caused quite a bit of trouble when trying to package it, this
patch makes it work.

PR-URL: https://github.com/nodejs/http-parser/pull/391
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
make-http-max-header-size-gyp-configurable
ShaRose 7 years ago committed by Fedor Indutny
parent fd3850c048
commit 4cefc0fb83

@ -61,7 +61,7 @@ CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
LDFLAGS_LIB = $(LDFLAGS) -shared LDFLAGS_LIB = $(LDFLAGS) -shared
INSTALL ?= install INSTALL ?= install
PREFIX ?= $(DESTDIR)/usr/local PREFIX ?= /usr/local
LIBDIR = $(PREFIX)/lib LIBDIR = $(PREFIX)/lib
INCLUDEDIR = $(PREFIX)/include INCLUDEDIR = $(PREFIX)/include
@ -131,20 +131,20 @@ tags: http_parser.c http_parser.h test.c
ctags $^ ctags $^
install: library install: library
$(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h $(INSTALL) -D http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
$(INSTALL) -D $(LIBNAME) $(LIBDIR)/$(LIBNAME) $(INSTALL) -D $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SONAME) ln -s $(LIBDIR)/$(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SOLIBNAME).$(SOEXT) ln -s $(LIBDIR)/$(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SOLIBNAME).$(SOEXT)
install-strip: library install-strip: library
$(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h $(INSTALL) -D http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
$(INSTALL) -D -s $(LIBNAME) $(LIBDIR)/$(LIBNAME) $(INSTALL) -D -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SONAME) ln -s $(LIBDIR)/$(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SOLIBNAME).$(SOEXT) ln -s $(LIBDIR)/$(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SOLIBNAME).$(SOEXT)
uninstall: uninstall:
rm $(INCLUDEDIR)/http_parser.h rm $(DESTDIR)$(INCLUDEDIR)/http_parser.h
rm $(LIBDIR)/$(SONAME) rm $(DESTDIR)$(LIBDIR)/$(SONAME)
rm $(LIBDIR)/libhttp_parser.so rm $(LIBDIR)/libhttp_parser.so
clean: clean:

Loading…
Cancel
Save