Skip to content
Extraits de code Groupes Projets
Vérifiée Valider c897784b rédigé par Kubat's avatar Kubat
Parcourir les fichiers

MISC: Update dependencies dl

- Update depends.bash
- Compile dependencies with the depends.sh script
parent b97ab36d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!118Bug fixes & DL dependencies when specified
curl sqlite3 https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release sqlite3.tar.gz
wget sdl2 https://www.libsdl.org/release/SDL2-2.0.12.tar.gz sdl2.tar.gz
sqlite3 configure --disable-shared --disable-tcl
sdl2 configure --disable-shared --enable-fcitx
#!/bin/bash
DEPENDS_FILE=depends/depends.txt
RULES_FILE=depends/rules.txt
BUILD_DIR="$1"
ROOT_DIR="$PWD"
NPROC=`getconf _NPROCESSORS_ONLN`
ABS_BUILD_DIR=`realpath $BUILD_DIR`
function die ()
{
echo "ERROR: $*"
exit 1
}
function curl ()
{
$CURL $1 --output $2 2>/dev/null >/dev/null
[ $? -ne 0 ] && die "Failed to download $1 and save it to $2"
}
function wget ()
{
$WGET $1 -O $2 2>/dev/null >/dev/null
[ $? -ne 0 ] && die "Failed to download $1"
}
function get ()
{
local NUM=$1
shift
echo $* | cut -d' ' -f$NUM -
}
function get_from ()
{
local NUM=$1
shift
echo $* | cut -d' ' -f$NUM- -
}
function untar ()
{
local OLD=`tar tf depends/$1 | cut -d'/' -f1 - | uniq`
(cd depends && $TAR xzf $1 --transform="s!^$OLD!$2!")
}
[ "x${BUILD_DIR}" = "x" ] && die "You must specify the lektor's build folder as the first argument"
echo "Lektor's build file is $BUILD_DIR"
CURL=`which curl 2>/dev/null`
[ $? -ne 0 ] && die "Failed to find the curl binary"
WGET=`which wget 2>/dev/null`
[ $? -ne 0 ] && die "Failed to find the wget binary"
TAR=`which tar 2>/dev/null`
[ $? -ne 0 ] && die "Failed to find the tar binary"
! [ -f $DEPENDS_FILE ] && die "You must run this script from the root of the project"
! [ -f $PWD/scripts/depends.bash ] && die "You must run thus script from the root of the project"
! [ -d $BUILD_DIR/depends_install ] && mkdir $BUILD_DIR/depends_install
! [ -d $BUILD_DIR/depends_install ] && die "Failed to create depends install folder"
#########################
# Download dependencies #
#########################
! [ -d depends ] && mkdir depends
while read LINE
do
FUNC=`get 1 $LINE`
FOLD=`get 2 $LINE`
URL=`get 3 $LINE`
TAR_FILE=`get 4 $LINE`
if [ -f depends/$TAR_FILE ]
then
echo "Dependency $FOLD is already downloaded," \
"remove depends/$TAR_FILE and depends/$FOLD to re-download it"
continue
fi
echo "Downloading $FOLD from $URL to depends/$TAR_FILE"
case $FUNC in
wget)
wget $URL depends/$TAR_FILE
;;
curl)
curl $URL depends/$TAR_FILE
;;
esac
done < $DEPENDS_FILE
##################################
# Extract dependencies and build #
##################################
while read LINE
do
FOLD=`get 2 $LINE`
FILE=`get 4 $LINE`
if [ -d depends/$FOLD ]
then
echo "Skip already extracted folder depends/$FOLD"
continue
fi
echo "Extract file depends/$FILE to depends/$FOLD"
untar $FILE $FOLD
done < $DEPENDS_FILE
while read LINE
do
FOLD=`get 1 $LINE`
TYPE=`get 2 $LINE`
OPT=`get_from 3 $LINE`
! [ -d $BUILD_DIR/depends/$FOLD ] && mkdir -p $BUILD_DIR/depends/$FOLD
! [ -d $BUILD_DIR/depends/$FOLD ] && die "Failed to create the build folder" \
"for $FOLD"
if [ -f $BUILD_DIR/depends/$FOLD/.lektor ]
then
echo "Skip already built folder $FOLD, if you want to rebuild it," \
"remove file $BUILD_DIR/depends/$FOLD/.lektor"
continue
fi
cd $BUILD_DIR/depends/$FOLD
$ROOT_DIR/depends/$FOLD/configure --prefix=$ABS_BUILD_DIR/depends_install CC=$CC CXX=$CXX $OPT
[ $? -ne 0 ] && die "Failed to configure $FOLD"
make -j$NPROC
[ $? -ne 0 ] && die "Failed to make $FOLD, build folder is $BUILD_DIR/depends/$FOLD"
make install
[ $? -ne 0 ] && die "Failed to install $FOLD, build folder is $BUILD_DIR/depends/$FOLD" \
", install folder is $ROOT_DIR/depends_install"
touch .lektor
cd $ROOT_DIR
echo "Finished to build $FOLD, result is in $BUILD_DIR/depends/$FOLD"
done < $RULES_FILE
# Use CC and CXX
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter