[scripts,bash] reformat bash scripts

This commit is contained in:
akallabeth 2025-02-25 13:31:20 +01:00
parent 418d228d4b
commit 2adca10b3c
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
19 changed files with 901 additions and 984 deletions

View File

@ -1,11 +1,10 @@
#!/bin/bash -xe #!/bin/bash -xe
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
MANIFEST=com.freerdp.FreeRDP MANIFEST=com.freerdp.FreeRDP
BUILD_BASE=$(mktemp -d) BUILD_BASE=$(mktemp -d)
if [ $# -gt 0 ]; if [ $# -gt 0 ]; then
then
BUILD_BASE=$1 BUILD_BASE=$1
fi fi
@ -15,15 +14,13 @@ BUILD=$BUILD_BASE/build
STATE=$BUILD_BASE/state STATE=$BUILD_BASE/state
BUILDER=$(which flatpak-builder) BUILDER=$(which flatpak-builder)
if [ ! -x "$BUILDER" ]; if [ ! -x "$BUILDER" ]; then
then
echo "command 'flatpak-builder' could not be found, please install and add to PATH" echo "command 'flatpak-builder' could not be found, please install and add to PATH"
exit 1 exit 1
fi fi
FLATPAK=$(which flatpak) FLATPAK=$(which flatpak)
if [ ! -x "$FLATPAK" ]; if [ ! -x "$FLATPAK" ]; then
then
echo "command 'flatpak' could not be found, please install and add to PATH" echo "command 'flatpak' could not be found, please install and add to PATH"
exit 1 exit 1
fi fi

View File

@ -1,19 +1,15 @@
#!/bin/sh #!/bin/sh
if [ -z ${FREERDP_SDL_OFF} ]; if [ -z ${FREERDP_SDL_OFF} ]; then
then
echo "SDL $(which sdl-freerdp)" echo "SDL $(which sdl-freerdp)"
sdl-freerdp $@ sdl-freerdp $@
exit $rc exit $rc
else else
if [ -z $XDG_SESSION_TYPE ]; if [ -z $XDG_SESSION_TYPE ]; then
then
echo "XDG_SESSION_TYPE undefined" echo "XDG_SESSION_TYPE undefined"
exit -1 exit -1
elif [ "$XDG_SESSION_TYPE" = "wayland" ]; elif [ "$XDG_SESSION_TYPE" = "wayland" ]; then
then if [ -z $FREERDP_WAYLAND_OFF ]; then
if [ -z $FREERDP_WAYLAND_OFF ];
then
echo "wayland $(which wlfreerdp)" echo "wayland $(which wlfreerdp)"
wlfreerdp $@ wlfreerdp $@
exit $rc exit $rc
@ -22,8 +18,7 @@ else
xfreerdp $@ xfreerdp $@
exit $rc exit $rc
fi fi
elif [ "$XDG_SESSION_TYPE" = "x11" ]; elif [ "$XDG_SESSION_TYPE" = "x11" ]; then
then
echo "X11 $(which xfreerdp)" echo "X11 $(which xfreerdp)"
xfreerdp $@ xfreerdp $@
exit $rc exit $rc

View File

@ -6,8 +6,7 @@ SCRIPT_PATH=$(realpath "$SCRIPT_PATH")
BUILD_DEPS=$(/usr/bin/which dpkg-checkbuilddeps) BUILD_DEPS=$(/usr/bin/which dpkg-checkbuilddeps)
BUILD_PKG=$(/usr/bin/which dpkg-buildpackage) BUILD_PKG=$(/usr/bin/which dpkg-buildpackage)
if [ -z "$BUILD_DEPS" ] || [ -z "$BUILD_PKG" ]; if [ -z "$BUILD_DEPS" ] || [ -z "$BUILD_PKG" ]; then
then
echo "dpkg-buildpackage [$BUILD_PKG] and dpkg-checkbuilddeps [$BUILD_DEPS] required" echo "dpkg-buildpackage [$BUILD_PKG] and dpkg-checkbuilddeps [$BUILD_DEPS] required"
echo "Install with 'sudo apt install dpkg-dev'" echo "Install with 'sudo apt install dpkg-dev'"
exit 1 exit 1

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
ln -s packaging/deb/freerdp-nightly debian ln -s packaging/deb/freerdp-nightly debian
git rev-parse --short HEAD > .source_version git rev-parse --short HEAD >.source_version

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
git rev-parse --short HEAD > source_version git rev-parse --short HEAD >source_version

View File

@ -22,8 +22,7 @@ CMAKE_CMD_ARGS="-DANDROID_NDK=$ANDROID_NDK \
-DCMAKE_MAKE_PROGRAM=make" -DCMAKE_MAKE_PROGRAM=make"
BASE=$(pwd) BASE=$(pwd)
for ARCH in $BUILD_ARCH for ARCH in $BUILD_ARCH; do
do
common_run cd $BASE common_run cd $BASE
common_run mkdir -p $BUILD_SRC/cJSON-build/$ARCH common_run mkdir -p $BUILD_SRC/cJSON-build/$ARCH
common_run cd $BUILD_SRC/cJSON-build/$ARCH common_run cd $BUILD_SRC/cJSON-build/$ARCH

View File

@ -1,16 +1,17 @@
#!/bin/bash -x #!/bin/bash -x
SCRIPT_NAME="${BASH_SOURCE[0]}"
SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]}") SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]}")
SCRIPT_PATH=$(realpath "$SCRIPT_PATH") SCRIPT_PATH=$(realpath "$SCRIPT_PATH")
FIND_ARGS="-type f -print -quit" FIND_ARGS="-type f -print -quit"
case "$(uname -s)" in case "$(uname -s)" in
Darwin) Darwin)
FIND_ARGS="-perm +111 $FIND_ARGS" FIND_ARGS="-perm +111 $FIND_ARGS"
;; ;;
*) *)
FIND_ARGS="-executable $FIND_ARGS" FIND_ARGS="-executable $FIND_ARGS"
;; ;;
esac esac
@ -62,7 +63,7 @@ fi
CLEAN_BUILD_DIR=0 CLEAN_BUILD_DIR=0
function common_help { function common_help {
echo "$(BASHSOURCE[0]) supports the following arguments:" echo "$SCRIPT_NAME supports the following arguments:"
echo " --ndk The base directory of your android NDK defa" echo " --ndk The base directory of your android NDK defa"
echo " ANDROID_NDK=$ANDROID_NDK" echo " ANDROID_NDK=$ANDROID_NDK"
echo " --sdk The base directory of your android SDK defa" echo " --sdk The base directory of your android SDK defa"
@ -88,57 +89,48 @@ function common_run {
echo "[RUN] $@" echo "[RUN] $@"
"$@" "$@"
RES=$? RES=$?
if [[ $RES -ne 0 ]]; if [[ $RES -ne 0 ]]; then
then
echo "[ERROR] $@ returned $RES" echo "[ERROR] $@ returned $RES"
exit 1 exit 1
fi fi
} }
function common_check_requirements { function common_check_requirements {
if [[ ! -d $ANDROID_NDK ]]; if [[ ! -d $ANDROID_NDK ]]; then
then
echo "export ANDROID_NDK to point to your NDK location." echo "export ANDROID_NDK to point to your NDK location."
exit 1 exit 1
fi fi
if [[ ! -d $ANDROID_SDK ]]; if [[ ! -d $ANDROID_SDK ]]; then
then
echo "export ANDROID_SDK to point to your SDK location." echo "export ANDROID_SDK to point to your SDK location."
exit 1 exit 1
fi fi
if [[ -z $BUILD_DST ]]; if [[ -z $BUILD_DST ]]; then
then
echo "Destination directory not valid" echo "Destination directory not valid"
exit 1 exit 1
fi fi
if [[ -z $BUILD_SRC ]]; if [[ -z $BUILD_SRC ]]; then
then
echo "Source directory not valid" echo "Source directory not valid"
exit 1 exit 1
fi fi
if [[ -z $SCM_URL ]]; if [[ -z $SCM_URL ]]; then
then
echo "Source URL not defined! Define SCM_URL" echo "Source URL not defined! Define SCM_URL"
exit 1 exit 1
fi fi
if [[ -z $SCM_TAG ]]; if [[ -z $SCM_TAG ]]; then
then
echo "SCM_TAG / BRANCH not defined! Define SCM_TAG" echo "SCM_TAG / BRANCH not defined! Define SCM_TAG"
exit 1 exit 1
fi fi
if [[ -z $SCM_HASH ]]; if [[ -z $SCM_HASH ]]; then
then
echo "SCM_HASH not defined! Define SCM_HASH" echo "SCM_HASH not defined! Define SCM_HASH"
exit 1 exit 1
fi fi
if [[ -z $NDK_TARGET ]]; if [[ -z $NDK_TARGET ]]; then
then
echo "Android platform NDK_TARGET not defined" echo "Android platform NDK_TARGET not defined"
exit 1 exit 1
fi fi
@ -151,27 +143,23 @@ function common_check_requirements {
fi fi
fi fi
for CMD in make git $CMAKE_PROGRAM for CMD in make git $CMAKE_PROGRAM; do
do
if ! type $CMD >/dev/null; then if ! type $CMD >/dev/null; then
echo "Command $CMD not found. Install and add it to the PATH." echo "Command $CMD not found. Install and add it to the PATH."
exit 1 exit 1
fi fi
done done
if [ "${BUILD_SRC:0:1}" != "/" ]; if [ "${BUILD_SRC:0:1}" != "/" ]; then
then
BUILD_SRC=$(pwd)/$BUILD_SRC BUILD_SRC=$(pwd)/$BUILD_SRC
fi fi
if [ "${BUILD_DST:0:1}" != "/" ]; if [ "${BUILD_DST:0:1}" != "/" ]; then
then
BUILD_DST=$(pwd)/$BUILD_DST BUILD_DST=$(pwd)/$BUILD_DST
fi fi
} }
function common_parse_arguments { function common_parse_arguments {
while [[ $# > 0 ]] while [[ $# > 0 ]]; do
do
key="$1" key="$1"
case $key in case $key in
--conf) --conf)
@ -244,8 +232,7 @@ function common_parse_arguments {
} }
function common_update { function common_update {
if [ $# -ne 4 ]; if [ $# -ne 4 ]; then
then
echo "Invalid arguments to update function $@" echo "Invalid arguments to update function $@"
exit 1 exit 1
fi fi
@ -260,15 +247,12 @@ function common_update {
common_run mkdir -p $CACHE common_run mkdir -p $CACHE
TARFILE="$CACHE/$SCM_TAG.tar.gz" TARFILE="$CACHE/$SCM_TAG.tar.gz"
if [[ ! -f "$TARFILE" ]]; if [[ ! -f "$TARFILE" ]]; then
then
WGET=$(which wget) WGET=$(which wget)
CURL=$(which curl) CURL=$(which curl)
if [ -x "$CURL" ]; if [ -x "$CURL" ]; then
then
common_run $CURL -L -o "$TARFILE" "$SCM_URL/$SCM_TAG.tar.gz" common_run $CURL -L -o "$TARFILE" "$SCM_URL/$SCM_TAG.tar.gz"
elif [ -x "$WGET" ]; elif [ -x "$WGET" ]; then
then
common_run $WGET -O "$TARFILE" "$SCM_URL/$SCM_TAG.tar.gz" common_run $WGET -O "$TARFILE" "$SCM_URL/$SCM_TAG.tar.gz"
else else
echo "Neither wget nor curl installed, aborting" echo "Neither wget nor curl installed, aborting"
@ -276,11 +260,10 @@ function common_update {
fi fi
fi fi
echo "$SCM_HASH $TARFILE" > $TARFILE.sha256sum echo "$SCM_HASH $TARFILE" >$TARFILE.sha256sum
common_run sha256sum -c $TARFILE.sha256sum common_run sha256sum -c $TARFILE.sha256sum
if [[ -d $BUILD_SRC ]]; if [[ -d $BUILD_SRC ]]; then
then
common_run rm -rf $BUILD_SRC common_run rm -rf $BUILD_SRC
fi fi
common_run mkdir -p $BUILD_SRC common_run mkdir -p $BUILD_SRC
@ -291,13 +274,11 @@ function common_update {
} }
function common_clean { function common_clean {
if [ $CLEAN_BUILD_DIR -ne 1 ]; if [ $CLEAN_BUILD_DIR -ne 1 ]; then
then
return return
fi fi
if [ $# -ne 1 ]; if [ $# -ne 1 ]; then
then
echo "Invalid arguments to clean function $@" echo "Invalid arguments to clean function $@"
exit 1 exit 1
fi fi
@ -307,24 +288,20 @@ function common_clean {
} }
function common_copy { function common_copy {
if [ $# -ne 2 ]; if [ $# -ne 2 ]; then
then
echo "Invalid arguments to copy function $@" echo "Invalid arguments to copy function $@"
exit 1 exit 1
fi fi
if [ ! -d $1 ] || [ ! -d $1/include ] || [ ! -d $1/libs ]; if [ ! -d $1 ] || [ ! -d $1/include ] || [ ! -d $1/libs ]; then
then
echo "Invalid source $1" echo "Invalid source $1"
exit 1 exit 1
fi fi
if [ -z $2 ]; if [ -z $2 ]; then
then
echo "Invalid destination $2" echo "Invalid destination $2"
exit 1 exit 1
fi fi
if [ ! -d $2 ]; if [ ! -d $2 ]; then
then
common_run mkdir -p $2 common_run mkdir -p $2
fi fi
common_run cp -L -r $1/include $2 common_run cp -L -r $1/include $2

View File

@ -10,16 +10,16 @@ source $(dirname "${BASH_SOURCE[0]}")/android-build-common.sh
function get_toolchain() { function get_toolchain() {
HOST_OS=$(uname -s) HOST_OS=$(uname -s)
case ${HOST_OS} in case ${HOST_OS} in
Darwin) HOST_OS=darwin;; Darwin) HOST_OS=darwin ;;
Linux) HOST_OS=linux;; Linux) HOST_OS=linux ;;
FreeBsd) HOST_OS=freebsd;; FreeBsd) HOST_OS=freebsd ;;
CYGWIN*|*_NT-*) HOST_OS=cygwin;; CYGWIN* | *_NT-*) HOST_OS=cygwin ;;
esac esac
HOST_ARCH=$(uname -m) HOST_ARCH=$(uname -m)
case ${HOST_ARCH} in case ${HOST_ARCH} in
i?86) HOST_ARCH=x86;; i?86) HOST_ARCH=x86 ;;
x86_64|amd64) HOST_ARCH=x86_64;; x86_64 | amd64) HOST_ARCH=x86_64 ;;
esac esac
echo "${HOST_OS}-${HOST_ARCH}" echo "${HOST_OS}-${HOST_ARCH}"
@ -178,15 +178,13 @@ function build {
common_parse_arguments $@ common_parse_arguments $@
common_update $SCM_URL $SCM_TAG $BUILD_SRC $SCM_HASH common_update $SCM_URL $SCM_TAG $BUILD_SRC $SCM_HASH
HOST_PKG_CONFIG_PATH=`command -v pkg-config` HOST_PKG_CONFIG_PATH=$(command -v pkg-config)
if [ -z ${HOST_PKG_CONFIG_PATH} ]; then if [ -z ${HOST_PKG_CONFIG_PATH} ]; then
echo "(*) pkg-config command not found\n" echo "(*) pkg-config command not found\n"
exit 1 exit 1
fi fi
for ARCH in $BUILD_ARCH; do
for ARCH in $BUILD_ARCH
do
case ${ARCH} in case ${ARCH} in
armeabi-v7a) armeabi-v7a)
TARGET_CPU="armv7-a" TARGET_CPU="armv7-a"

View File

@ -28,8 +28,7 @@ source $SCRIPT_PATH/android-build.conf
# Parse arguments. # Parse arguments.
REMAINING="" REMAINING=""
while [[ $# > 0 ]] while [[ $# > 0 ]]; do
do
key="$1" key="$1"
case $key in case $key in
--freerdp-src) --freerdp-src)
@ -81,20 +80,17 @@ do
done done
common_parse_arguments $REMAINING common_parse_arguments $REMAINING
if [ -z ${WITH_MEDIACODEC+x} ]; if [ -z ${WITH_MEDIACODEC+x} ]; then
then
common_run echo "WITH_MEDIACODEC unset, defining WITH_MEDIACODEC=1" common_run echo "WITH_MEDIACODEC unset, defining WITH_MEDIACODEC=1"
WITH_MEDIACODEC=1 WITH_MEDIACODEC=1
fi fi
# clean up top # clean up top
if [ -d $BUILD_SRC ]; if [ -d $BUILD_SRC ]; then
then
common_clean $BUILD_SRC common_clean $BUILD_SRC
fi fi
if [ -d $BUILD_DST ]; if [ -d $BUILD_DST ]; then
then
common_run mkdir -p $BUILD_DST common_run mkdir -p $BUILD_DST
fi fi
@ -115,20 +111,16 @@ CMAKE_CMD_ARGS="-DANDROID_NDK=$ANDROID_NDK \
-DCMAKE_MAKE_PROGRAM=make" -DCMAKE_MAKE_PROGRAM=make"
BASE=$(pwd) BASE=$(pwd)
for ARCH in $BUILD_ARCH for ARCH in $BUILD_ARCH; do
do
# build dependencies. # build dependencies.
if [ $WITH_OPENH264 -ne 0 ]; if [ $WITH_OPENH264 -ne 0 ]; then
then if [ -z "$ANDROID_NDK_OPENH264" ]; then
if [ -z "$ANDROID_NDK_OPENH264" ]
then
echo echo
echo "Warning: Missing openh264-ndk, using $ANDROID_NDK" >&2 echo "Warning: Missing openh264-ndk, using $ANDROID_NDK" >&2
echo echo
ANDROID_NDK_OPENH264=$ANDROID_NDK ANDROID_NDK_OPENH264=$ANDROID_NDK
fi fi
if [ $BUILD_DEPS -ne 0 ]; if [ $BUILD_DEPS -ne 0 ]; then
then
common_run bash $SCRIPT_PATH/android-build-openh264.sh \ common_run bash $SCRIPT_PATH/android-build-openh264.sh \
--src $BUILD_SRC/openh264 --dst $BUILD_DST \ --src $BUILD_SRC/openh264 --dst $BUILD_DST \
--sdk "$ANDROID_SDK" \ --sdk "$ANDROID_SDK" \
@ -143,17 +135,14 @@ do
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_OPENH264=OFF" CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_OPENH264=OFF"
fi fi
if [ $WITH_MEDIACODEC -ne 0 ]; if [ $WITH_MEDIACODEC -ne 0 ]; then
then
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_MEDIACODEC=ON" CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_MEDIACODEC=ON"
else else
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_MEDIACODEC=OFF" CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_MEDIACODEC=OFF"
fi fi
if [ $WITH_FFMPEG -ne 0 ]; if [ $WITH_FFMPEG -ne 0 ]; then
then if [ $BUILD_DEPS -ne 0 ]; then
if [ $BUILD_DEPS -ne 0 ];
then
common_run bash $SCRIPT_PATH/android-build-ffmpeg.sh \ common_run bash $SCRIPT_PATH/android-build-ffmpeg.sh \
--src $BUILD_SRC/ffmpeg --dst $BUILD_DST \ --src $BUILD_SRC/ffmpeg --dst $BUILD_DST \
--sdk "$ANDROID_SDK" \ --sdk "$ANDROID_SDK" \
@ -167,10 +156,8 @@ do
else else
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_FFMPEG=OFF -DWITH_SWSCALE=OFF" CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_FFMPEG=OFF -DWITH_SWSCALE=OFF"
fi fi
if [ $WITH_AAD -ne 0 ]; if [ $WITH_AAD -ne 0 ]; then
then if [ $BUILD_DEPS -ne 0 ]; then
if [ $BUILD_DEPS -ne 0 ];
then
common_run bash $SCRIPT_PATH/android-build-cjson.sh \ common_run bash $SCRIPT_PATH/android-build-cjson.sh \
--src $BUILD_SRC/cjson --dst $BUILD_DST \ --src $BUILD_SRC/cjson --dst $BUILD_DST \
--sdk "$ANDROID_SDK" \ --sdk "$ANDROID_SDK" \
@ -181,10 +168,8 @@ do
--hash $CJSON_HASH --hash $CJSON_HASH
fi fi
fi fi
if [ $WITH_OPENSSL -ne 0 ]; if [ $WITH_OPENSSL -ne 0 ]; then
then if [ $BUILD_DEPS -ne 0 ]; then
if [ $BUILD_DEPS -ne 0 ];
then
common_run bash $SCRIPT_PATH/android-build-openssl.sh \ common_run bash $SCRIPT_PATH/android-build-openssl.sh \
--src $BUILD_SRC/openssl --dst $BUILD_DST \ --src $BUILD_SRC/openssl --dst $BUILD_DST \
--sdk "$ANDROID_SDK" \ --sdk "$ANDROID_SDK" \
@ -197,8 +182,7 @@ do
fi fi
# Build and install the library. # Build and install the library.
if [ $DEPS_ONLY -eq 0 ]; if [ $DEPS_ONLY -eq 0 ]; then
then
common_run cd $BASE common_run cd $BASE
common_run mkdir -p $BUILD_SRC/freerdp-build/$ARCH common_run mkdir -p $BUILD_SRC/freerdp-build/$ARCH
common_run cd $BUILD_SRC/freerdp-build/$ARCH common_run cd $BUILD_SRC/freerdp-build/$ARCH

View File

@ -28,9 +28,7 @@ function build {
common_parse_arguments $@ common_parse_arguments $@
common_update $SCM_URL $SCM_TAG $BUILD_SRC $SCM_HASH common_update $SCM_URL $SCM_TAG $BUILD_SRC $SCM_HASH
for ARCH in $BUILD_ARCH; do
for ARCH in $BUILD_ARCH
do
case $ARCH in case $ARCH in
"armeabi") "armeabi")
OARCH="arm" OARCH="arm"
@ -50,14 +48,12 @@ do
build $OARCH $NDK_TARGET build $OARCH $NDK_TARGET
if [ ! -d $BUILD_DST/$ARCH/include ]; if [ ! -d $BUILD_DST/$ARCH/include ]; then
then
common_run mkdir -p $BUILD_DST/$ARCH/include common_run mkdir -p $BUILD_DST/$ARCH/include
fi fi
common_run cp -L -r $BUILD_SRC/libs/$OARCH/include/ $BUILD_DST/$ARCH/ common_run cp -L -r $BUILD_SRC/libs/$OARCH/include/ $BUILD_DST/$ARCH/
if [ ! -d $BUILD_DST/$ARCH ]; if [ ! -d $BUILD_DST/$ARCH ]; then
then
common_run mkdir -p $BUILD_DST/$ARCH common_run mkdir -p $BUILD_DST/$ARCH
fi fi
common_run cp -L $BUILD_SRC/libs/$OARCH/lib/*.so $BUILD_DST/$ARCH/ common_run cp -L $BUILD_SRC/libs/$OARCH/lib/*.so $BUILD_DST/$ARCH/

View File

@ -9,8 +9,7 @@ COMPILER=4.9
source $(dirname "${BASH_SOURCE[0]}")/android-build-common.sh source $(dirname "${BASH_SOURCE[0]}")/android-build-common.sh
function build { function build {
if [ $# -ne 2 ]; if [ $# -ne 2 ]; then
then
echo "Invalid arguments $@" echo "Invalid arguments $@"
exit 1 exit 1
fi fi
@ -32,8 +31,7 @@ function build {
common_run ./Configure ${CONFIG} -D__ANDROID_API__=$NDK_TARGET common_run ./Configure ${CONFIG} -D__ANDROID_API__=$NDK_TARGET
common_run make SHLIB_EXT=.so -j build_libs common_run make SHLIB_EXT=.so -j build_libs
if [ ! -d $DST_DIR ]; if [ ! -d $DST_DIR ]; then
then
common_run mkdir -p $DST_DIR common_run mkdir -p $DST_DIR
fi fi
@ -50,12 +48,12 @@ SCM_MOD_TAG=$SCM_TAG
case $SCM_TAG in OpenSSL_*) case $SCM_TAG in OpenSSL_*)
SCM_MOD_TAG=${SCM_TAG//OpenSSL_/openssl-} SCM_MOD_TAG=${SCM_TAG//OpenSSL_/openssl-}
SCM_MOD_TAG=${SCM_MOD_TAG//_/.} SCM_MOD_TAG=${SCM_MOD_TAG//_/.}
;;
esac esac
common_update "$SCM_URL/$SCM_TAG" $SCM_MOD_TAG $BUILD_SRC $SCM_HASH common_update "$SCM_URL/$SCM_TAG" $SCM_MOD_TAG $BUILD_SRC $SCM_HASH
ORG_PATH=$PATH ORG_PATH=$PATH
for ARCH in $BUILD_ARCH for ARCH in $BUILD_ARCH; do
do
case $ARCH in case $ARCH in
"armeabi-v7a") "armeabi-v7a")
@ -77,9 +75,7 @@ do
esac esac
done done
if [ ! -d $BUILD_DST/$ARCH/include ]; if [ ! -d $BUILD_DST/$ARCH/include ]; then
then
common_run mkdir -p $BUILD_DST/$ARCH/include common_run mkdir -p $BUILD_DST/$ARCH/include
fi fi
common_run cp -L -R $BUILD_SRC/include/openssl $BUILD_DST/$ARCH/include/ common_run cp -L -R $BUILD_SRC/include/openssl $BUILD_DST/$ARCH/include/

View File

@ -14,7 +14,7 @@ DATADIR=Resources
DEPLOYMENT_ARCH='arm64 x86_64' DEPLOYMENT_ARCH='arm64 x86_64'
DEPLOYMENT_TARGET=12 DEPLOYMENT_TARGET=12
usage () { usage() {
echo "${BASH_SOURCE[0]} [-a|--arch 'arch1 arch2 ...'] [-t|--target target][-h|--help]" echo "${BASH_SOURCE[0]} [-a|--arch 'arch1 arch2 ...'] [-t|--target target][-h|--help]"
echo "" echo ""
echo "default options:" echo "default options:"
@ -23,15 +23,13 @@ usage () {
} }
check_tools() { check_tools() {
for TOOL in mkdir rm mv git dirname pwd find cut basename grep xargs cmake ninja autoconf automake aclocal autoheader glibtoolize lipo otool install_name_tool; for TOOL in mkdir rm mv git dirname pwd find cut basename grep xargs cmake ninja autoconf automake aclocal autoheader glibtoolize lipo otool install_name_tool; do
do
set +e set +e
TOOL_PATH=$(which "$TOOL") TOOL_PATH=$(which "$TOOL")
set -e set -e
echo "$TOOL: $TOOL_PATH" echo "$TOOL: $TOOL_PATH"
if [ ! -f "$TOOL_PATH" ]; if [ ! -f "$TOOL_PATH" ]; then
then
echo "Missing $TOOL! please install and add to PATH." echo "Missing $TOOL! please install and add to PATH."
exit 1 exit 1
fi fi
@ -40,21 +38,21 @@ check_tools() {
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
-a|--arch) -a | --arch)
DEPLOYMENT_ARCH="$2" DEPLOYMENT_ARCH="$2"
shift # past argument shift # past argument
shift # past value shift # past value
;; ;;
-t|--target) -t | --target)
DEPLOYMENT_TARGET="$2" DEPLOYMENT_TARGET="$2"
shift # past argument shift # past argument
shift # past value shift # past value
;; ;;
-t|--target) -t | --target)
usage usage
exit 0 exit 0
;; ;;
-*|--*) -* | --*)
usage usage
exit 1 exit 1
;; ;;
@ -71,30 +69,24 @@ fix_rpath() {
SEARCH_PATH=$1 SEARCH_PATH=$1
FIX_PATH=$1 FIX_PATH=$1
EXT=".dylib" EXT=".dylib"
if [ "$#" -gt 1 ]; if [ "$#" -gt 1 ]; then
then
FIX_PATH=$2 FIX_PATH=$2
fi fi
if [ "$#" -gt 2 ]; if [ "$#" -gt 2 ]; then
then
EXT=$3 EXT=$3
fi fi
# some build systems do not handle @rpath on mac os correctly. # some build systems do not handle @rpath on mac os correctly.
# do check that and fix it. # do check that and fix it.
DYLIB_ABS_NAMES=$(find $SEARCH_PATH -type f -name "*$EXT") DYLIB_ABS_NAMES=$(find $SEARCH_PATH -type f -name "*$EXT")
for DYLIB_ABS in $DYLIB_ABS_NAMES; for DYLIB_ABS in $DYLIB_ABS_NAMES; do
do
DYLIB_NAME=$(basename $DYLIB_ABS) DYLIB_NAME=$(basename $DYLIB_ABS)
install_name_tool -id @rpath/$DYLIB_NAME $DYLIB_ABS install_name_tool -id @rpath/$DYLIB_NAME $DYLIB_ABS
for DYLIB_DEP in $(otool -L $DYLIB_ABS | grep "$FIX_PATH" | cut -d' ' -f1); for DYLIB_DEP in $(otool -L $DYLIB_ABS | grep "$FIX_PATH" | cut -d' ' -f1); do
do if [[ $DYLIB_DEP == $DYLIB_ABS ]]; then
if [[ $DYLIB_DEP == $DYLIB_ABS ]];
then
continue continue
elif [[ $DYLIB_DEP == $FIX_PATH/* ]]; elif [[ $DYLIB_DEP == $FIX_PATH/* ]]; then
then
DEP_BASE=$(basename $DYLIB_DEP) DEP_BASE=$(basename $DYLIB_DEP)
install_name_tool -change $DYLIB_DEP @rpath/$DEP_BASE $DYLIB_ABS install_name_tool -change $DYLIB_DEP @rpath/$DEP_BASE $DYLIB_ABS
fi fi
@ -104,8 +96,7 @@ fix_rpath() {
replace_rpath() { replace_rpath() {
FILE=$1 FILE=$1
for PTH in $(otool -l $FILE | grep -A2 LC_RPATH | grep path | xargs -J ' ' | cut -d ' ' -f2); for PTH in $(otool -l $FILE | grep -A2 LC_RPATH | grep path | xargs -J ' ' | cut -d ' ' -f2); do
do
install_name_tool -delete_rpath $PTH $FILE install_name_tool -delete_rpath $PTH $FILE
done done
install_name_tool -add_rpath @loader_path/../$LIBDIR $FILE install_name_tool -add_rpath @loader_path/../$LIBDIR $FILE
@ -113,8 +104,7 @@ replace_rpath() {
CMAKE_ARCHS= CMAKE_ARCHS=
OSSL_FLAGS="-mmacosx-version-min=$DEPLOYMENT_TARGET -I$INSTALL/include -L$INSTALL/lib" OSSL_FLAGS="-mmacosx-version-min=$DEPLOYMENT_TARGET -I$INSTALL/include -L$INSTALL/lib"
for ARCH in $DEPLOYMENT_ARCH; for ARCH in $DEPLOYMENT_ARCH; do
do
OSSL_FLAGS="$OSSL_FLAGS -arch $ARCH" OSSL_FLAGS="$OSSL_FLAGS -arch $ARCH"
CMAKE_ARCHS="$ARCH;$CMAKE_ARCHS" CMAKE_ARCHS="$ARCH;$CMAKE_ARCHS"
done done
@ -140,8 +130,7 @@ CMAKE_ARGS="-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON \
-DCMAKE_IGNORE_PREFIX_PATH='/opt/local;/usr/local;/opt/homebrew;/Library;~/Library' -DCMAKE_IGNORE_PREFIX_PATH='/opt/local;/usr/local;/opt/homebrew;/Library;~/Library'
" "
if [ ! -d $SRC ]; if [ ! -d $SRC ]; then
then
mkdir -p $SRC mkdir -p $SRC
cd $SRC cd $SRC
git clone --depth 1 -b openssl-3.3.1 https://github.com/openssl/openssl.git git clone --depth 1 -b openssl-3.3.1 https://github.com/openssl/openssl.git
@ -162,13 +151,11 @@ then
./bootstrap ./bootstrap
fi fi
if [ -d $INSTALL ]; if [ -d $INSTALL ]; then
then
rm -rf $INSTALL rm -rf $INSTALL
fi fi
if [ -d $BUILD ]; if [ -d $BUILD ]; then
then
rm -rf $BUILD rm -rf $BUILD
fi fi
@ -237,8 +224,7 @@ meson setup --prefix="$INSTALL" -Doptimization=3 -Db_lto=true -Db_pie=true -Dc_a
-Dlibdir=lib openh264 $SRC/openh264 -Dlibdir=lib openh264 $SRC/openh264
ninja -C openh264 install ninja -C openh264 install
for ARCH in $DEPLOYMENT_ARCH; for ARCH in $DEPLOYMENT_ARCH; do
do
mkdir -p $BUILD/FFmpeg/$ARCH mkdir -p $BUILD/FFmpeg/$ARCH
cd $BUILD/FFmpeg/$ARCH cd $BUILD/FFmpeg/$ARCH
FFCFLAGS="-arch $ARCH -mmacosx-version-min=$DEPLOYMENT_TARGET" FFCFLAGS="-arch $ARCH -mmacosx-version-min=$DEPLOYMENT_TARGET"
@ -259,8 +245,7 @@ find lib -type l -exec cp -P {} $INSTALL/lib/ \;
BASE_LIBS=$(find lib -type f -name "*.dylib" -exec basename {} \;) BASE_LIBS=$(find lib -type f -name "*.dylib" -exec basename {} \;)
cd $BUILD/FFmpeg/install cd $BUILD/FFmpeg/install
for LIB in $BASE_LIBS; for LIB in $BASE_LIBS; do
do
LIBS=$(find . -name $LIB) LIBS=$(find . -name $LIB)
lipo $LIBS -output $INSTALL/lib/$LIB -create lipo $LIBS -output $INSTALL/lib/$LIB -create
done done
@ -301,13 +286,11 @@ mv lib $LIBDIR
mv bin $BINDIR mv bin $BINDIR
# update RPATH # update RPATH
for LIB in $(find $LIBDIR -type f -name "*.dylib"); for LIB in $(find $LIBDIR -type f -name "*.dylib"); do
do
replace_rpath $LIB replace_rpath $LIB
done done
for BIN in $(find $BINDIR -type f); for BIN in $(find $BINDIR -type f); do
do
replace_rpath $BIN replace_rpath $BIN
done done

View File

@ -6,10 +6,8 @@ SRC_PATH="${SCRIPT_PATH}/.."
FORMAT_ARG="--check" FORMAT_ARG="--check"
REST_ARGS=$@ REST_ARGS=$@
if [ $# -ne 0 ] if [ $# -ne 0 ]; then
then if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
if [ "$1" = "--help" ] || [ "$1" = "-h" ];
then
echo "usage: $0 [options] [file, file, ...]" echo "usage: $0 [options] [file, file, ...]"
echo "\t--check.-c ... run format check only, no files changed (default)" echo "\t--check.-c ... run format check only, no files changed (default)"
echo "\t--format,-f ... format files in place" echo "\t--format,-f ... format files in place"
@ -18,26 +16,22 @@ then
exit 1 exit 1
fi fi
if [ "$1" = "--check" ] || [ "$1" = "-c" ]; if [ "$1" = "--check" ] || [ "$1" = "-c" ]; then
then
FORMAT_ARG="--check" FORMAT_ARG="--check"
REST_ARGS="${@:2}" REST_ARGS="${@:2}"
fi fi
if [ "$1" = "--format" ] || [ "$1" = "-f" ]; if [ "$1" = "--format" ] || [ "$1" = "-f" ]; then
then
FORMAT_ARG="-i" FORMAT_ARG="-i"
REST_ARGS="${@:2}" REST_ARGS="${@:2}"
fi fi
fi fi
if [ ! -n "$REST_ARGS" ]; if [ ! -n "$REST_ARGS" ]; then
then
CMAKE_FILES=$(find ${SRC_PATH} -name "*.cmake" -o -name "CMakeLists.txt") CMAKE_FILES=$(find ${SRC_PATH} -name "*.cmake" -o -name "CMakeLists.txt")
CMAKE_CI_FILES=$(find ${SRC_PATH}/ci -name "*.txt") CMAKE_CI_FILES=$(find ${SRC_PATH}/ci -name "*.txt")
fi fi
for FILE in $CMAKE_FILES $CMAKE_CI_FILES $REST_ARGS; for FILE in $CMAKE_FILES $CMAKE_CI_FILES $REST_ARGS; do
do
echo "processing file $FILE..." echo "processing file $FILE..."
cmake-format -c "$SCRIPT_PATH/cmake-format.yml" $FORMAT_ARG $FILE cmake-format -c "$SCRIPT_PATH/cmake-format.yml" $FORMAT_ARG $FILE
done done

View File

@ -3,33 +3,34 @@
function run { function run {
"$@" "$@"
RES=$? RES=$?
if [[ $RES -ne 0 ]]; if [[ $RES -ne 0 ]]; then
then
echo "[ERROR] $@ returned $RES" >&2 echo "[ERROR] $@ returned $RES" >&2
exit 1 exit 1
fi fi
} }
if [ -z ${TAG:-} ];then if [ -z ${TAG:-} ]; then
echo "No TAG set - trying to detect" echo "No TAG set - trying to detect"
TAG=$(git describe --tags) TAG=$(git describe --tags)
echo "Is the TAG ${TAG} ok (YES|NO)?" echo "Is the TAG ${TAG} ok (YES|NO)?"
read answ read answ
case "$answ" in case "$answ" in
YES): YES)
:
;; ;;
*) *)
echo 'stopping here' echo 'stopping here'
exit 1 exit 1
;;
esac esac
fi fi
function create_hash { function create_hash {
NAME=$1 NAME=$1
run md5sum ${NAME} > ${NAME}.md5 run md5sum ${NAME} >${NAME}.md5
run sha1sum ${NAME} > ${NAME}.sha1 run sha1sum ${NAME} >${NAME}.sha1
run sha256sum ${NAME} > ${NAME}.sha256 run sha256sum ${NAME} >${NAME}.sha256
run sha512sum ${NAME} > ${NAME}.sha512 run sha512sum ${NAME} >${NAME}.sha512
} }
function create_tar { function create_tar {
@ -46,7 +47,7 @@ TMPDIR=$(mktemp -d -t release-${TAG}-XXXXXXXXXX)
run git archive --prefix=freerdp-${TAG}/ --format=tar.gz -o ${TMPDIR}/freerdp-${TAG}.tar.gz ${TAG} run git archive --prefix=freerdp-${TAG}/ --format=tar.gz -o ${TMPDIR}/freerdp-${TAG}.tar.gz ${TAG}
run tar xzvf ${TMPDIR}/freerdp-${TAG}.tar.gz -C ${TMPDIR} run tar xzvf ${TMPDIR}/freerdp-${TAG}.tar.gz -C ${TMPDIR}
run echo ${TAG} > ${TMPDIR}/freerdp-${TAG}/.source_version run echo ${TAG} >${TMPDIR}/freerdp-${TAG}/.source_version
pushd . pushd .
cd $TMPDIR cd $TMPDIR
@ -60,8 +61,7 @@ create_hash ${ZIPNAME}
popd popd
# Sign the release tarballs # Sign the release tarballs
for EXT in tar.gz tar.bz2 tar.xz zip; for EXT in tar.gz tar.bz2 tar.xz zip; do
do
run gpg --local-user 0xA49454A3FC909FD5 --sign --armor --output ${TMPDIR}/freerdp-${TAG}.${EXT}.asc --detach-sig ${TMPDIR}/freerdp-${TAG}.${EXT} run gpg --local-user 0xA49454A3FC909FD5 --sign --armor --output ${TMPDIR}/freerdp-${TAG}.${EXT}.asc --detach-sig ${TMPDIR}/freerdp-${TAG}.${EXT}
done done
@ -70,8 +70,7 @@ run mv ${TMPDIR}/freerdp-${TAG}.zip* .
run rm -rf ${TMPDIR} run rm -rf ${TMPDIR}
# Verify the release tarball signatures # Verify the release tarball signatures
for EXT in tar.gz tar.bz2 tar.xz zip; for EXT in tar.gz tar.bz2 tar.xz zip; do
do
run gpg --verify freerdp-${TAG}.${EXT}.asc run gpg --verify freerdp-${TAG}.${EXT}.asc
done done

View File

@ -28,43 +28,43 @@ popd
# Check for errors; otherwise, ask for compile. # Check for errors; otherwise, ask for compile.
if [ "$?" -ne 0 ]; then if [ "$?" -ne 0 ]; then
echo "CMake failed. Please check error messages" echo "CMake failed. Please check error messages"
popd > /dev/null popd >/dev/null
exit exit
else else
popd popd
while true while true; do
do
echo -n "Compile FreeRDP? (y or n) - (y recommended for MacFreeRDP compilation):" echo -n "Compile FreeRDP? (y or n) - (y recommended for MacFreeRDP compilation):"
read CONFIRM read CONFIRM
case $CONFIRM in case $CONFIRM in
y|Y|YES|yes|Yes) y | Y | YES | yes | Yes)
pushd ./${XCODE_PROJ_DIR} pushd ./${XCODE_PROJ_DIR}
xcodebuild xcodebuild
popd popd
break ;; break
n|N|no|NO|No) ;;
n | N | no | NO | No)
echo OK - you entered $CONFIRM echo OK - you entered $CONFIRM
break break
;; ;;
*) echo Please enter only y or n *) echo Please enter only y or n ;;
esac esac
done done
echo "SUCCESS!" echo "SUCCESS!"
while true while true; do
do
echo -n "Open Xcode projects now? (y or n):" echo -n "Open Xcode projects now? (y or n):"
read CONFIRM read CONFIRM
case $CONFIRM in case $CONFIRM in
y|Y|YES|yes|Yes) y | Y | YES | yes | Yes)
open ${CLIENT_MAC_DIR}/${XCODE_PROJ_DIR}/MacFreeRDP.xcodeproj open ${CLIENT_MAC_DIR}/${XCODE_PROJ_DIR}/MacFreeRDP.xcodeproj
open ./${XCODE_PROJ_DIR}/FreeRDP.xcodeproj open ./${XCODE_PROJ_DIR}/FreeRDP.xcodeproj
break ;; break
n|N|no|NO|No) ;;
n | N | no | NO | No)
echo OK - $CONFIRM echo OK - $CONFIRM
break break
;; ;;
*) echo Please enter only y or n *) echo Please enter only y or n ;;
esac esac
done done