Skip to content

Instantly share code, notes, and snippets.

@lisabbasil
Forked from anonymous/update-qt4.sh
Last active November 8, 2018 01:43
Show Gist options
  • Save lisabbasil/2422cebb355427d6f4063dfde52fb371 to your computer and use it in GitHub Desktop.
Save lisabbasil/2422cebb355427d6f4063dfde52fb371 to your computer and use it in GitHub Desktop.
Quick and simple shell script for updating lib32-qt4 in Arch Linux.
#!/bin/bash
# Based on the directions here: https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_Clean_Chroot
# This will take a while to build, with most of the time spent on QT4. There is some redundancy with creating
# multiple clean chroots, but I think this approach is easier and more reliable for most systems.
# Specify a build directory. Defaults to /tmp:
BUILDDIR="/tmp"
# Install devtools if it's not already installed:
if [ -n "$(pacman -Qi devtools)" ]
then echo "devtools installed. Continuing"
else echo "devtools not installed. Installing..."; sudo pacman -S devtools
fi
# Install git if it's not already installed:
if [ -n "$(pacman -Qi git)" ]
then echo "git installed. Continuing"
else echo "git not installed. Installing..."; sudo pacman -S git
fi
# Build the packages in /tmp by default:
echo "Moving to $BUILDDIR"
cd $BUILDDIR
# Build lib32-libmng:
echo "Building lib32-libmng (dependency)..."
if [ ! -d "lib32-libmng" ]; then
# No lib32-libmng directory, so we clone the repo
git clone https://aur.archlinux.org/lib32-libmng.git
cd lib32-libmng
else
# lib32-libmng dir exists, so cd and make sure the repo is up to date
cd lib32-libmng
git pull
fi
# Build the package in a clean chroot, then record the full package name:
multilib-build -c
LIBMNG_PKGNAME=$(ls -lAh | egrep 'pkg\.tar\.xz$' | sed -r 's/.*(lib32-.*)/\1/')
cd $BUILDDIR
## Build lib32-openssl-1.0:
#echo "Building lib32-openssl-1.0 (dependency)..."
#if [ ! -d "lib32-openssl-1.0" ]; then
# # No lib32-openssl-1.0 directory, so we clone the repo
# git clone https://aur.archlinux.org/lib32-openssl-1.0.git
# cd lib32-openssl-1.0
#else
# # lib32-openssl-1.0 dir exists, so cd and make sure the repo is up to date
# cd lib32-openssl-1.0
# git pull
#fi
## Build the package in a clean chroot, then record the full package name:
#multilib-build -c
#OPENSSL_PKGNAME=$(ls -lAh | egrep 'pkg\.tar\.xz$' | sed -r 's/.*(lib32-.*)/\1/')
#cd $BUILDDIR
# Finally, build lib32-qt4:
echo "Building lib32-qt4 (main package)..."
if [ ! -d "lib32-qt4" ]; then
git clone https://aur.archlinux.org/lib32-qt4.git
cd lib32-qt4
else
cd lib32-qt4
git pull
fi
# Build in a clean chroot, but use the clean packages we just built.
# This line is recommended by the maintainer of the lib32-qt4 package:
multilib-build -c -- -I $BUILDDIR/lib32-libmng/$LIBMNG_PKGNAME #-I $BUILDDIR/lib32-openssl-1.0/$OPENSSL_PKGNAME
QT4_PKGNAME=$(ls -lAh | egrep 'pkg\.tar\.xz$' | sed -r 's/.*(lib32-.*)/\1/')
# Install it:
echo "Installing lib32-qt4"
sudo pacman -U $QT4_PKGNAME
echo "Successfully installed $QT4_PKGNAME."
@JohnRobson
Copy link

JohnRobson commented Jun 5, 2017

