0002-Makefile-autoconf-makeinfo.in-support-build-install-.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. From 5368bd0cfd0640f5c0ca766d4fda1b3f71c1b013 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Wed, 30 Aug 2017 23:07:26 +0200
  4. Subject: [PATCH] Makefile, autoconf/makeinfo.in: support build/install without
  5. gettext
  6. The gettext tool msgfmt may not be available to build the .mo files
  7. from the .po files, so we handle this case by disabling the
  8. build/installation of .po files in such a case.
  9. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  10. ---
  11. Makefile | 17 ++++++++++++++---
  12. autoconf/makeinfo.in | 1 +
  13. 2 files changed, 15 insertions(+), 3 deletions(-)
  14. diff --git a/Makefile b/Makefile
  15. index a708046..3e83ca3 100644
  16. --- a/Makefile
  17. +++ b/Makefile
  18. @@ -7,11 +7,18 @@ OBJFILES := $(SRCFILES:%.c=%.o)
  19. LANGS = fr ru es
  20. MOS := $(addprefix po/, $(addsuffix .mo, $(LANGS)))
  21. LOCALEDIR = $(INSTALL_PREFIX)/usr/share/locale
  22. -
  23. -all: pdmenu $(POTFILE) $(MOS)
  24. +TARGETS = pdmenu
  25. +INSTALL_TARGETS = install-pdmenu
  26. include makeinfo
  27. +ifneq ($(MSGFMT),)
  28. +TARGETS += $(POTFILE) $(MOS)
  29. +INSTALL_TARGETS += install-pos
  30. +endif
  31. +
  32. +all: $(TARGETS)
  33. +
  34. pdmenu: .dep $(OBJFILES)
  35. ${CC} -o pdmenu $(OBJFILES) $(CFLAGS) $(LIBS)
  36. @@ -40,7 +47,9 @@ clean:
  37. $(MAKE) $(POTFILE) # make sure translators' input is ready
  38. rm -f $(OBJFILES) pdmenu $(MOS)
  39. -install: all
  40. +install: $(INSTALL_TARGETS)
  41. +
  42. +install-pdmenu:
  43. $(INSTALL) -d $(INSTALL_PREFIX)/$(BINDIR) \
  44. $(INSTALL_PREFIX)/$(MANDIR)/man1 \
  45. $(INSTALL_PREFIX)/$(MANDIR)/man5 \
  46. @@ -56,6 +65,8 @@ install: all
  47. $(INSTALL) examples/pdmenurc $(INSTALL_PREFIX)/$(SYSCONFDIR)/pdmenurc -m 0644
  48. $(INSTALL) examples/showdir.pl $(INSTALL_PREFIX)/$(DATADIR)/pdmenu
  49. cd $(INSTALL_PREFIX)/$(DATADIR)/pdmenu && $(LN_S) -f showdir.pl editdir.pl
  50. +
  51. +install-pos:
  52. for lang in $(LANGS); do \
  53. [ ! -d $(LOCALEDIR)/$$lang/LC_MESSAGES/ ] && mkdir -p $(LOCALEDIR)/$$lang/LC_MESSAGES/; \
  54. install -m 644 po/$$lang.mo $(LOCALEDIR)/$$lang/LC_MESSAGES/pdmenu.mo; \
  55. diff --git a/autoconf/makeinfo.in b/autoconf/makeinfo.in
  56. index 6d58d77..069daf8 100644
  57. --- a/autoconf/makeinfo.in
  58. +++ b/autoconf/makeinfo.in
  59. @@ -8,6 +8,7 @@ DATADIR = @datadir@
  60. CC = @CC@
  61. INSTALL = @INSTALL@
  62. LN_S = @LN_S@
  63. +MSGFMT = @MSGFMT@
  64. VER = @VER@
  65. DEFINES = -DETCDIR=\"${SYSCONFDIR}/\" -DVER=\"${VER}\" @DEFS@ \
  66. $(PROFILE) -D__USE_FIXED_PROTOTYPES__ -D_GNU_SOURCE \
  67. --
  68. 2.13.5