olex2: merge sysroot/lib64 (libgcc) into usr/lib64; make configure re-runnable
This commit is contained in:
1 parent
f6b63e740d
commit
fffd36970c
2 files changed
+31
-12
No files matched your search
+5
-1
@@ -79,7 +79,11 @@ executable and must match its libc. So the recipe:
|
||||
|
||||
- ships glibc 2.39 + GCC 14 `libstdc++`/`libgcc_s` under `$PREFIX/sysroot`
|
||||
(frozen Fedora 40 rpms from kojipkgs, Fedora's permanent build archive;
|
||||
same glibc generation as the upstream build host);
|
||||
same glibc generation as the upstream build host). glibc and libstdc++
|
||||
unpack to `usr/lib64`, libgcc to `/lib64` (Fedora relies on the
|
||||
filesystem package's `lib64 -> usr/lib64` symlink, which we do not
|
||||
extract), so `configure` merges `lib64` into `usr/lib64` and recreates
|
||||
the symlink — one lib dir for the RPATH;
|
||||
- runs `patchelf --set-interpreter <sysroot ld.so> --force-rpath --set-rpath
|
||||
<sysroot libdir>:$PREFIX/lib:$PREFIX/ilib:$PREFIX/cctbx/cctbx_build/lib:$PREFIX:$ORIGIN`
|
||||
on every dynamic executable (`hart`, `hart_mpi` are static and skipped).
|
||||
|
||||
+26
-11
@@ -40,17 +40,23 @@ OLEX2_PATCH_EXES=(olex2c olex2 unirun NoSpherA2 hart_mpi)
|
||||
|
||||
pbuild::configure() {
|
||||
local -r zip="${SRC_DIR}/olex2-${V}-linux64.zip"
|
||||
[[ -s "${zip}" ]] || std::die 42 "olex2: ${zip} not found - prep did not fetch it. \
|
||||
Pre-stage the archive by hand as <distdir>/olex2-${V}-linux64.zip (see README) and re-run."
|
||||
command -v unzip >/dev/null || std::die 42 "olex2: 'unzip' not on PATH on this build host"
|
||||
# partial downloads reused from distfiles are the classic failure: test the archive first
|
||||
unzip -tq "${zip}" >/dev/null || \
|
||||
std::die 42 "olex2: archive is corrupt/truncated - rm <distdir>/olex2-${V}-linux64.zip and re-run"
|
||||
# ~1 GB unpacked (cctbx + python + sample data); SRC_DIR is under --tmpdir
|
||||
unzip -q -o "${zip}" -d "${SRC_DIR}" || std::die 42 "olex2: unzip failed (disk/quota at --tmpdir?)"
|
||||
[[ -f "${SRC_DIR}/olex2/olex2c" && -f "${SRC_DIR}/olex2/olex2" ]] || \
|
||||
std::die 42 "olex2: unexpected archive layout - expected ${SRC_DIR}/olex2/{olex2,olex2c}"
|
||||
rm -f "${zip}"
|
||||
if [[ -f "${SRC_DIR}/olex2/olex2c" && -f "${SRC_DIR}/olex2/olex2" ]]; then
|
||||
# re-run after a failed configure/install: prep's stamp is set, the
|
||||
# tree is already unpacked - reuse it (the zip may be gone from SRC_DIR)
|
||||
echo "olex2: reusing unpacked tree in ${SRC_DIR}/olex2"
|
||||
else
|
||||
[[ -s "${zip}" ]] || std::die 42 "olex2: ${zip} not found - prep did not fetch it. \
|
||||
Pre-stage the archive by hand as <distdir>/olex2-${V}-linux64.zip (see README) and re-run (-f)."
|
||||
command -v unzip >/dev/null || std::die 42 "olex2: 'unzip' not on PATH on this build host"
|
||||
# partial downloads reused from distfiles are the classic failure: test the archive first
|
||||
unzip -tq "${zip}" >/dev/null || \
|
||||
std::die 42 "olex2: archive is corrupt/truncated - rm <distdir>/olex2-${V}-linux64.zip and re-run"
|
||||
# ~1 GB unpacked (cctbx + python + sample data); SRC_DIR is under --tmpdir
|
||||
unzip -q -o "${zip}" -d "${SRC_DIR}" || std::die 42 "olex2: unzip failed (disk/quota at --tmpdir?)"
|
||||
[[ -f "${SRC_DIR}/olex2/olex2c" && -f "${SRC_DIR}/olex2/olex2" ]] || \
|
||||
std::die 42 "olex2: unexpected archive layout - expected ${SRC_DIR}/olex2/{olex2,olex2c}"
|
||||
rm -f "${zip}" # 255 MB copy; the distfiles cache keeps the original
|
||||
fi
|
||||
|
||||
# --- private glibc 2.39 + libstdc++ 14 sysroot (Fedora 40 rpms) ----------
|
||||
command -v rpm2cpio >/dev/null && command -v cpio >/dev/null || \
|
||||
@@ -64,6 +70,15 @@ Pre-stage the archive by hand as <distdir>/olex2-${V}-linux64.zip (see README) a
|
||||
( cd "${sysroot}" && rpm2cpio "${SRC_DIR}/${rpm}" | cpio -idm --quiet ) || \
|
||||
std::die 42 "olex2: extracting ${rpm} failed"
|
||||
done
|
||||
# Fedora's glibc + libstdc++ install to /usr/lib64 but libgcc still to
|
||||
# /lib64, which on a real system is the filesystem package's symlink to
|
||||
# usr/lib64 - we do not extract that package, so recreate the merge here.
|
||||
if [[ -d "${sysroot}/lib64" && ! -L "${sysroot}/lib64" ]]; then
|
||||
mkdir -p "${sysroot}/usr/lib64"
|
||||
cp -r --preserve=mode,timestamps,links "${sysroot}/lib64/." "${sysroot}/usr/lib64/" && \
|
||||
rm -rf "${sysroot}/lib64" && ln -s usr/lib64 "${sysroot}/lib64" || \
|
||||
std::die 42 "olex2: merging sysroot/lib64 into sysroot/usr/lib64 failed"
|
||||
fi
|
||||
local ld libc libdir
|
||||
ld="$(find "${sysroot}" -type f -name 'ld-linux-x86-64.so.2' -print -quit)"
|
||||
libc="$(find "${sysroot}" -type f -name 'libc.so.6' -print -quit)"
|
||||
|
||||
Reference in new issue
Block a user