From 9ddff8b5c90b522f7dbeb3614b8ef00ceb45f4f2 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Mon, 29 Jun 2020 01:11:21 +0100 Subject: Core Xorg libraries necessary for Ghostscript now included Until now, in order to build Ghostscript, the project used the host's Xorg libraries. This was because we hadn't yet added the necessary build rules for them. With this commit, the instructions to build the necessary Xorg libraries for Ghostscript have also been added. Also, the shared Ghostscript library has been built with this commit and two sets of standard fonts are also included, setting us on the path to build TeXLive from source later. This task was done with the help and support of Raul Infante-Sainz. --- reproduce/software/make/basic.mk | 3 +- reproduce/software/make/high-level.mk | 186 ++++++++++++++++++++++++++-------- reproduce/software/make/xorg.mk | 180 ++++++++++++++++++++++++++++++++ 3 files changed, 322 insertions(+), 47 deletions(-) create mode 100644 reproduce/software/make/xorg.mk (limited to 'reproduce/software/make') diff --git a/reproduce/software/make/basic.mk b/reproduce/software/make/basic.mk index 94bb5d4..453eddb 100644 --- a/reproduce/software/make/basic.mk +++ b/reproduce/software/make/basic.mk @@ -191,9 +191,8 @@ $(ibidir)/low-level-links: $(ibidir)/coreutils-$(coreutils-version) \ # Libdl (for dynamic loading libraries at runtime) # POSIX Threads library for multi-threaded programs. for l in dl pthread; do - rm -f $(ildir)/lib$$l*; if [ -f /usr/lib/lib$$l.a ]; then - ln -s /usr/lib/lib$$l.* $(ildir)/ + ln -sf /usr/lib/lib$$l.* $(ildir)/ fi done diff --git a/reproduce/software/make/high-level.mk b/reproduce/software/make/high-level.mk index b756cb9..ac84c87 100644 --- a/reproduce/software/make/high-level.mk +++ b/reproduce/software/make/high-level.mk @@ -70,10 +70,10 @@ ifeq ($(strip $(all_highlevel)),1) # we'll need to filter it out, then add it in the end: minizip (has same # version as zlib) # - # Packages that are installed in the same recipe as others. These need to - # be totally removed when testing all the builds (they will be built - # anyway). lapack (installed with ATLAS) - targets-proglib := $(filter-out minizip-% lapack-%, \ + # Packages that are installed in the same recipe as others shouldn't be + # included here because there is no explicit target for them: they will + # be built as part of the other package. + targets-proglib := $(filter-out minizip-% lapack-% ghostscript-fonts-%, \ $(shell awk '/^# CLASS:PYTHON/{good=0} \ good==1 && !/^#/ && $$1 ~ /-version$$/ { \ printf("%s %s ", $$1, $$3)} \ @@ -126,14 +126,16 @@ export CCACHE_DISABLE := 1 export SHELL := $(ibdir)/bash export CPPFLAGS := -I$(idir)/include .SHELLFLAGS := --noprofile --norc -ec -export PKG_CONFIG_PATH := $(ildir)/pkgconfig export LDFLAGS := $(rpath_command) -L$(ildir) export PKG_CONFIG_LIBDIR := $(ildir)/pkgconfig +export PKG_CONFIG_PATH := $(ildir)/pkgconfig:$(idir)/share/pkgconfig # Settings specific to this Makefile. export CC := $(ibdir)/gcc export CXX := $(ibdir)/g++ export F77 := $(ibdir)/gfortran +export C_INCLUDE_PATH := $(iidir) +export CPLUS_INCLUDE_PATH := $(iidir) export LD_RUN_PATH := $(ildir):$(il64dir) export LD_LIBRARY_PATH := $(ildir):$(il64dir) @@ -156,7 +158,15 @@ export DYLD_LIBRARY_PATH := # library, it is thus necessary to include this location here. On systems # that don't need it, `sys_library_path' is just empty. This is necessary # for `ld'. -export LIBRARY_PATH := $(sys_library_path) +# +# If this variable is not defined, it will be interpretted as the current +# directory. In this case, when the program source has a 'specs' directory, +# GCC will crash because it expects it to be special file. +ifeq ($(strip $(sys_library_path)),) +export LIBRARY_PATH := $(ildir) +else +export LIBRARY_PATH := $(ildir):$(sys_library_path) +endif # Building flags: # @@ -190,7 +200,8 @@ backupservers = $(filter-out $(topbackupserver),$(backupservers_all)) -# Import rules to build Python packages, +# Import rules to build specialized software +include reproduce/software/make/xorg.mk include reproduce/software/make/python.mk @@ -466,6 +477,12 @@ $(ibidir)/freetype-$(freetype-version): $(ibidir)/libpng-$(libpng-version) $(call gbuild, freetype-$(freetype-version), static) echo "FreeType $(freetype-version)" > $@ +$(ibidir)/gperf-$(gperf-version): + tarball=gperf-$(gperf-version).tar.gz + $(call import-source, $(gperf-url), $(gperf-checksum)) + $(call gbuild, gperf-$(gperf-version), static) + echo "GNU gperf $(gperf-version)" > $@ + $(ibidir)/gsl-$(gsl-version): tarball=gsl-$(gsl-version).tar.gz $(call import-source, $(gsl-url), $(gsl-checksum)) @@ -533,6 +550,13 @@ $(ibidir)/healpix-$(healpix-version): $(healpix-python-dep) \ cp $(dtexdir)/healpix.tex $(ictdir)/ echo "HEALPix $(healpix-version) \citep{healpix}" > $@ +$(ibidir)/libidn-$(libidn-version): + tarball=libidn-$(libidn-version).tar.gz + $(call import-source, $(libidn-url), $(libidn-checksum)) + $(call gbuild, libidn-$(libidn-version), static, \ + --disable-doc, -j$(numthreads) V=1) + echo "Libjpeg $(libjpeg-version)" > $@ + $(ibidir)/libjpeg-$(libjpeg-version): tarball=jpegsrc.$(libjpeg-version).tar.gz $(call import-source, $(libjpeg-url), $(libjpeg-checksum)) @@ -893,50 +917,58 @@ $(ibidir)/gdb-$(gdb-version): $(ibidir)/python-$(python-version) echo "GNU Project Debugger (GDB) $(gdb-version)" > $@ $(ibidir)/ghostscript-$(ghostscript-version): \ + $(ibidir)/libxt-$(libxt-version) \ + $(ibidir)/expat-$(expat-version) \ + $(ibidir)/libidn-$(libidn-version) \ $(ibidir)/libpng-$(libpng-version) \ - $(ibidir)/libtiff-$(libtiff-version) + $(ibidir)/libtiff-$(libtiff-version) \ + $(ibidir)/libpaper-$(libpaper-version) - # Import the tarball. + # Download the standard collection of Ghostscript fonts. + tarball=ghostscript-fonts-std-$(ghostscript-fonts-std-version).tar.gz + $(call import-source, $(ghostscript-fonts-std-url), \ + $(ghostscript-fonts-std-checksum)) + + # Download the extra GNU fonts for Ghostscript. + tarball=ghostscript-fonts-gnu-$(ghostscript-fonts-gnu-version).tar.gz + $(call import-source, $(ghostscript-fonts-gnu-url), \ + $(ghostscript-fonts-gnu-checksum)) + + # Download the tarball tarball=ghostscript-$(ghostscript-version).tar.gz $(call import-source, $(ghostscript-url), $(ghostscript-checksum)) - # First we need to make sure some necessary X11 libraries that we - # don't yet install in this template are present on the host - # system, see https://savannah.nongnu.org/task/?15481 . - # Adding `-L/opt/X11/lib' to LDFLAGS is necessary for macOS systems - # because X11 libraries used to be installed there. - echo; - echo "Template: testing necessary X11 libraries for ghostscript" - echo "---------------------------------------------------------" - oprog=$(ddir)/libXext-test-for-ghostscript - cprog=$(ddir)/libXext-test-for-ghostscript.c - echo "#include " > $$cprog - echo "int main(void) {return 0;}" >> $$cprog - export LDFLAGS="$$LDFLAGS -L/opt/X11/lib" - if $$CC $$LDFLAGS $$cprog -o$$oprog -lXt -lSM -lICE -lXext; then - echo "Necessary X11 libraries are present. Proceeding to the build." - rm $$cprog $$oprog - else - rm $$cprog - echo "" - echo "Problem in building Ghostscript" - echo "-------------------------------" - echo "Some necessary X11 libraries (that we don't yet install" - echo "within the template) couldn't be found on your system, see" - echo "the 'ld' error message above. Please install them manually" - echo "so Ghostscript can be built." - echo - echo "For example if you use Debian-based OSs, run this command:" - echo " sudo apt install libxext-dev libxt-dev libsm-dev libice-dev ghostscript" - echo "" - echo "This notice will be removed once these packages are built" - echo "within the project (Task #15481)." - echo "-------------------------------" - exit 1 - fi + # Unpack it and configure Ghostscript. + cd $(ddir) + tar xf $(tdir)/$$tarball + cd ghostscript-$(ghostscript-version) + ./configure --prefix=$(idir) \ + --disable-cups \ + --enable-dynamic \ + --with-system-libtiff \ + --disable-compile-inits + + # Build and install the program and the shared libraries. + make V=1 -j$(numthreads) + make so V=1 -j$(numthreads) + make install + make soinstall + + # Install headers and set PostScript (PS) headers to point there. + install -v -m644 base/*.h $(iidir)/ghostscript + ln -sfvn $(iidir)/ghostscript $(iidir)/ps - # If they were present, go onto building Ghostscript. - $(call gbuild, ghostscript-$(ghostscript-version),,,V=1 -j$(numthreads)) + # Install the fonts. + tar -xvf $(tdir)/ghostscript-fonts-std-$(ghostscript-fonts-std-version).tar.gz \ + -C $(idir)/share/ghostscript + tar -xvf $(tdir)/ghostscript-fonts-gnu-$(ghostscript-fonts-gnu-version).tar.gz \ + -C $(idir)/share/ghostscript + fc-cache -v $(idir)/share/ghostscript/fonts/ + echo; echo "Ghostscript fonts added to Fontconfig."; echo; + + # Clean up and write the output target. + cd .. + rm -rf ghostscript-$(ghostscript-version) echo "GPL Ghostscript $(ghostscript-version)" > $@ $(ibidir)/gnuastro-$(gnuastro-version): \ @@ -1203,6 +1235,70 @@ $(ibidir)/swig-$(swig-version): $(call gbuild, swig-$(swig-version), static, --without-pcre) echo "Swig $(swig-version)" > $@ +# The disables: +# For macOS: +# --disable-dependency-tracking +# --disable-silent-rules +# --disable-ipcrm +# --disable-ipcs +# Because they need root: +# --disable-mount +# --disable-wall +# --disable-su +# +# NOTE ON INSTALLATION DIRECTORY: Util-linux libraries are relatively +# low-level and may cause conflicts with system libraries (especilly when +# we don't build the C compiler in Maneage). The precise conflict that +# triggered this was building CMake on macOS (it was expecting the host's +# uuid library, but would crash because of conflicts with the installed +# 'uuid.h' headers of Maneage's 'util-linux'. +# +# Since many programs don't actually need 'util-linux' libraries, to avoid +# low-level conflicts, we will install util-linux in a unique top-level +# directory and put symbolic links of its binaries in the main +# '$(ibdir)'. If any program does need 'util-linux' libraries, they can +# simply add the proper directories to the environment variables, see +# 'fontconfig' for example. +$(ibidir)/util-linux-$(util-linux-version): + + # Import the source. + tarball=util-linux-$(util-linux-version).tar.xz + $(call import-source, $(util-linux-url), $(util-linux-checksum)) + + # Unpack the source and set it to install in a special directory + # (as explained above). As shown below, later, we'll put a symbolic + # link of all the necessary binaries in the main '$(idir)/bin'. + cd $(ddir) + tar xf $(tdir)/$$tarball + cd util-linux-$(util-linux-version) + ./configure --prefix=$(idir)/util-linux \ + --disable-dependency-tracking \ + --disable-silent-rules \ + --without-systemd \ + --enable-libuuid \ + --disable-mount \ + --disable-ipcrm \ + --disable-ipcs \ + --disable-wall \ + --disable-su + + # Build and install it. + make V=1 -j$(numthreads) + make install + + # Put a symbolic link to installed programs in main installation + # directory. If 'sbin' exists in the main installation directory, + # put util-linux's 'sbin/' directory there too. + ln -sf $(idir)/util-linux/bin/* $(ibdir)/ + if [ -d $(idir)/sbin ]; then + ln -sf $(idir)/util-linux/sbin/* $(idir)/sbin + else + ln -sf $(idir)/util-linux/sbin/* $(idir)/bin + fi + + # Write the main target. + echo "util-Linux $(util-linux-version)" > $@ + $(ibidir)/xlsxio-$(xlsxio-version): \ $(ibidir)/cmake-$(cmake-version) \ $(ibidir)/expat-$(expat-version) \ diff --git a/reproduce/software/make/xorg.mk b/reproduce/software/make/xorg.mk new file mode 100644 index 0000000..e3b1f71 --- /dev/null +++ b/reproduce/software/make/xorg.mk @@ -0,0 +1,180 @@ +# Build the project's Xorg dependencies. +# +# ------------------------------------------------------------------------ +# !!!!! IMPORTANT NOTES !!!!! +# +# This Makefile will be loaded into 'high-level.mk', which is called by the +# `./project configure' script. It is not included into the project +# afterwards. +# +# This Makefile contains instructions to build all the Xorg-related +# software within the project. The build instructions here are taken from +# Linux From Scratch: +# http://www.linuxfromscratch.org/blfs/view/svn/x/xorg7.html +# +# ------------------------------------------------------------------------ +# +# Copyright (C) 2020 Mohammad Akhlaghi +# +# This Makefile is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This Makefile is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this Makefile. If not, see . + + + + + +# Environment variables +export XORG_PREFIX=$(idir) + +# Common configuration options for all Xorg programs +export XORG_CONFIG = --disable-static --prefix=$(XORG_PREFIX) \ + --sysconfdir=$(idir)/etc --localstatedir=$(idir)/var + + + + + +# This is the basic Xorg configuration script. Note that '$(idir)/etc' was +# built in 'basic.mk'. +$(idir)/etc/profile.d:; mkdir +$(idir)/etc/profile.d/xorg.sh: | $(idir)/etc/profile.d + echo "export XORG_PREFIX=\"$(XORG_PREFIX)\"" > $@ + echo "export XORG_CONFIG=\"$(XORG_CONFIG)\"" >> $@ + chmod 644 $@ + +# A set of m4 macros used in all Xorg packages. +$(ibidir)/util-macros-$(util-macros-version): \ + $(idir)/etc/profile.d/xorg.sh \ + $(ibidir)/automake-$(automake-version) + tarball=util-macros-$(util-macros-version).tar.bz2 + $(call import-source, $(util-macros-url), $(util-macros-checksum)) + $(call gbuild, util-macros-$(util-macros-version),,$(XORG_CONFIG),V=1) + echo "util-macros (Xorg) $(util-macros-version)" > $@ + +# Necessaary headers to define the Xorg protocols. +$(ibidir)/xorgproto-$(xorgproto-version): \ + $(ibidir)/util-macros-$(util-macros-version) + tarball=xorgproto-$(xorgproto-version).tar.bz2 + $(call import-source, $(xorg-proto-url), $(xorgproto-checksum)) + $(call gbuild, xorgproto-$(xorgproto-version),,$(XORG_CONFIG),V=1) + echo "xorgproto $(xorgproto-version)" > $@ + +# Necessaary headers to define the Xorg protocols. +$(ibidir)/libxau-$(libxau-version): $(ibidir)/xorgproto-$(xorgproto-version) + tarball=libXau-$(libxau-version).tar.bz2 + $(call import-source, $(libaxu-url), $(libxau-checksum)) + $(call gbuild, libXau-$(libxau-version),,$(XORG_CONFIG), V=1) + echo "libXau (Xorg) $(libxau-version)" > $@ + +# Library implementing the X Display Manager Control Protocol. +$(ibidir)/libxdmcp-$(libxdmcp-version): $(ibidir)/libxau-$(libxau-version) + tarball=libXdmcp-$(libxdmcp-version).tar.bz2 + $(call import-source, $(libxdmcp-url), $(libxdmcp-checksum)) + $(call gbuild, libXdmcp-$(libxdmcp-version),,$(XORG_CONFIG), V=1) + echo "libXdmcp (Xorg) $(libxdmcp-version)" > $@ + +# XML-XCB protocol descriptions +$(ibidir)/xcb-proto-$(xcb-proto-version): \ + $(ibidir)/python-$(python-version) \ + $(ibidir)/libxml2-$(libxml2-version) + tarball=xcb-proto-$(xcb-proto-version).tar.xz + $(call import-source, $(xcb-proto-url), $(xcb-proto-checksum)) + $(call gbuild, xcb-proto-$(xcb-proto-version),,$(XORG_CONFIG), V=1) + echo "XCB-proto (Xorg) $(xcb-proto-version)" > $@ + +# Interface to the X Window System protocol, replaces current Xlib interface. +$(ibidir)/libxcb-$(libxcb-version): \ + $(ibidir)/libxdmcp-$(libxdmcp-version) \ + $(ibidir)/xcb-proto-$(xcb-proto-version) \ + $(ibidir)/libpthread-stubs-$(libpthread-stubs-version) + tarball=libxcb-$(libxcb-version).tar.xz + $(call import-source, $(libxcb-url), $(libxcb-checksum)) + $(call gbuild, libxcb-$(libxcb-version),, \ + $(XORG_CONFIG) --without-doxygen, \ + V=1 -j$(numthreads)) + echo "libxcb (Xorg) $(libxcb-version)" > $@ + +$(ibidir)/libpthread-stubs-$(libpthread-stubs-version): \ + $(ibidir)/automake-$(automake-version) + tarball=libpthread-stubs-$(libpthread-stubs-version).tar.gz + $(call import-source, $(libpthread-stubs-url), $(libpthread-stubs-checksum)) + $(call gbuild, libpthread-stubs-$(libpthread-stubs-version),, V=1) + echo "libpthread-stubs (Xorg) $(libpthread-stubs-version)" > $@ + +# Library for configuring fonts, it needs util-linux for libuuid. +$(ibidir)/fontconfig-$(fontconfig-version): \ + $(ibidir)/gperf-$(gperf-version) \ + $(ibidir)/expat-$(expat-version) \ + $(ibidir)/libxml2-$(libxml2-version) \ + $(ibidir)/freetype-$(freetype-version) \ + $(ibidir)/util-linux-$(util-linux-version) + # Import the source. + tarball=fontconfig-$(fontconfig-version).tar.bz2 + $(call import-source, $(fontconfig-url), $(fontconfig-checksum)) + + # Add the extra environment variables for using 'libuuid' of + # 'util-linux'. + ulidir=$(idir)/util-linux + export LDFLAGS="-L$$ulidir/lib $(LDFLAGS)" + export CPPFLAGS="-I$$ulidir/include $(CPPFLAGS)" + export PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):$$ulidir/lib/pkgconfig + + # Build it. + $(call gbuild, fontconfig-$(fontconfig-version),, \ + $(XORG_CONFIG) --sysconfdir=$(idir)/etc \ + --disable-docs, V=1 -j$(numthreads)) + echo "Fontconfig $(fontconfig-version)" > $@ + +$(ibidir)/xtrans-$(xtrans-version): \ + $(ibidir)/libxcb-$(libxcb-version) \ + $(ibidir)/fontconfig-$(fontconfig-version) + tarball=xtrans-$(xtrans-version).tar.bz2 + $(call import-source, $(xtrans-url), $(xtrans-checksum)) + $(call gbuild, xtrans-$(xtrans-version),,$(XORG_CONFIG), V=1) + echo "xtrans (Xorg) $(xtrans-version)" > $@ + +$(ibidir)/libx11-$(libx11-version): $(ibidir)/xtrans-$(xtrans-version) + tarball=libX11-$(libx11-version).tar.bz2 + $(call import-source, $(libx11-url), $(libx11-checksum)) + $(call gbuild, libX11-$(libx11-version),,$(XORG_CONFIG), \ + -j$(numthreads) V=1) + echo "X11 library $(libx11-version)" > $@ + +$(ibidir)/libxext-$(libxext-version): $(ibidir)/libx11-$(libx11-version) + tarball=libXext-$(libxext-version).tar.bz2 + $(call import-source, $(libxext-url), $(libxext-checksum)) + $(call gbuild, libXext-$(libxext-version),,$(XORG_CONFIG), \ + -j$(numthreads) V=1) + echo "libXext $(libxext-version)" > $@ + +$(ibidir)/libice-$(libice-version): $(ibidir)/libxext-$(libxext-version) + tarball=libICE-$(libice-version).tar.bz2 + $(call import-source, $(libice-url), $(libice-checksum)) + $(call gbuild, libICE-$(libice-version),, \ + $(XORG_CONFIG) ICE_LIBS=-lpthread, \ + -j$(numthreads) V=1) + echo "libICE $(libice-version)" > $@ + +$(ibidir)/libsm-$(libsm-version): $(ibidir)/libice-$(libice-version) + tarball=libSM-$(libsm-version).tar.bz2 + $(call import-source, $(libsm-url), $(libsm-checksum)) + $(call gbuild, libSM-$(libsm-version),, \ + $(XORG_CONFIG), -j$(numthreads) V=1) + echo "libSM $(libsm-version)" > $@ + +$(ibidir)/libxt-$(libxt-version): $(ibidir)/libsm-$(libsm-version) + tarball=libXt-$(libxt-version).tar.bz2 + $(call import-source, $(libxt-url), $(libxt-checksum)) + $(call gbuild, libXt-$(libxt-version),, \ + $(XORG_CONFIG), -j$(numthreads) V=1) + echo "libXt $(libxt-version)" > $@ -- cgit v1.2.1