Patch to support $DESTDIR based installs.

toni.arte at nokia.com toni.arte at nokia.com
Wed Apr 7 04:59:01 CDT 2010


>From: ext Mads Kiilerich [mailto:mads at kiilerich.com]
>On 04/07/2010 09:27 AM, toni.arte at nokia.com wrote:
>> I only now realized that you need to use -e on GNU Make to override
>> variables, like:
>>
>> PREFIX=/path/to/destination gmake -e install
>>
>> So far I've been hacking the Makefile :-)
>
>You can also specify it as arguments to make - such as
>
>make install PREFIX=/tmp/hg

Should have been reading the GNU Make manual more carefully :-) Thanks!

>> Anyway, another change I'd like to see is the ability to set the
>library
>> directory, i.e. support setting a value for the '--install-platlib'
>> switch on the 'setup.py' when installing Mercurial.
>I have had a similar issue as well, but I'm not sure I would like to see
>it solved exactly that way.
>
>It could be nice to have "make local" binaries for several architectures
>at the same time. That is very convenient for testing while developing.

For me it would be enough to be able to tell where the libraries should
go when I install. Or if the architecture and the OS platform would be
included into the library path. Now the path just includes the Python
version like in 'lib/python2.6/site-packages/'.

Here's the diff of my Makefile against Mercurial 1.5.1:


diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -5,16 +5,24 @@
 # % make PREFIX=/opt/ install

 PREFIX=/usr/local
 export PREFIX
 PYTHON=python
 PURE=
 PYTHON_FILES:=$(shell find mercurial hgext doc -name '*.py')

+OSNAME=$(shell uname -s)
+
+ifeq ($(OSNAME),Linux)
+ARCH=$(shell uname -m)
+else
+ARCH=$(shell uname -p)
+endif
+
 help:
        @echo 'Commonly used make targets:'
        @echo '  all          - build program and documentation'
        @echo '  install      - install program and man pages to PREFIX ($(PREFIX))'
        @echo '  install-home - install with setup.py install --home=HOME ($(HOME))'
        @echo '  local        - build for inplace usage'
        @echo '  tests        - run all tests in the automatic test suite'
        @echo '  test-foo     - run only specified tests (e.g. test-merge1)'
@@ -46,25 +54,25 @@
        find . -name '*.py[cdo]' -exec rm -f '{}' ';'
        rm -f MANIFEST mercurial/__version__.py mercurial/*.so tests/*.err
        rm -rf mercurial/locale
        $(MAKE) -C doc clean

 install: install-bin install-doc

 install-bin: build
-       $(PYTHON) setup.py $(PURE) install --prefix="$(PREFIX)" --force
+       $(PYTHON) setup.py $(PURE) install --prefix="$(PREFIX)" --install-platlib="$(PREFIX)/lib-$(OSNAME)-$(ARCH)" --force

 install-doc: doc
-       cd doc && $(MAKE) $(MFLAGS) install
+       cd doc && $(MAKE) $(MFLAGS) PREFIX="$(PREFIX)" install

 install-home: install-home-bin install-home-doc

 install-home-bin: build
-       $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --force
+       $(PYTHON) setup.py $(PURE) install --home="$(HOME)" --install-platlib="$(HOME)/lib-$(OSNAME)-$(ARCH)" --force

 install-home-doc: doc
        cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install

 MANIFEST-doc:
        $(MAKE) -C doc MANIFEST

 MANIFEST: MANIFEST-doc

--
Toni


More information about the Mercurial-devel mailing list