`#!/bin/bash

lib32-qt4 & qtwebkit

Based on the directions here: https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_Clean_Chroot

This will take a while to build, with most of the time spent on QT4. There is some redundancy with creating

multiple clean chroots, but I think this approach is easier and more reliable for most systems.

Specify a build directory. Defaults to /tmp:

BUILDDIR="/tmp"

Install devtools if it's not already installed:

if [ -n "$(pacman -Qi devtools)" ]
then echo "devtools installed. Continuing"
else echo "devtools not installed. Installing..."; sudo pacman -S devtools
fi

Install git if it's not already installed:

if [ -n "$(pacman -Qi git)" ]
then echo "git installed. Continuing"
else echo "git not installed. Installing..."; sudo pacman -S git
fi

Build the packages in /tmp by default:

echo "Moving to $BUILDDIR"
cd $BUILDDIR

Build lib32-libmng:

echo "Building lib32-libmng (dependency)..."
if [ ! -d "lib32-libmng" ]; then

No lib32-libmng directory, so we clone the repo

git clone https://aur.archlinux.org/lib32-libmng.git
cd lib32-libmng
else

lib32-libmng dir exists, so cd and make sure the repo is up to date

cd lib32-libmng
git pull
fi

Build the package in a clean chroot, then record the full package name:

multilib-build -c
LIBMNG_PKGNAME=$(ls -lAh | egrep 'pkg.tar.xz$' | sed -r 's/.(lib32-.)/\1/')
cd $BUILDDIR

Build lib32-openssl-1.0:

#echo "Building lib32-openssl-1.0 (dependency)..."
#if [ ! -d "lib32-openssl-1.0" ]; then

# No lib32-openssl-1.0 directory, so we clone the repo

git clone https://aur.archlinux.org/lib32-openssl-1.0.git

cd lib32-openssl-1.0

#else

# lib32-openssl-1.0 dir exists, so cd and make sure the repo is up to date

cd lib32-openssl-1.0

git pull

#fi

Build the package in a clean chroot, then record the full package name:

#multilib-build -c
#OPENSSL_PKGNAME=$(ls -lAh | egrep 'pkg.tar.xz$' | sed -r 's/.(lib32-.)/\1/')
#cd $BUILDDIR

Finally, build lib32-qt4:

echo "Building lib32-qt4 (main package)..."
if [ ! -d "lib32-qt4" ]; then
git clone https://aur.archlinux.org/lib32-qt4.git
cd lib32-qt4
else
cd lib32-qt4
git pull
fi

Build in a clean chroot, but use the clean packages we just built.

This line is recommended by the maintainer of the lib32-qt4 package:

sudo umount /var/lib/archbuild/multilib-x86_64/root
#sudo \rm -rf /var/lib/archbuild/multilib-x86_64/root

multilib-build -c -- -I $BUILDDIR/lib32-libmng/$LIBMNG_PKGNAME #-I $BUILDDIR/lib32-openssl-1.0/$OPENSSL_PKGNAME
PKGNAME=$(ls -lAh | egrep 'pkg.tar.xz$' | sed -r 's/.(lib32-.)/\1/')

Install it:

echo "Installing lib32-qt4"
sudo pacman -U $PKGNAME
sudo \rm -rf /var/lib/archbuild/*

echo "Successfully installed $PKGNAME."

Finally, build qtwebkit:

echo "Building qtwebkit (main package)..."
if [ ! -d "qtwebkit" ]; then
#git clone https://aur.archlinux.org/qtwebkit.git
#cd qtwebkit
git clone https://github.com/WoefulDerelict/PKGBUILDs.git
cd PKGBUILDs/qtwebkit
else
#cd qtwebkit
cd PKGBUILDs/qtwebkit
git pull
fi

Build in a clean chroot, but use the clean packages we just built.

This line is recommended by the maintainer of the qtwebkit package:

#multilib-build -c -- -I $BUILDDIR/lib32-libmng/$LIBMNG_PKGNAME
extra-x86_64-build -c makechrootpkg -c -r $CHROOT

PKGNAME=$(ls -lAh | egrep 'pkg.tar.xz$' | sed -r 's/.(lib32-.)/\1/')

Install it:

echo "Installing qtwebkit"
sudo pacman -U $PKGNAME
sudo \rm -rf /var/lib/archbuild/*

echo "Successfully installed $PKGNAME."
`

@benoliver999
Copy link

Great script, massive timesaver for a process that has quickly become a pain in the arse! I can't even remember why I need the package, which is a pretty sad situation...

