mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-12 17:19:01 +08:00
Refine & fix BuildLinux script for fresh ubuntu 20.04
now you have to use an optino to compile, more info on -h
This commit is contained in:
parent
aa1abc251a
commit
f88f224452
167
BuildLinux.sh
167
BuildLinux.sh
@ -3,14 +3,28 @@
|
||||
export ROOT=`pwd`
|
||||
export NCORES=`nproc --all`
|
||||
|
||||
while getopts ":ih" opt; do
|
||||
|
||||
while getopts ":dsiuh" opt; do
|
||||
case ${opt} in
|
||||
i )
|
||||
export BUILD_IMAGE="1"
|
||||
u )
|
||||
UPDATE_LIB="1"
|
||||
;;
|
||||
h ) echo "Usage: ./BuildLinux.sh [-i][-u]"
|
||||
i )
|
||||
BUILD_IMAGE="1"
|
||||
;;
|
||||
d )
|
||||
BUILD_DEPS="1"
|
||||
;;
|
||||
s )
|
||||
BUILD_SLIC3R="1"
|
||||
;;
|
||||
h ) echo "Usage: ./BuildLinux.sh [-i][-u][-d][-s]"
|
||||
echo " -i: Generate appimage (optional)"
|
||||
echo " -d: build deps (optional)"
|
||||
echo " -s: build slic3r (optional)"
|
||||
echo " -u: only update clock & dependency packets (optional and need sudo)"
|
||||
echo "For a first use, you want to 'sudo ./BuildLinux.sh -u'"
|
||||
echo " and then './BuildLinux.sh -dsi'"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
@ -22,33 +36,40 @@ then
|
||||
mkdir build
|
||||
fi
|
||||
|
||||
|
||||
if [[ -n "$BUILD_IMAGE" ]]
|
||||
if [[ -n "$UPDATE_LIB" ]]
|
||||
then
|
||||
echo -n "Updating linux ..."
|
||||
{
|
||||
hwclock -s
|
||||
apt update
|
||||
apt install libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev
|
||||
} > $ROOT/build/Build.log # Capture all command output
|
||||
hwclock -s
|
||||
apt update
|
||||
apt install libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev cmake git
|
||||
echo "done"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -n "[1/9] Updating submodules..."
|
||||
FOUND_GTK2=$(dpkg -l libgtk* | grep gtk2.0-dev)
|
||||
echo "FOUND_GTK2=$FOUND_GTK2)"
|
||||
if [[ -z "$FOUND_GTK2" ]]
|
||||
then
|
||||
echo "Error, you must install the dependencies before."
|
||||
echo "Use option -u with sudo"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "[1/9] Updating submodules..."
|
||||
{
|
||||
# update submodule profiles
|
||||
pushd resources/profiles
|
||||
git submodule update --init
|
||||
popd
|
||||
} > $ROOT/build/Build.log # Capture all command output
|
||||
}
|
||||
# > $ROOT/build/Build.log # Capture all command output
|
||||
|
||||
echo -n "[2/9] Changing date in version..."
|
||||
echo "[2/9] Changing date in version..."
|
||||
{
|
||||
# change date in version
|
||||
sed "s/+UNKNOWN/_$(date '+%F')/" version.inc > version.date.inc
|
||||
mv version.date.inc version.inc
|
||||
} &> $ROOT/build/Build.log # Capture all command output
|
||||
sed -i "s/+UNKNOWN/_$(date '+%F')/" version.inc
|
||||
}
|
||||
# &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
||||
# mkdir in deps
|
||||
@ -57,66 +78,76 @@ then
|
||||
mkdir deps/build
|
||||
fi
|
||||
|
||||
echo -n "[3/9] Configuring dependencies..."
|
||||
{
|
||||
# cmake deps
|
||||
pushd deps/build
|
||||
cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13"
|
||||
} &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
if [[ -n "$BUILD_DEPS" ]]
|
||||
then
|
||||
echo "[3/9] Configuring dependencies..."
|
||||
|
||||
# cmake deps
|
||||
pushd deps/build
|
||||
cmake ..
|
||||
|
||||
# &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
||||
echo "[4/9] Building dependencies..."
|
||||
|
||||
# make deps
|
||||
make -j$NCORES
|
||||
|
||||
# &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
||||
echo "[5/9] Renaming wxscintilla library..."
|
||||
|
||||
# rename wxscintilla
|
||||
pushd destdir/usr/local/lib
|
||||
cp libwxscintilla-3.1.a libwx_gtk2u_scintilla-3.1.a
|
||||
popd
|
||||
# &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
||||
echo "[6/9] Cleaning dependencies..."
|
||||
|
||||
# clean deps
|
||||
rm -rf dep_*
|
||||
popd
|
||||
# &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
fi
|
||||
|
||||
echo -n "[4/9] Building dependencies..."
|
||||
{
|
||||
# make deps
|
||||
make -j$NCORES
|
||||
} &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
||||
echo -n "[5/9] Renaming wxscintilla library..."
|
||||
{
|
||||
# rename wxscintilla
|
||||
pushd destdir/usr/local/lib
|
||||
cp libwxscintilla-3.1.a libwx_gtk2u_scintilla-3.1.a
|
||||
popd
|
||||
} &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
||||
echo -n "[6/9] Cleaning dependencies..."
|
||||
{
|
||||
# clean deps
|
||||
rm -rf dep_*
|
||||
popd
|
||||
} &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
||||
echo -n "[7/9] Configuring Slic3r..."
|
||||
{
|
||||
# cmake
|
||||
pushd build
|
||||
cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" -DSLIC3R_STATIC=1
|
||||
} &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
||||
echo -n "[8/9] Building Slic3r..."
|
||||
{
|
||||
# make Slic3r
|
||||
make -j$NCORES Slic3r
|
||||
|
||||
# make .mo
|
||||
make gettext_po_to_mo
|
||||
} &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
if [[ -n "$BUILD_SLIC3R" ]]
|
||||
then
|
||||
echo "[7/9] Configuring Slic3r..."
|
||||
|
||||
# cmake
|
||||
pushd build
|
||||
cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DSLIC3R_STATIC=1
|
||||
# &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
||||
echo "[8/9] Building Slic3r..."
|
||||
|
||||
# make Slic3r
|
||||
make -j$NCORES Slic3r
|
||||
|
||||
# make .mo
|
||||
make gettext_po_to_mo
|
||||
|
||||
popd
|
||||
# &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
fi
|
||||
|
||||
# Give proper permissions to script
|
||||
chmod 755 $ROOT/build/src/BuildLinuxImage.sh
|
||||
|
||||
echo -n "[9/9] Generating Linux app..."
|
||||
{
|
||||
echo "[9/9] Generating Linux app..."
|
||||
pushd build
|
||||
if [[ -n "$BUILD_IMAGE" ]]
|
||||
then
|
||||
$ROOT/build/src/BuildLinuxImage.sh -i
|
||||
else
|
||||
$ROOT/build/src/BuildLinuxImage.sh
|
||||
fi
|
||||
} &> $ROOT/build/Build.log # Capture all command output
|
||||
# &> $ROOT/build/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
@ -16,14 +16,15 @@ while getopts ":ih" opt; do
|
||||
done
|
||||
|
||||
echo -n "[9/9] Generating Linux app..."
|
||||
{
|
||||
|
||||
#{
|
||||
# create directory and copy into it
|
||||
if [ -d "package" ]
|
||||
then
|
||||
rm -rf package/*
|
||||
rm -rf package/.* 2&>/dev/null
|
||||
else
|
||||
mkdir package
|
||||
fi
|
||||
mkdir package
|
||||
mkdir package/bin
|
||||
|
||||
# copy Resources
|
||||
@ -32,17 +33,23 @@ echo -n "[9/9] Generating Linux app..."
|
||||
|
||||
# create bin
|
||||
echo -e '#!/bin/bash\nDIR=$(readlink -f "$0" | xargs dirname)\nexport LD_LIBRARY_PATH="$DIR/bin"\nexec "$DIR/bin/@SLIC3R_APP_CMD@" "$@"' >@SLIC3R_APP_CMD@
|
||||
chmod u+x @SLIC3R_APP_CMD@
|
||||
tar -cvf ../@SLIC3R_APP_KEY@.tar .
|
||||
} &> $ROOT/Build.log # Capture all command output
|
||||
chmod ug+x @SLIC3R_APP_CMD@
|
||||
cp -f @SLIC3R_APP_CMD@ package/@SLIC3R_APP_CMD@
|
||||
pushd package
|
||||
tar -cvf ../@SLIC3R_APP_KEY@.tar . &>/dev/null
|
||||
popd
|
||||
#} &> $ROOT/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
||||
if [[ -n "$BUILD_IMAGE" ]]
|
||||
then
|
||||
echo -n "Creating Appimage for distribution..."
|
||||
{
|
||||
#{
|
||||
pushd package
|
||||
chmod +x ../build_appimage.sh
|
||||
../build_appimage.sh
|
||||
} &> $ROOT/Build.log # Capture all command output
|
||||
popd
|
||||
mv package/"@SLIC3R_APP_KEY@_ubu64.AppImage" "@SLIC3R_APP_KEY@_ubu64.AppImage"
|
||||
#} &> $ROOT/Build.log # Capture all command output
|
||||
echo "done"
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user