Files
BMLFS/build-scripts/glib.build
2025-07-04 17:18:17 -05:00

102 lines
3.4 KiB
Bash

#! /bin/bash
# Glib
# Source: https://download.gnome.org/sources/glib/2.84/glib-2.84.3.tar.xz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: NONE
# Recommended: docutils, libxslt and PCRE
# Optional: dbus, bindfs, GDB, docbook-xml, docbook-xsl,
# Optional: GTK-Doc, glib-networking, gobject-introspection
# LTO: Tested with LLVM
# If optimizing:
export CFLAGS="-march=native -mtune=native -pipe "
export CFLAGS+="-O3 -Ofast -falign-functions=32 -ffat-lto-objects -flto=auto "
export CFLAGS+="-fno-semantic-interposition -mprefer-vector-width=256 "
export LDFLAGS="-flto=auto -Wl,-O2 -Wl,--as-needed "
# If desired, apply the optional patch, per LFS.
# In many cases, applications that use this library, either directly
# or indirectly via other libraries such as GTK, output numerous
# warnings when run from the command line. This patch enables the
# use of an environment variable, GLIB_LOG_LEVEL, that suppresses
# unwanted messages. The value of the variable is a digit that
# corresponds to:
# 1 Alert
# 2 Critical
# 3 Error
# 4 Warning
# 5 Notice
# For instance export GLIB_LOG_LEVEL=4 will skip output of Warning
# and Notice messages (and Info/Debug messages if they are turned
# on). If GLIB_LOG_LEVEL is not defined, normal message output will
# not be affected.
patch -Np1 -i ../patches/glib-lfs/glib-skip_warnings-1.patch
export PVER="2.84.3"
meson --prefix=/usr -Dman=false \
-Dselinux=disabled OUT &&
read -p "Compile?" && ninja -C OUT -j2 &&
read -p "Press Enter to install" &&
# if not using a package manager:
# ninja install
# Install may fail due to missint 'otool'. Use a link for now.
#sudo -S ln -sv ../../bin/true /usr/bin/otool
# if using pkgtools from Slackware, then:
sudo -S DESTDIR=$BUILD ninja -C OUT install &&
sudo -S mkdir -pv /BMAN/install
sudo -S mkdir -pv /BMAN/usr/share
sudo -S mv $BUILD/usr/share/man /BMAN/usr/share/
read -p "Press Enter to create pakage description."
cd $BUILD && sudo mkdir -v install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in. You must make
# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
glib: glib (library of C routines, version 1.x)
glib:
glib: GLib is a library which includes support routines for C such as lists,
glib: trees, hashes, memory allocation, and many other things.
glib:
glib: GLib is required by nearly everything that uses GTK+ 1/2/3/4.x.
glib:
glib:
glib:
glib:
glib:
EOF
sudo mv /tmp/slack-desc install/ &&
read -p "Enter to build and install package" &&
sudo makepkg -l y -c n $PKGS/glib-$PVER-${PSUFFIX} &&
cd /BMAN
cat > /tmp/slack-desc << "EOF"
glib-doc: Manuals for glib (library of C routines, version 1.x)
glib-doc:
glib-doc: GLib is a library which includes support routines for C such as lists,
glib-doc: trees, hashes, memory allocation, and many other things.
glib-doc:
glib-doc: GLib is required by nearly everything that uses GTK+ 1/2/3/4.x
glib-doc:
EOF
sudo mv /tmp/slack-desc install/
sudo makepkg -l y -c n $PKGS/glib-doc-$PVER-${NOPSUFFIX}
sudo rm -rf /BMAN/*
sudo rm -rf $BUILD/*