Move scripts and sources to sub directories

No functional changes.

Change-Id: I2564bb309dc6bdff245b5689f49c6065e61b91c3
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
This commit is contained in:
Jeffy Chen
2021-11-03 11:36:10 +08:00
parent e73f573666
commit b235a52d08
10 changed files with 14 additions and 15 deletions

17
scripts/fixup_dummy.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh -e
[ $# -lt 2 ] && {
echo "usage: $0 <dest dir> <source library>"
exit 1
}
DEST_DIR="${MESON_INSTALL_DESTDIR_PREFIX:-/usr}/$1"
SOURCE="$(basename $2)"
# Replace dummy library
cd "$DEST_DIR"
cp $SOURCE libmali.so
cp -a libmali.so $SOURCE
# For old DDK(e.g. utgard)
cp -a libmali.so libMali.so.1

15
scripts/fixup_nowrap.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh -e
[ $# -lt 1 ] && {
echo "usage: $0 <dest dir>"
exit 1
}
BUILD_DIR="${MESON_BUILD_ROOT:-build}"
DEST_DIR="${MESON_INSTALL_DESTDIR_PREFIX:-/usr}/$1"
# Cleanup wrappers
cd "$DEST_DIR"
for f in $(cd $BUILD_DIR && find . -maxdepth 1 -type f -name "lib*"); do
echo $f | grep -q libmali.so || cp -a libmali.so $f
done

11
scripts/fixup_nox11.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh -e
[ $# -lt 1 ] && {
echo "usage: $0 <path of include>"
exit 1
}
HEADER="${MESON_INSTALL_DESTDIR_PREFIX:-/usr}/$1/EGL/eglplatform.h"
[ -f "$HEADER" ] && \
sed -i 's/MESA_EGL_NO_X11_HEADERS/__unix__/g' "$HEADER"

28
scripts/grabber.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
ARCH=${1:-aarch64}
GPU=${2:-midgard-t86x}
VERSION=${3:-r18p0}
SUBVERSION=${4:-none}
PLATFORM=${5:-x11}
OPTIMIZE=${6:-O3}
[ ${ARCH} = 'armv7l' -o ${ARCH} = 'armhf' -o ${ARCH} = 'arm32' ] && ARCH=arm
[ ${ARCH} = 'armv8' -o ${ARCH} = 'arm64' ] && ARCH=aarch64
if [ ${SUBVERSION} = 'none' ]; then
LIB="libmali-${GPU}-${VERSION}-${PLATFORM}.so"
elif [ ${SUBVERSION} = 'all' ]; then
LIB="libmali-${GPU}-${VERSION}*-${PLATFORM}.so"
else
LIB="libmali-${GPU}-${VERSION}-${SUBVERSION}-${PLATFORM}.so"
fi
DIR=lib
case ${OPTIMIZE} in
O*)
DIR=optimize_${OPTIMIZE#O}
;;
esac
find ${DIR}/${ARCH}* -name ${LIB}

26
scripts/normalize.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
SONAME=libmali.so.1
LIBS=$(find optimize_*/ -name "*.so")
for lib in $LIBS; do
DEPS=$(readelf -d $lib)
# Hack out-dated deps
for dep in libffi.so.6 libcrypto.so.1.0.0; do
echo $DEPS | grep -wq $dep &&
patchelf $lib --replace-needed $dep ${dep%.so*}.so
done
# Set a common soname
echo $DEPS | grep -q "Library soname: \[$SONAME\]" ||
patchelf --set-soname $SONAME $lib
# Rename default libs to -x11
echo $lib | grep -qE "\-[rg].p.\.so" || continue
[ ! -L $lib ] && mv $lib ${lib%.so}-x11.so
rm $lib
done
# Update debian control and rules
scripts/update_debian.sh

59
scripts/parse_name.sh Executable file
View File

@@ -0,0 +1,59 @@
#!/bin/sh
PRINT_GPU=false
PRINT_VERSION=false
PRINT_SUBVERSION=false
PRINT_PLATFORM=false
PLATFORMS="gbm|wayland|x11|only-cl|dummy"
parse_name() {
[ -z "$1" ] && return
GPU=$(echo $1|cut -d'-' -f'2,3')
VERSION=$(echo $1|cut -d'-' -f4)
PLATFORM=$(echo $1|grep -owE "$PLATFORMS"|xargs -n 1|tail -1)
[ -z "$PLATFORM" ] && PLATFORM=x11
SUBVERSION=$(echo ${1%-$PLATFORM}|cut -d'-' -f'5-')
if $PRINT_GPU;then
echo $GPU
elif $PRINT_VERSION;then
echo $VERSION
elif $PRINT_SUBVERSION;then
echo $SUBVERSION
elif $PRINT_PLATFORM;then
echo $PLATFORM
else
echo name=$1
echo gpu=$GPU
echo version=$VERSION
echo subversion=$SUBVERSION
echo platform=$PLATFORM
fi
}
case "$1" in
--gpu)
PRINT_GPU=true
shift
;;
--version)
PRINT_VERSION=true
shift
;;
--subversion)
PRINT_SUBVERSION=true
shift
;;
--platform)
PRINT_PLATFORM=true
shift
;;
esac
for lib in "$@";do
parse_name $(echo $lib|grep -o "libmali-[^\.]*")
done

43
scripts/update_debian.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/sh
# Generate targets and packages
find lib -type f | sed 's,^lib/,,' | sort > debian/targets
TARGETS=$(cat debian/targets)
PACKAGES=$(cat debian/targets | sed "s/.*\(libmali.*\).so/\1/" | sort | uniq)
rm -f control.*
# NOTE: Assuming multiarch packages could share debian files
for target in $TARGETS; do
#export $(scripts/parse_name.sh $target)
#package=$name
package=$(basename ${target%.so})
control=control.$package
if echo $target | grep -q aarch64; then
arch=arm64
else
arch=armhf
fi
# Handle multiarch packages
if [ -e $control ]; then
sed -i "s/\(Architecture:\).*/\1 armhf arm64/" $control
continue
fi
cat << EOF > $control
Package: $package
Architecture: $arch
Provides: libmali
Conflicts: libmali
Replaces: libmali
Depends: \${shlibs:Depends}, \${misc:Depends}
Description: Mali GPU User-Space Binary Drivers
EOF
done
# Generate control
cat debian/control.in control.* > debian/control
rm -f control.*