Anyway one note, I had to add the PGP key for libmng, currently it's 8048643BA2C840F4F92A195FF54984BFA16C640F so:

gpg --recv-keys 8048643BA2C840F4F92A195FF54984BFA16C640F

Don't take my word for it, be sure to check the PKGBUILD, it's listed under validpgpkeys=()

@lockheed
Copy link

lockheed commented Jun 29, 2017

Doesn't work for me. It stops on:

:: Running post-transaction hooks...
(1/2) Updating the info directory file...
(2/2) Rebuilding certificate stores...
Initializing machine ID from random generator.
Generating locales...
en_US.UTF-8... done
de_DE.UTF-8... done
Generation complete.
==> Building in chroot for [multilib] (x86_64)...
==> Creating clean working copy [juha]...done
cp: -r not specified; omitting directory '/tmp/lib32-libmng/'
error: no targets specified (use -h for help)
rm: missing operand
Try 'rm --help' for more information.
==> Making package: lib32-qt4 4.8.7-13 (Thu Jun 29 09:46:51 CEST 2017)
==> Retrieving sources...
-> Found qt-everywhere-opensource-src-4.8.7.tar.gz
-> Found improve-cups-support.patch
-> Found moc-boost-workaround.patch
-> Found kubuntu_14_systemtrayicon.diff
-> Found kde4-settings.patch
-> Found glib-honor-ExcludeSocketNotifiers-flag.diff
-> Found disable-sslv3.patch
-> Found l-qclipboard_fix_recursive.patch
-> Found l-qclipboard_delay.patch
-> Found qt4-gcc6.patch
-> Found qt4-glibc-2.25.patch
-> Found qt4-icu59.patch
-> Found qt4-openssl-1.1.patch
==> Validating source files with sha512sums...
qt-everywhere-opensource-src-4.8.7.tar.gz ... Passed
improve-cups-support.patch ... Passed
moc-boost-workaround.patch ... Passed
kubuntu_14_systemtrayicon.diff ... Passed
kde4-settings.patch ... Passed
glib-honor-ExcludeSocketNotifiers-flag.diff ... Passed
disable-sslv3.patch ... Passed
l-qclipboard_fix_recursive.patch ... Passed
l-qclipboard_delay.patch ... Passed
qt4-gcc6.patch ... Passed
qt4-glibc-2.25.patch ... Passed
qt4-icu59.patch ... Passed
qt4-openssl-1.1.patch ... Passed
==> Making package: lib32-qt4 4.8.7-13 (Thu Jun 29 09:46:52 CEST 2017)
==> Checking runtime dependencies...
==> Installing missing dependencies...
:: There are 3 providers available for lib32-libgl:
:: Repository multilib

  1. lib32-libglvnd 2) lib32-nvidia-304xx-utils 3) lib32-nvidia-340xx-utils

Enter a number (default=1):
error: target not found: lib32-libmng
==> ERROR: 'pacman' failed to install missing dependencies.
==> ERROR: Build failed, check /var/lib/archbuild/multilib-x86_64/juha/build
Installing lib32-qt4
error: no targets specified (use -h for help)
Successfully installed .

@mk0lev
Copy link

mk0lev commented Jul 7, 2017

@lockheed It is because the current PGP key for lib32-libmng is 8048643BA2C840F4F92A195FF54984BFA16C640F. So, just follow benoliver999's instructions, which are right above your comment.

@lockheed
Copy link

lockheed commented Jul 7, 2017

@mk0lev, I have tried it before posting, but it does not work:

$ gpg --recv-keys 8048643BA2C840F4F92A195FF54984BFA16C640F
gpg: keyserver receive failed: Connection refused

@atasoglou
Copy link

I get this error:

make[1]: *** [Makefile:14643: .obj/release-shared/qlocale_icu.o] Error 1
make[1]: Leaving directory '/build/lib32-qt4/src/qt-everywhere-opensource-src-4.8.7/src/corelib'
make: *** [Makefile:206: sub-corelib-make_default-ordered] Error 2
==> ERROR: A failure occurred in build().
Aborting...
==> ERROR: Build failed, check /var/lib/archbuild/multilib-x86_64/tanasaki/build
Installing lib32-qt4
error: no targets specified (use -h for help)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment