Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 82 lines (57 sloc) 2.19 KB
#! /bin/bash
# ------------------------------------------------------------------- Debug
# COOKIE=$(mcookie|cut -c-8); grep -v V_GREP_ME $0 > /dev/shm/runme-$COOKIE.sh ; sleep 0.3; exec bash /dev/shm/runme-$COOKIE.sh
# TESTING=1
# ---------------------------------------------------------------- Preamble
PKG=proot
VERSION=5.4.0
PYTHONVERSION=3.11.7
BUILD=0
PREFIX=/pkg/$PKG-$VERSION-$BUILD
if [ -n "$TESTING" ]; then PREFIX=/scratch/local2/$PKG-$VERSION-$BUILD ; fi
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin
set -e
umask 022
BUILD_TMPDIR=/scratch/local2/$PKG-$VERSION-$BUILD.$USER.build.tmp
test -d $BUILD_TMPDIR && ( chmod -R u+rwx $BUILD_TMPDIR || true ; rm -rf $BUILD_TMPDIR )
mkdir -p $BUILD_TMPDIR/home/.cache/pip
mkdir -p $BUILD_TMPDIR/home/.local
export TMPDIR=$BUILD_TMPDIR
export HOME=$BUILD_TMPDIR/home
exec </dev/null
mkdir -p $PREFIX
cat >$PREFIX/profile <<-EOF
PATH=$PREFIX/bin:\$PATH
export LD_LIBRARY_PATH=$PREFIX/lib\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH
if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH ; fi
EOF
. $PREFIX/profile
NPROC=$(( $(nproc) * 4 / 5 + 1 ))
export MAKEFLAGS="-j $NPROC"
BUILDDIR=$PREFIX/build
mkdir -p $BUILDDIR
cd $BUILDDIR
# --------------------------------------------------- Build a static Python
(
# orig: https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tgz
BEEHIVE=https://beehive.molgen.mpg.de/ef61f81ec82c490484219c7f0ec96783/Python-3.11.7.tgz
test -e Python-$PYTHONVERSION.tgz || wget -nv $BEEHIVE
test -d Python-$PYTHONVERSION || tar -xf Python-$PYTHONVERSION.tgz
cd Python-$PYTHONVERSION
LDFLAGS="-Wl,-rpath=$PREFIX/lib" \
./configure \
--prefix=$PREFIX \
--with-static-libpython \
--disable-shared \
--disable-test-modules
make -j $NPROC
make install
test -e $PREFIX/bin/python || ln -s python3 $PREFIX/bin/python
)
test -d proot || git clone --recurse-submodules https://github.com/proot-me/proot
cd proot
make -C src loader.elf loader-m32.elf build.h # first build the config and loader
make -C src proot care # then compile PRoot and CARE
cp -p src/care $PREFIX/bin
cp -p src/proot $PREFIX/bin
exit 0