[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master acf0ea3: graph/x11/rules.mk: Use pkg-config to
From: |
Werner Lemberg |
Subject: |
[freetype2-demos] master acf0ea3: graph/x11/rules.mk: Use pkg-config to find the X11 headers and library |
Date: |
Wed, 13 Oct 2021 08:17:37 -0400 (EDT) |
branch: master
commit acf0ea3646dc50a2e3658e7d4b11a8f2fe86bfd9
Author: Hugh McMaster <hugh.mcmaster@outlook.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
graph/x11/rules.mk: Use pkg-config to find the X11 headers and library
---
README | 19 ++----------
graph/x11/rules.mk | 88 ++++--------------------------------------------------
2 files changed, 9 insertions(+), 98 deletions(-)
diff --git a/README b/README
index d546770..4cfcd3c 100644
--- a/README
+++ b/README
@@ -32,22 +32,9 @@ WARNING WARNING WARNING WARNING WARNING WARNING WARNING
WARNING WARNING
X11 issues
----------
- When building the demos, the build system tries to detect your X11
- path by looking for the patterns `X11/bin`, `X11R6/bin`, and
- `X11R5/bin` in your current path (in this order). If no X11 path
- is found, some demo programs will not be able to display graphics
- and will fail. If you have X11 in an unusual place, use the
- `X11_PATH` make variable. More than one directory, if necessary,
- must be separated with spaces. Example:
-
- make X11_PATH="/usr/openwin /usr/local/X11R6"
-
- The build system then derives the `X11_INCLUDE` include file path
- from `X11_PATH` by appending `/include` to all path components.
- It also derives the `X11_LIB` library path from `X11_PATH` by
- appending `/lib64` and `/lib` to all components (in that order).
- You might override those variables similar to `X11_PATH` as
- arguments to `make`.
+ When building the demos, the build system tries to detect X11 by
+ using pkg-config. If X11 is not found, some demo programs will
+ not be able to display graphics and will fail.
If you don't have X11 at all, fix the definition of the `EXES`
variable as described in the top-level Makefile.
diff --git a/graph/x11/rules.mk b/graph/x11/rules.mk
index 9aa219a..9072f98 100644
--- a/graph/x11/rules.mk
+++ b/graph/x11/rules.mk
@@ -5,94 +5,18 @@
#*
#**************************************************************************
-
-#############################################################################
-#
-# Try to detect an X11 setup.
-#
-# The goal is to define variable `X11_PATH', consisting of a list of
-# directories `A', `B', `C', ..., separated by spaces. While compiling the
-# demo programs that need X11 support, include file directories `A/include',
-# `B/include', etc., are passed to the compiler. While linking, directories
-# `A/lib', `A/lib64', `B/lib', `B/lib64', etc., are passed to the linker.
-# Note that it doesn't pose a problem to specify both 32bit and 64bit library
-# directories at the same time since the linker will properly reject the
-# incorrect ones.
-#
-# 1) We try to detect the following directories (in that order) as substrings
-# in the current path:
-#
-# X11/bin (usually a symlink to the current release)
-# X11R6/bin
-# X11R5/bin
-#
-# From the first hit we derive `X11_PATH' (by removing the `/bin' part).
-#
-# 2) If no success, we directly check the directories
-#
-# /usr
-# /usr/X11R6
-# /usr/local/X11R6
-#
-# whether they contain `include/X11/Xlib.h'. The first hit sets up
-# `X11_PATH'.
-#
-# 3) If the variable `X11_PATH' is already set (to specify unusual locations
-# of X11), no other directories are searched. For instance, let us assume
-# that the X11 header files are located in `/usr/local/X11/R6/include',
-# and the X11 library files in `/usr/openwin/lib'. Calling
-#
-# make X11_PATH="/usr/openwin /usr/local/X11R6"
-#
-# should then work.
-#
-FT_PATH := $(subst ;, ,$(subst :, ,$(subst $(SEP),/,$(PATH))))
-
-ifndef X11_PATH
- ifneq ($(findstring X11/bin,$(FT_PATH)),)
- xversion := X11
- else
- ifneq ($(findstring X11R6/bin,$(FT_PATH)),)
- xversion := X11R6
- else
- ifneq ($(findstring X11R5/bin,$(FT_PATH)),)
- xversion := X11R5
- endif
- endif
- endif
-
- ifdef xversion
- X11_PATH := $(filter %$(xversion)/bin,$(FT_PATH))
- X11_PATH := $(X11_PATH:%/bin=%)
- else
- X11_DIRS := /usr /usr/X11R6 /usr/local/X11R6
- X11_XLIB := include/X11/Xlib.h
- X11_PATH := $(foreach dir,$(X11_DIRS),$(wildcard $(dir)/$(X11_XLIB)))
- X11_PATH := $(X11_PATH:%/$(X11_XLIB)=%)
- endif
+ifeq ($(PKG_CONFIG),)
+ PKG_CONFIG = pkg-config
endif
+X11_INCLUDE := $(shell $(PKG_CONFIG) --cflags x11)
+X11_LIB := $(shell $(PKG_CONFIG) --libs x11)
-##########################################################################
-#
-# Update some variables to compile the X11 graphics module. Note that
-# X11 is available on Unix, or on OS/2. However, it only compiles with
-# gcc on the latter platform, which is why it is safe to use the flags
-# `-L' and `-l' in GRAPH_LINK.
-#
-ifneq ($(X11_PATH),)
-
- X11_INCLUDE := $(subst /,$(COMPILER_SEP),$(X11_PATH:%=%/include))
- X11_LIB := $(subst /,$(COMPILER_SEP),$(X11_PATH:%=%/lib64) \
- $(X11_PATH:%=%/lib))
-
+ifneq ($(X11_LIB),)
# The GRAPH_LINK variable is expanded each time an executable is linked
# against the graphics library.
#
- ifeq ($(PLATFORM),unix)
- GRAPH_LINK += $(X11_LIB:%=-R%)
- endif
- GRAPH_LINK += $(X11_LIB:%=-L%) -lX11
+ GRAPH_LINK += $(X11_LIB)
# Solaris needs a -lsocket in GRAPH_LINK.
#
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master acf0ea3: graph/x11/rules.mk: Use pkg-config to find the X11 headers and library,
Werner Lemberg <=