Skip to content

Commit

Permalink
optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
leleliu008 committed Oct 22, 2024
1 parent 14e9131 commit 340533e
Showing 1 changed file with 32 additions and 50 deletions.
82 changes: 32 additions & 50 deletions xcpkg
Original file line number Diff line number Diff line change
Expand Up @@ -1406,8 +1406,8 @@ filetype_from_url() {
[ -n "$PACKAGE_DEP_PYM" ] && PACKAGE_DEP_UPP="$PACKAGE_DEP_UPP python3"
[ -n "$PACKAGE_DEP_PLM" ] && PACKAGE_DEP_UPP="$PACKAGE_DEP_UPP perl gmake"

[ "$PACKAGE_USE_BSYSTEM_AUTOGENSH" = 1 ] && PACKAGE_DEP_UPP="$PACKAGE_DEP_UPP gmake gm4 perl autoconf automake"
[ "$PACKAGE_USE_BSYSTEM_AUTOTOOLS" = 1 ] && PACKAGE_DEP_UPP="$PACKAGE_DEP_UPP gmake gm4 perl autoconf automake"
[ "$PACKAGE_USE_BSYSTEM_AUTOGENSH" = 1 ] && PACKAGE_DEP_UPP="$PACKAGE_DEP_UPP gmake autotools"
[ "$PACKAGE_USE_BSYSTEM_AUTOTOOLS" = 1 ] && PACKAGE_DEP_UPP="$PACKAGE_DEP_UPP gmake autotools"
[ "$PACKAGE_USE_BSYSTEM_CONFIGURE" = 1 ] && PACKAGE_DEP_UPP="$PACKAGE_DEP_UPP gmake"
[ "$PACKAGE_USE_BSYSTEM_MESON" = 1 ] && PACKAGE_DEP_UPP="$PACKAGE_DEP_UPP python3"
[ "$PACKAGE_USE_BSYSTEM_MESON" = 1 ] && PACKAGE_DEP_PYM="$PACKAGE_DEP_PYM meson"
Expand Down Expand Up @@ -3564,25 +3564,15 @@ $DOT_CONTENT
# these native packages would be installed by uppm
PACKAGE_DEP_UPP_T1='pkg-config tree'

# these native packages are not relocatable, we should build them from source locally at build time.
# these native packages are not relocatable and would be fetched to a fixed location /opt/non-relocatable-*
PACKAGE_DEP_UPP_T2=

for item in $PACKAGE_DEP_UPP
do
case $item in
ghc) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 gmake" ; PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
perl) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 gmake" ; PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
openssl) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 gmake" ; PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
texinfo) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 gmake" ; PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
help2man) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 gmake" ; PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
intltool) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 gmake cmake" ; PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
python3) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 gmake cmake" ; PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
ruby) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 gmake cmake" ; PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
swig) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 gmake cmake" ; PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
libtool) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 gmake gm4" ; PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
autoconf) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 gmake gm4" ; PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
automake) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 gmake gm4" ; PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
*) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 $item"
swig|ruby|python3|perl|autoconf|automake|autotools|libtool|texinfo|help2man|intltool)
PACKAGE_DEP_UPP_T2="$PACKAGE_DEP_UPP_T2 $item" ;;
*) PACKAGE_DEP_UPP_T1="$PACKAGE_DEP_UPP_T1 $item" ;;
esac
done

Expand Down Expand Up @@ -3640,35 +3630,22 @@ $DOT_CONTENT
done
}

