Re: DESTDIR in a native distro. How ?
Hamish Moffatt wrote:
>
> On Tue, Dec 15, 1998 at 03:18:52PM +0900, Ionutz Borcoman wrote:
> > How do I set the DESTDIR in my Makefile ? If a non-debian user will
> > download the package, he/she will want to install my program in
> > /usr/local. If he/she is a debian user, the deb package should be
> > created from the tar.gz and files moved to completely different places,
> > like /etc, /usr/X11R6 ....
> >
> > So which is the best way for solving this ?
>
> Perhaps you could do something like this in your makefile:
>
> PREFIX=/usr/local
>
> install:
> install mybinary $(PREFIX)/bin
> install mymanualpage.1 $(PREFIX)/man/man1
>
> Then in your debian/rules file, you can do "make install PREFIX=/usr"
> Or more like "make install PREFIX=debian/tmp/usr"
>
> Hamish
Is this acceptable ? I use a conditional in my Makefile to decide the
correct location:
1. in the rules:
build: build-stamp
build-stamp:
dh_testdir
# Add here commands to compile the package.
$(MAKE) MY_DEBIAN_SYSTEM=1
touch build-stamp
install: install-stamp
install-stamp: build-stamp
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/tmp.
$(MAKE) install DESTDIR=`pwd`/debian/tmp MY_DEBIAN_SYSTEM=1
touch install-stamp
2. in my Makefile:
###### Files & Directories
DESTDIR=
MY_DEBIAN_SYSTEM=
OTHER_OBJ =
SRC = main.cc\
config.cc \
jputils.cc
OBJ = main.o \
config.o \
jputils.o \
$(OTHER_OBJ)
TARGET=langdrill
CONFIG_FILE=default.drill
MAN_PAGE=../docs/langdrill.1x
###### Test for Debian GNU/Linux
# If yoyr system is not Debian GNU/Linux please modify the values after
# "else" statement. Modifying the values before else is useless, unless
# you also set MY_DEBIAN_SYSTEM=1
ifeq ($(MY_DEBIAN_SYSTEM),1)
MY_MESSAGE_OF_THE_DAY=">>" $(TARGET) compilled for Debian GNU/Linux
system. "<<"
CONFIG_DIR=$(DESTDIR)/usr/share/vdk/langdrill
BIN_DIR=$(DESTDIR)/usr/X11R6/bin
MAN_DIR=$(DESTDIR)/usr/X11R6/man/man1
# VDK is not yet packed. The resulting .deb file needs VDK statically
linked.
# However, to make the VDK you still need the VDK installed.
LFLAGS = `gtk-config --libs` /usr/local/lib/libvdk.a
/usr/local/lib/libvdkcompo.a
else
MY_MESSAGE_OF_THE_DAY=">>" $(TARGET) compilled for NON-Debian GNU/Linux
system. "<<"
CONFIG_DIR=$(DESTDIR)/usr/local/share/vdk/langdrill
BIN_DIR=$(DESTDIR)/usr/local/bin
MAN_DIR=$(DESTDIR)/usr/local/man/man1
# VDK must be installed. We link the shared libs.
LFLAGS = `gtk-config --libs` -lvdk -lvdkcompo
endif
This way I get as much freedom as I want:
a. non-Debian users just give a make from the top dir.
b. Debian users give just dpkg-buildpackage.
TIA,
Ionutz
Reply to: