-
Notifications
You must be signed in to change notification settings - Fork 6
/
pacman.sh
executable file
·71 lines (56 loc) · 2.27 KB
/
pacman.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# pacman.sh by Wouter Wijsman ([email protected])
# Exit on errors
set -e
set -u
## Remove $CC and $CXX for configure
unset CC
unset CXX
## Enter the psp-pacman directory.
cd "$(dirname "$0")"
## Load common functions
source common.sh
## Variables used to build
PACMAN_VERSION="6.0.1"
INSTALL_DIR="${PSPDEV}/share/pacman"
BASE_PATH="${PWD}"
## Prepare the build environment
mkdir -p "${BASE_PATH}/build"
cd "${BASE_PATH}/build"
download_and_extract https://gitlab.archlinux.org/pacman/pacman/-/archive/v${PACMAN_VERSION}/pacman-v${PACMAN_VERSION}.tar.gz pacman-v${PACMAN_VERSION}
## Fix some lines in the scripts which have hardcoded paths
find ./ -type f -name "*.in" -exec sed -i -e "s#LIBRARY=\${LIBRARY:-'@libmakepkgdir@'}#LIBRARY=\${LIBRARY:-\"\${PSPDEV}/share/makepkg\"}#g" {} \;
find ./ -type f -name "*.in" -exec sed -i -e "s#declare -r confdir='@sysconfdir@'#declare -r confdir=\"\${PSPDEV}/etc\"#g" {} \;
find ./ -type f -name "*.in" -exec sed -i -e "s#export TEXTDOMAINDIR='@localedir@'#export TEXTDOMAINDIR=\"\${PSPDEV}/share/locale\"#g" {} \;
find ./ -type f -name "*.in" -exec sed -i -e 's#@libmakepkgdir@#${PSPDEV}/share/makepkg#g' {} \;
## Apply patch
apply_patch pacman-${PACMAN_VERSION}
## Install meson and ninja in the current directory
setup_build_system
## Build pacman
meson build -Dprefix="${PSPDEV}" --buildtype=release \
-Ddefault_library=static -Dbuildscript=PSPBUILD \
-Dprefix="${PSPDEV}" -Dsysconfdir="${PSPDEV}/etc" -Dbindir="${PSPDEV}/share/pacman/bin" -Dlocalstatedir="${PSPDEV}/var" \
-Ddoc=disabled -Di18n=false
cd build
ninja
## Install
ninja install
## Install configuration files and wrapper script
cd "${BASE_PATH}"
install -d "${PSPDEV}/etc/"
install -m 644 config/pacman.conf "${PSPDEV}/etc/pacman.conf"
install -m 644 config/makepkg.conf "${PSPDEV}/etc/makepkg.conf"
install -d "${PSPDEV}/bin/"
install -m 755 scripts/psp-pacman "${PSPDEV}/bin/psp-pacman"
install -m 755 scripts/psp-makepkg "${PSPDEV}/bin/psp-makepkg"
## Make sure the dbpath directory exists
mkdir -p "${PSPDEV}/var/lib/pacman"
## Store build information
BUILD_FILE="${PSPDEV}/build.txt"
if [[ -f "${BUILD_FILE}" ]]; then
sed -i'' '/^psp-pacman /d' "${BUILD_FILE}"
fi
git log -1 --format="psp-pacman %H %cs %s" >> "${BUILD_FILE}"
## Done
echo "psp-pacman installation finished."