[ -n "$PACKAGE_DEP_UPP_T2" ] && {
PACKAGE_DEP_UPP_T2="$(printf '%s\n' $PACKAGE_DEP_UPP_T2 | sort | uniq | tr '\n' ' ')"

run "$XBUILDER" install "$PACKAGE_DEP_UPP_T2" --prefix="$NATIVE_PACKAGE_INSTALLED_ROOT" --download-dir="$XCPKG_DOWNLOADS_DIR" --session-dir="$SESSION_DIR/native"

for NATIVE_PACKAGE_NAME in $PACKAGE_DEP_UPP_T2
do
NATIVE_PACKAGE_INSTALLED_DIR="$NATIVE_PACKAGE_INSTALLED_ROOT/$NATIVE_PACKAGE_NAME"

if [ -d "$NATIVE_PACKAGE_INSTALLED_DIR/include" ] ; then
CPPFLAGS_FOR_BUILD="$CPPFLAGS_FOR_BUILD -I$NATIVE_PACKAGE_INSTALLED_DIR/include"
fi
#########################################################################################

if [ -d "$NATIVE_PACKAGE_INSTALLED_DIR/lib" ] ; then
LDFLAGS_FOR_BUILD="$LDFLAGS_FOR_BUILD -L$NATIVE_PACKAGE_INSTALLED_DIR/lib -Wl,-rpath,$NATIVE_PACKAGE_INSTALLED_DIR/lib"
fi
[ -n "$PACKAGE_DEP_UPP_T2" ] && {
T="macos-${NATIVE_PLATFORM_VERS%%.*}.0-$NATIVE_PLATFORM_ARCH"

if [ -d "$NATIVE_PACKAGE_INSTALLED_DIR/bin" ] ; then
PATH="$NATIVE_PACKAGE_INSTALLED_DIR/bin:$PATH"
fi
NON_RELOCATEABLE_BINARY_PACKAGE_NAME="non-relocatable-binary-packages-2024.10.12-$T"
NON_RELOCATEABLE_BINARY_PACKAGE_INSTALL_DIR="/opt/$NON_RELOCATEABLE_BINARY_PACKAGE_NAME"

if [ -d "$NATIVE_PACKAGE_INSTALLED_DIR/sbin" ] ; then
PATH="$NATIVE_PACKAGE_INSTALLED_DIR/sbin:$PATH"
fi
if [ ! -f "$NON_RELOCATEABLE_BINARY_PACKAGE_INSTALL_DIR/ok" ] ; then
wfetch "https://github.com/leleliu008/non-relocatable-binary-packages/releases/download/2024.10.12/$NON_RELOCATEABLE_BINARY_PACKAGE_NAME.tar.xz"
run sudo install -d -g `id -g` -o `id -u` "$NON_RELOCATEABLE_BINARY_PACKAGE_INSTALL_DIR"
run bsdtar xPf "$NON_RELOCATEABLE_BINARY_PACKAGE_NAME.tar.xz"
run touch "$NON_RELOCATEABLE_BINARY_PACKAGE_INSTALL_DIR/ok"
fi

if [ -d "$NATIVE_PACKAGE_INSTALLED_DIR/share/aclocal" ] ; then
ACLOCAL_PATH="$NATIVE_PACKAGE_INSTALLED_DIR/share/aclocal:$ACLOCAL_PATH"
fi
done
export PATH="$NON_RELOCATEABLE_BINARY_PACKAGE_INSTALL_DIR/bin:$PATH"
}

#########################################################################################
Expand Down Expand Up @@ -3704,7 +3681,19 @@ $DOT_CONTENT
done

if [ -n "$PACKAGE_DEP_PLM_T1" ] ; then
run "$XBUILDER" install perl-XML-Parser --prefix="$NATIVE_PACKAGE_INSTALLED_ROOT" --download-dir="$XCPKG_DOWNLOADS_DIR" --session-dir="$SESSION_DIR/native"
T="macos-${NATIVE_PLATFORM_VERS%%.*}.0-$NATIVE_PLATFORM_ARCH"

NON_RELOCATEABLE_BINARY_PACKAGE_NAME="non-relocatable-binary-packages-2024.10.12-$T"
NON_RELOCATEABLE_BINARY_PACKAGE_INSTALL_DIR="/opt/$NON_RELOCATEABLE_BINARY_PACKAGE_NAME"

if [ ! -f "$NON_RELOCATEABLE_BINARY_PACKAGE_INSTALL_DIR/ok" ] ; then
wfetch "https://github.com/leleliu008/non-relocatable-binary-packages/releases/download/2024.10.12/$NON_RELOCATEABLE_BINARY_PACKAGE_NAME.tar.xz"
run sudo install -d -g `id -g` -o `id -u` "$NON_RELOCATEABLE_BINARY_PACKAGE_INSTALL_DIR"
run bsdtar xPf "$NON_RELOCATEABLE_BINARY_PACKAGE_NAME.tar.xz"
run touch "$NON_RELOCATEABLE_BINARY_PACKAGE_INSTALL_DIR/ok"
fi

export PATH="$NON_RELOCATEABLE_BINARY_PACKAGE_INSTALL_DIR/bin:$PATH"
fi

if [ -n "$PACKAGE_DEP_PLM_T2" ] ; then
Expand Down Expand Up @@ -7569,11 +7558,6 @@ __setup_uppm() {

##################################################################################

wfetch 'https://raw.githubusercontent.com/leleliu008/ppkg/master/xbuilder' --no-buffer
run chmod +x xbuilder

##################################################################################

wfetch 'https://raw.githubusercontent.com/leleliu008/xcpkg/master/xcpkg-core-latest-release-version' --no-buffer

##################################################################################
Expand Down Expand Up @@ -7990,7 +7974,7 @@ fi

##################################################################################

XCPKG_VERSION=0.23.0
XCPKG_VERSION=0.24.0

XCPKG_ARG0="$0"
XCPKG_ARG1="$1"
Expand Down Expand Up @@ -8021,8 +8005,6 @@ XCPKG_DOWNLOADS_DIR="$XCPKG_HOME/downloads"

XCPKG_CORE_DIR="$XCPKG_HOME/core"

XBUILDER="$XCPKG_CORE_DIR/xbuilder"

NATIVE_PACKAGE_INSTALLED_ROOT="$XCPKG_HOME/native"

##################################################################################
Expand Down

0 comments on commit 340533e

Please sign in to comment.