Issue
I have a package that uses autotools for build/install/etc. It is a Python module written in C++. (This isn't important except to know that the python scripts I have to install aren't part of what's being built, i.e. they're not a xxxxx_SOURCES
primary.) This module is used solely for some "unit tests" for a driver that our team distributes in a HW solution. For various reasons, I have need to "install" the python unit tests with the system.
Since these python scripts aren't part of the module, I'm managing the installation separately in the Makefile. Here's what I have in my Makefile.am
:
EXTRA_DIST = setupenv.sh bootstrap tests
dist-hook:
rm -rf $$(find $(distdir)/tests -name \*.swp -o -name \*.pyc)
install-exec-hook:
mkdir -p $(prefix)/unit_tests/unittest2
for f in tests/*.py; do \
cp $$f $(prefix)/unit_tests; \
done
for f in tests/unittest2/*.py; do \
cp $$f $(prefix)/unit_tests/unittest2; \
done
uninstall-hook:
rm -r $(prefix)/unit_tests
This works just fine except during rpmbuild
for the module. The install-exec-hook
rule isn't written correctly to make the directory where the rpm process redirects it. That is, when mkdir - $(prefix)/...
is executed, the script literally tries to make the dir: /opt/oursw/.... How should this rule be rewritten so that rpmbuild puts them in the same place as the installation for the module?
Solution
You want to add $(DESTDIR)
as a prefix to all those directories. That's standard for autotools installs.
As an aside, you also might want to look at the _SCRIPTS
suffix, which allows "make install
" to copy your scripts in for you the "official" way, removing the need for this hack in the first place.
Answered By - Aaron D. Marasco Answer Checked By - Candace Johnson (WPSolving Volunteer)