Makefile: only install required files

The previous Makefile is doing "cp *" and hence installing uninteresting
files like the Makefile itself.

Copy only the application-relevant files, and switch to using install
for some of this where we can automatically create parent directories
if required, solving issues when installing into an empty root.

locale installation is optional; as before, locale files will be
installed if they are present, but installation can also proceed
without them.
This commit is contained in:
Daniel Drake 2018-02-24 11:14:56 +03:00
parent 08234805e0
commit 87e9effc84

View file

@ -8,15 +8,14 @@ all:
install:
rm -rf ${DESTDIR}${PREFIX}/share/anki
mkdir -p ${DESTDIR}${PREFIX}/share/anki
cp -av * ${DESTDIR}${PREFIX}/share/anki/
cp -av anki aqt web ${DESTDIR}${PREFIX}/share/anki/
-cp -av locale ${DESTDIR}${PREFIX}/share/anki/
sed -e 's:@PREFIX@:${PREFIX}:' tools/runanki.system.in > tools/runanki.system
chmod 755 tools/runanki.system
cd ${DESTDIR}${PREFIX}/share/anki && (\
mv tools/runanki.system ${DESTDIR}${PREFIX}/bin/anki;\
test -d ${DESTDIR}${PREFIX}/share/pixmaps &&\
mv anki.xpm anki.png ${DESTDIR}${PREFIX}/share/pixmaps/;\
mv anki.desktop ${DESTDIR}${PREFIX}/share/applications;\
mv anki.1 ${DESTDIR}${PREFIX}/share/man/man1/)
install -m 0755 -D tools/runanki.system ${DESTDIR}${PREFIX}/bin/anki
install -m 0644 -D -t ${DESTDIR}${PREFIX}/share/pixmaps anki.xpm anki.png
install -m 0644 -D -t ${DESTDIR}${PREFIX}/share/applications anki.desktop
install -m 0644 -D -t ${DESTDIR}${PREFIX}/share/man/man1 anki.1
install -m 0644 -D -t ${DESTDIR}${PREFIX}/share/doc/anki README.contributing README.development README.md LICENSE
xdg-mime install anki.xml --novendor
xdg-mime default anki.desktop application/x-anki
xdg-mime default anki.desktop application/x-apkg