Skip to content

Commit

Permalink
Merge branch 'autotools-fixes'
Browse files Browse the repository at this point in the history
Makefile's contains a number of deprecated constructs. These changes fix
autotools hacks and remove duplicate variables.

Signed-off-by: Alexey Gladkov <[email protected]>
  • Loading branch information
legionus committed Oct 1, 2024
2 parents c5ad423 + b2f454b commit 11ffc38
Show file tree
Hide file tree
Showing 53 changed files with 228 additions and 304 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ config/ylwrap
configure
coverage
coverage.info
data/*_Z
depcomp
docs/reference/libkeymap/Doxyfile
docs/reference/libkeymap/html
Expand Down
47 changes: 47 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPDX-License-Identifier: LGPL-2.0-or-later
#
# Copyright (C) 2024 Alexey Gladkov <[email protected]>
#

DEFINE_PATHS = \
-DDATADIR=\"$(datadir)\" \
-DLOCALEDIR=\"$(localedir)\" \
-DDEFMAP=\"$(DEFKEYMAP)\" \
-DKERNDIR=\"$(KERNELDIR)\"

AM_CPPFLAGS = \
$(CODE_COVERAGE_CPPFLAGS) \
$(DEFINE_PATHS) \
-I$(top_srcdir)/src/libcommon \
-I$(top_srcdir)/src/libkeymap \
-I$(top_srcdir)/src/libkbdfile \
-I$(top_srcdir)/src/libkfont

AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)
LDADD = $(CODE_COVERAGE_LIBS)

SUFFIXES = .gen

V_GEN_SED = $(V_GEN_SED_$(V))
V_GEN_SED_ = $(V_GEN_SED_$(AM_DEFAULT_VERBOSITY))
V_GEN_SED_0 = @echo " SED " $@;
V_GEN_SED_1 =

%: %.gen Makefile
$(V_GEN_SED)$(SED) \
-e 's|[@]DATADIR[@]|${datadir}|g' \
-e 's|[@]DEFKEYMAP[@]|$(DEFKEYMAP)|g' \
-e 's|[@]KERNELDIR[@]|$(KERNELDIR)|g' \
-e 's|[@]VERSION[@]|$(VERSION)|g' \
-e 's|[@]KEYMAPDIR[@]|$(KEYMAPDIR)|g' \
-e 's|[@]UNIMAPDIR[@]|$(UNIMAPDIR)|g' \
-e 's|[@]TRANSDIR[@]|$(TRANSDIR)|g' \
-e 's|[@]VIDEOMODEDIR[@]|$(VIDEOMODEDIR)|g' \
-e 's|[@]FONTDIR[@]|$(FONTDIR)|g' \
-e 's|[@]PARTIALDIR[@]|$(PARTIALDIR)|g' \
-e 's|[@]prefix[@]|$(prefix)|g' \
-e 's|[@]exec_prefix[@]|$(exec_prefix)|g' \
-e 's|[@]libdir[@]|$(libdir)|g' \
-e 's|[@]includedir[@]|$(includedir)|g' \
<$< >$@ && \
chmod --reference=$< $@;
47 changes: 40 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,45 @@ AS_IF([test "$use_werror" = yes], [
CC_CHECK_CFLAGS_APPEND([-Werror=incompatible-pointer-types -Werror=discarded-qualifiers])
], [])

case $host_cpu in
case "$host_cpu" in
m68*) KEYCODES_PROGS=no ;;
*) KEYCODES_PROGS=yes ;;
esac
AM_CONDITIONAL(KEYCODES_PROGS, test "$KEYCODES_PROGS" = "yes")

case $host_cpu in
case "$host_cpu" in
i?86*) RESIZECONS_PROGS=yes ;;
x86_64*) RESIZECONS_PROGS=yes ;;
*) RESIZECONS_PROGS=no ;;
esac
AM_CONDITIONAL(RESIZECONS_PROGS, test "$RESIZECONS_PROGS" = "yes")

case "$host_cpu" in
s390*)
defkeymap="defkeymap.map"
kerneldir="/usr/src/linux/drivers/s390/char"
;;
*)
defkeymap="defkeymap.map"
kerneldir="/usr/src/linux/drivers/tty/vt"
;;
esac
AC_SUBST(DEFKEYMAP, "$defkeymap")
AC_SUBST(KERNELDIR, "$kerneldir")

AC_DEFUN([KBD_SUBST_DEFINE], [
AC_SUBST([$1], [$2])
AC_DEFINE([$1], [$2], [$3])
])

KBD_SUBST_DEFINE([OLDKEYMAPDIR], ["keytables"], [Subdirectory of DATADIR])
KBD_SUBST_DEFINE([KEYMAPDIR], ["keymaps"], [Subdirectory of DATADIR])
KBD_SUBST_DEFINE([UNIMAPDIR], ["unimaps"], [Subdirectory of DATADIR])
KBD_SUBST_DEFINE([TRANSDIR], ["consoletrans"], [Subdirectory of DATADIR])
KBD_SUBST_DEFINE([VIDEOMODEDIR], ["videomodes"], [Subdirectory of DATADIR])
KBD_SUBST_DEFINE([FONTDIR], ["consolefonts"], [Subdirectory of DATADIR])
KBD_SUBST_DEFINE([PARTIALDIR], ["partialfonts"], [Subdirectory of DATADIR])

AC_ARG_ENABLE(optional-progs,
AS_HELP_STRING(--enable-optional-progs, [Build and install a optional programs]),
[OPTIONAL_PROGS=$enableval],[OPTIONAL_PROGS=no])
Expand All @@ -155,6 +181,16 @@ if test "$BUILD_LIBKFONT" = "yes" -o "$BUILD_LIBKEYMAP" = "yes"; then
fi
AM_CONDITIONAL(BUILD_LIBKBDFILE, test "$BUILD_LIBKBDFILE" = "yes")

AC_ARG_ENABLE(compress,
[AS_HELP_STRING([--disable-compress], [Do not compress fonts and keymaps when they are installed.])],
[enable_compress=$enableval], [enable_compress=auto])

AS_IF([test "x$enable_compress" = xno], [],
[test "x$enable_compress" = xyes], [AC_CHECK_PROGS([COMPRESS_PROG], [zstd xz bzip2 gzip])],
[test "x$enable_compress" = xauto], [AC_CHECK_PROGS([COMPRESS_PROG], [gzip])],
[AC_CHECK_PROGS([COMPRESS_PROG], ["$enable_compress"])])
AM_CONDITIONAL(ENABLE_COMPRESS, test "x$COMPRESS_PROG" != "x")

AC_ARG_ENABLE(vlock,
AS_HELP_STRING(--disable-vlock, [do not build vlock]),
[VLOCK_PROG=$enableval],[VLOCK_PROG=yes])
Expand Down Expand Up @@ -192,14 +228,9 @@ AC_CONFIG_FILES([Makefile
docs/Makefile
docs/man/Makefile
docs/man/man1/Makefile
docs/man/man1/dumpkeys.1
docs/man/man1/loadkeys.1
docs/man/man1misc/Makefile
docs/man/man5/Makefile
docs/man/man8/Makefile
docs/man/man8/loadunimap.8
docs/man/man8/mapscrn.8
docs/man/man8/setfont.8
docs/man/man8misc/Makefile
docs/reference/Makefile
docs/reference/libkeymap/Makefile
Expand Down Expand Up @@ -229,6 +260,8 @@ AC_MSG_RESULT([
compiler: ${CC}
cflags: ${CFLAGS}
compress data: ${COMPRESS_PROG}
{get,set}keycodes: ${KEYCODES_PROGS}
resizecons: ${RESIZECONS_PROGS}
optional progs: ${OPTIONAL_PROGS}
Expand Down
73 changes: 44 additions & 29 deletions data/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
EXTRA_DIST = consolefonts consoletrans keymaps partialfonts unimaps

# If you change the names of any of the following subdirs,
# also change paths.h.
OLDKEYMAPDIR = keytables
KEYMAPDIR = keymaps
UNIMAPDIR = unimaps
FONTDIR = consolefonts
PARTIALDIR = partialfonts
TRANSDIR = consoletrans

KEYMAPSUBDIRS = include sun amiga atari i386/azerty i386/bepo i386/dvorak \
i386/fgGIod i386/qwerty i386/qwertz i386/include i386/olpc \
i386/colemak i386/carpalx i386/neo mac/include mac/all \
pine

# Do not use GZIP - it is interpreted by gzip
MYGZIP = gzip -f -n -9
MYGZIP_SUFFIX = .gz
COMPRESS = $(COMPRESS_PROG) -f -9
LOCAL_CLEANUPDIRS =

if ENABLE_COMPRESS
SRC_KEYMAPDIR = $(KEYMAPDIR)_Z
SRC_FONTDIR = $(FONTDIR)_Z
SRC_PARTIALDIR = $(PARTIALDIR)_Z

LOCAL_CLEANUPDIRS += $(SRC_KEYMAPDIR) $(SRC_FONTDIR) $(SRC_PARTIALDIR)
else
SRC_KEYMAPDIR = $(KEYMAPDIR)
SRC_FONTDIR = $(FONTDIR)
SRC_PARTIALDIR = $(PARTIALDIR)
endif

install-data-hook: $(KEYMAPDIR)_Z $(FONTDIR)_Z
install-data-hook: $(SRC_KEYMAPDIR) $(SRC_FONTDIR) $(SRC_PARTIALDIR)
install -d -m 755 $(DESTDIR)$(datadir)
install -d -m 755 $(DESTDIR)$(datadir)/$(FONTDIR)
install -m 644 $(FONTDIR)_Z/* $(DESTDIR)$(datadir)/$(FONTDIR)
install -m 644 $(SRC_FONTDIR)/* $(DESTDIR)$(datadir)/$(FONTDIR)
install -d -m 755 $(DESTDIR)$(datadir)/$(FONTDIR)/$(PARTIALDIR)
install -m 644 $(PARTIALDIR)_Z/* $(DESTDIR)$(datadir)/$(FONTDIR)/$(PARTIALDIR)
install -m 644 $(SRC_PARTIALDIR)/* $(DESTDIR)$(datadir)/$(FONTDIR)/$(PARTIALDIR)
install -d -m 755 $(DESTDIR)$(datadir)/$(TRANSDIR)
install -m 644 $(srcdir)/$(TRANSDIR)/* $(DESTDIR)$(datadir)/$(TRANSDIR)
install -d -m 755 $(DESTDIR)$(datadir)/$(UNIMAPDIR)
Expand All @@ -33,7 +35,7 @@ install-data-hook: $(KEYMAPDIR)_Z $(FONTDIR)_Z
install -d -m 755 $(DESTDIR)$(datadir)/$(KEYMAPDIR)/mac
for i in $(KEYMAPSUBDIRS); do \
install -d -m 755 $(DESTDIR)$(datadir)/$(KEYMAPDIR)/$$i ;\
install -m 644 $(KEYMAPDIR)_Z/$$i/* $(DESTDIR)$(datadir)/$(KEYMAPDIR)/$$i ;\
install -m 644 $(SRC_KEYMAPDIR)/$$i/* $(DESTDIR)$(datadir)/$(KEYMAPDIR)/$$i ;\
done
rm -f $(DESTDIR)$(datadir)/$(KEYMAPDIR)/ppc; $(LN_S) mac $(DESTDIR)$(datadir)/$(KEYMAPDIR)/ppc
@if [ -f $(DESTDIR)$(datadir)/$(OLDKEYMAPDIR) ]; then \
Expand All @@ -45,24 +47,37 @@ install-data-hook: $(KEYMAPDIR)_Z $(FONTDIR)_Z

# compress data files - do not touch the distribution but copy first
$(KEYMAPDIR)_Z:
cp -r $(srcdir)/$(KEYMAPDIR) $(KEYMAPDIR)_Z
chmod -R u+w $(KEYMAPDIR)_Z
cd $(KEYMAPDIR)_Z; \
for f in */*.map */*/*.map; do \
$(MYGZIP) < "$$f" > "$$f$(MYGZIP_SUFFIX)"; \
done; \
rm -f -- */*.map */*/*.map;
cp -r $(srcdir)/$(KEYMAPDIR) $(SRC_KEYMAPDIR)
chmod -R u+w $(SRC_KEYMAPDIR)
for f in "$(SRC_KEYMAPDIR)"/*/*.map "$(SRC_KEYMAPDIR)"/*/*/*.map; do \
test -L "$$f" && t="`readlink -m $$f`" && rm -f -- "$$f" && \
cp -- "$$t" "$$f" ||:; \
done
for f in "$(SRC_KEYMAPDIR)"/*/*.map "$(SRC_KEYMAPDIR)"/*/*/*.map; do \
test -f "$$f" && $(COMPRESS) "$$f" && rm -f -- "$$f"; \
done

$(FONTDIR)_Z:
cp -r $(srcdir)/$(FONTDIR) $(FONTDIR)_Z
cp -r $(srcdir)/$(PARTIALDIR) $(PARTIALDIR)_Z
chmod -R u+w $(FONTDIR)_Z $(PARTIALDIR)_Z
cd $(FONTDIR)_Z && $(MYGZIP) * && gunzip ERRORS* README*
cd $(PARTIALDIR)_Z && $(MYGZIP) *
cp -r "$(srcdir)/$(FONTDIR)" "$(SRC_FONTDIR)"
chmod -R u+w $(SRC_FONTDIR)
for f in "$(SRC_FONTDIR)"/*; do \
case "$$f" in (*/ERRORS*|*/README*) continue; ;; esac; \
test -f "$$f" && $(COMPRESS) "$$f" && rm -f -- "$$f"; \
done

$(PARTIALDIR)_Z:
cp -r "$(srcdir)/$(PARTIALDIR)" "$(SRC_PARTIALDIR)"
chmod -R u+w $(SRC_PARTIALDIR)
for f in "$(SRC_PARTIALDIR)"/*; do \
test -f "$$f" && $(COMPRESS) "$$f" && rm -f -- "$$f"; \
done

# (not yet screenmaps - some other time)

clean-local:
rm -rf $(KEYMAPDIR)_Z $(FONTDIR)_Z $(PARTIALDIR)_Z
for d in $(LOCAL_CLEANUPDIRS); do \
test -d "$$d" && rm -rf -- "$$d"; \
done

uninstall-hook:
cd $(DESTDIR)$(datadir) && rm -rf $(FONTDIR) $(PARTIALDIR) $(TRANSDIR) $(UNIMAPDIR) $(KEYMAPDIR)
9 changes: 3 additions & 6 deletions docs/man/man1/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include $(top_srcdir)/Makefile.common

gen_MANS = dumpkeys.1 loadkeys.1
dist_man_MANS = chvt.1 deallocvt.1 fgconsole.1 kbd_mode.1 openvt.1 \
psfaddtable.1 psfgettable.1 psfstriptable.1 psfxtable.1 \
Expand All @@ -9,9 +11,4 @@ if VLOCK
dist_man_MANS += vlock.1
endif

install-data-hook:
cd $(DESTDIR)$(mandir)/man1 && \
for f in $(gen_MANS); do \
$(SED) -e "s#@DATADIR\@#${datadir}#g" "$$f" > "$$f.new"; \
mv -f -- "$$f.new" "$$f"; \
done
CLEANFILES = $(gen_MANS)
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ Prints version number and exits.
.LP
.SH FILES
.TP
.I @DATADIR@/keymaps
.I @DATADIR@/@KEYMAPDIR@
The recommended directory for keytable files.
.LP
.SH "SEE ALSO"
Expand Down
12 changes: 6 additions & 6 deletions docs/man/man1/loadkeys.1.in → docs/man/man1/loadkeys.1.gen
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ If the
loads a default keymap, probably the file
.I defkeymap.map
either in
.I @DATADIR@/keymaps
.I @DATADIR@/@KEYMAPDIR@
or in
.IR /usr/src/linux/drivers/char .
.IR @KERNELDIR@ .
(Probably the former was user-defined, while the latter
is a qwerty keyboard map for PCs - maybe not what was desired.)
Sometimes, with a strange keymap loaded (with the minus on
some obscure unknown modifier combination) it is easier to
type `loadkeys defkeymap'.
type `loadkeys @DEFKEYMAP@'.
.SH "LOAD KERNEL KEYMAP"
The main function of
.B loadkeys
Expand Down Expand Up @@ -120,7 +120,7 @@ If the
) option is given
.B loadkeys
prints to the standard output a file that may be used as
.I /usr/src/linux\%/drivers\%/char\%/defkeymap.c,
.I @KERNELDIR@/defkeymap.c,
specifying the default key bindings for a kernel
(and does not modify the current keymap).
.SH "CREATE BINARY KEYMAP"
Expand Down Expand Up @@ -199,11 +199,11 @@ outlive your session. This means that even at the login prompt the key
bindings may not be what the user expects.
.SH FILES
.TP
.I @DATADIR@/keymaps
.I @DATADIR@/@KEYMAPDIR@
default directory for keymaps.
.LP
.TP
.I /usr/src/linux/drivers/char/defkeymap.map
.I @KERNELDIR@/@DEFKEYMAP@
default kernel keymap.
.LP
.SH "SEE ALSO"
Expand Down
9 changes: 3 additions & 6 deletions docs/man/man8/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
include $(top_srcdir)/Makefile.common

gen_MANS = loadunimap.8 mapscrn.8 setfont.8
dist_man_MANS = getkeycodes.8 kbdrate.8 resizecons.8 setkeycodes.8 \
showconsolefont.8 setvtrgb.8 $(gen_MANS)

install-data-hook:
cd $(DESTDIR)$(mandir)/man8 && \
for f in $(gen_MANS); do \
$(SED) -e "s#@DATADIR\@#${datadir}#g" "$$f" > "$$f.new"; \
mv -f -- "$$f.new" "$$f"; \
done
CLEANFILES = $(gen_MANS)
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ directly - its function is also built into
.BR setfont (8).
.SH FILES
.TP
.I @DATADIR@/unimaps
.I @DATADIR@/@UNIMAPDIR@
The default directory for unicode mappings.
.LP
.TP
.I @DATADIR@/unimaps/def.uni
.I @DATADIR@/@UNIMAPDIR@/def.uni
The default mapping file.
.LP
.SH "SEE ALSO"
Expand Down
2 changes: 1 addition & 1 deletion docs/man/man8/mapscrn.8.in → docs/man/man8/mapscrn.8.gen
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Prints version number and exits.
Be verbose.
.SH FILES
.TP
.I @DATADIR@/consoletrans
.I @DATADIR@/@TRANSDIR@
The default directory for screen mappings.
.LP
.SH "SEE ALSO"
Expand Down
6 changes: 3 additions & 3 deletions docs/man/man8/setfont.8.in → docs/man/man8/setfont.8.gen
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,15 @@ the console will be reduced to 8 (instead of 16) colors.

.SH FILES
.TP
.I @DATADIR@/consolefonts
.I @DATADIR@/@FONTDIR@
The default font directory.
.LP
.TP
.I @DATADIR@/unimaps
.I @DATADIR@/@UNIMAPDIR@
The default directory for Unicode maps.
.LP
.TP
.I @DATADIR@/consoletrans
.I @DATADIR@/@TRANSDIR
The default directory for screen mappings.
.LP
The default font is a file
Expand Down
3 changes: 1 addition & 2 deletions po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ src/setvesablank.c
src/setvtrgb.c
src/showconsolefont.c
src/showkey.c
src/spawn_console.c
src/spawn_login.c
src/spawn_command.c
src/totextmode.c
src/vlock/auth.c
src/vlock/pam.c
Expand Down
Loading

0 comments on commit 11ffc38

Please sign in to comment.