mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-13 20:16: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
157
BuildLinux.sh
157
BuildLinux.sh
@ -3,14 +3,28 @@
|
|||||||
export ROOT=`pwd`
|
export ROOT=`pwd`
|
||||||
export NCORES=`nproc --all`
|
export NCORES=`nproc --all`
|
||||||
|
|
||||||
while getopts ":ih" opt; do
|
|
||||||
|
while getopts ":dsiuh" opt; do
|
||||||
case ${opt} in
|
case ${opt} in
|
||||||
i )
|
u )
|
||||||
export BUILD_IMAGE="1"
|
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 " -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 " -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
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -22,33 +36,40 @@ then
|
|||||||
mkdir build
|
mkdir build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$UPDATE_LIB" ]]
|
||||||
if [[ -n "$BUILD_IMAGE" ]]
|
|
||||||
then
|
then
|
||||||
echo -n "Updating linux ..."
|
echo -n "Updating linux ..."
|
||||||
{
|
hwclock -s
|
||||||
hwclock -s
|
apt update
|
||||||
apt update
|
apt install libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev cmake git
|
||||||
apt install libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev
|
|
||||||
} > $ROOT/build/Build.log # Capture all command output
|
|
||||||
echo "done"
|
echo "done"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
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
|
# update submodule profiles
|
||||||
pushd resources/profiles
|
pushd resources/profiles
|
||||||
git submodule update --init
|
git submodule update --init
|
||||||
popd
|
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
|
# change date in version
|
||||||
sed "s/+UNKNOWN/_$(date '+%F')/" version.inc > version.date.inc
|
sed -i "s/+UNKNOWN/_$(date '+%F')/" version.inc
|
||||||
mv version.date.inc version.inc
|
}
|
||||||
} &> $ROOT/build/Build.log # Capture all command output
|
# &> $ROOT/build/Build.log # Capture all command output
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
# mkdir in deps
|
# mkdir in deps
|
||||||
@ -57,66 +78,76 @@ then
|
|||||||
mkdir deps/build
|
mkdir deps/build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "[3/9] Configuring dependencies..."
|
if [[ -n "$BUILD_DEPS" ]]
|
||||||
{
|
then
|
||||||
# cmake deps
|
echo "[3/9] Configuring dependencies..."
|
||||||
pushd deps/build
|
|
||||||
cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13"
|
|
||||||
} &> $ROOT/build/Build.log # Capture all command output
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo -n "[4/9] Building dependencies..."
|
# cmake deps
|
||||||
{
|
pushd deps/build
|
||||||
# make deps
|
cmake ..
|
||||||
make -j$NCORES
|
|
||||||
} &> $ROOT/build/Build.log # Capture all command output
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo -n "[5/9] Renaming wxscintilla library..."
|
# &> $ROOT/build/Build.log # Capture all command output
|
||||||
{
|
echo "done"
|
||||||
# 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..."
|
echo "[4/9] Building dependencies..."
|
||||||
{
|
|
||||||
# clean deps
|
|
||||||
rm -rf dep_*
|
|
||||||
popd
|
|
||||||
} &> $ROOT/build/Build.log # Capture all command output
|
|
||||||
echo "done"
|
|
||||||
|
|
||||||
echo -n "[7/9] Configuring Slic3r..."
|
# make deps
|
||||||
{
|
make -j$NCORES
|
||||||
# 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..."
|
# &> $ROOT/build/Build.log # Capture all command output
|
||||||
{
|
echo "done"
|
||||||
# make Slic3r
|
|
||||||
make -j$NCORES Slic3r
|
|
||||||
|
|
||||||
# make .mo
|
echo "[5/9] Renaming wxscintilla library..."
|
||||||
make gettext_po_to_mo
|
|
||||||
} &> $ROOT/build/Build.log # Capture all command output
|
# rename wxscintilla
|
||||||
echo "done"
|
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
|
||||||
|
|
||||||
|
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
|
# Give proper permissions to script
|
||||||
chmod 755 $ROOT/build/src/BuildLinuxImage.sh
|
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" ]]
|
if [[ -n "$BUILD_IMAGE" ]]
|
||||||
then
|
then
|
||||||
$ROOT/build/src/BuildLinuxImage.sh -i
|
$ROOT/build/src/BuildLinuxImage.sh -i
|
||||||
else
|
else
|
||||||
$ROOT/build/src/BuildLinuxImage.sh
|
$ROOT/build/src/BuildLinuxImage.sh
|
||||||
fi
|
fi
|
||||||
} &> $ROOT/build/Build.log # Capture all command output
|
# &> $ROOT/build/Build.log # Capture all command output
|
||||||
echo "done"
|
echo "done"
|
||||||
|
@ -16,14 +16,15 @@ while getopts ":ih" opt; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo -n "[9/9] Generating Linux app..."
|
echo -n "[9/9] Generating Linux app..."
|
||||||
{
|
#{
|
||||||
|
|
||||||
# create directory and copy into it
|
# create directory and copy into it
|
||||||
if [ -d "package" ]
|
if [ -d "package" ]
|
||||||
then
|
then
|
||||||
rm -rf package/*
|
rm -rf package/*
|
||||||
|
rm -rf package/.* 2&>/dev/null
|
||||||
|
else
|
||||||
|
mkdir package
|
||||||
fi
|
fi
|
||||||
mkdir package
|
|
||||||
mkdir package/bin
|
mkdir package/bin
|
||||||
|
|
||||||
# copy Resources
|
# copy Resources
|
||||||
@ -32,17 +33,23 @@ echo -n "[9/9] Generating Linux app..."
|
|||||||
|
|
||||||
# create bin
|
# 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@
|
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@
|
chmod ug+x @SLIC3R_APP_CMD@
|
||||||
tar -cvf ../@SLIC3R_APP_KEY@.tar .
|
cp -f @SLIC3R_APP_CMD@ package/@SLIC3R_APP_CMD@
|
||||||
} &> $ROOT/Build.log # Capture all command output
|
pushd package
|
||||||
|
tar -cvf ../@SLIC3R_APP_KEY@.tar . &>/dev/null
|
||||||
|
popd
|
||||||
|
#} &> $ROOT/Build.log # Capture all command output
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
if [[ -n "$BUILD_IMAGE" ]]
|
if [[ -n "$BUILD_IMAGE" ]]
|
||||||
then
|
then
|
||||||
echo -n "Creating Appimage for distribution..."
|
echo -n "Creating Appimage for distribution..."
|
||||||
{
|
#{
|
||||||
|
pushd package
|
||||||
chmod +x ../build_appimage.sh
|
chmod +x ../build_appimage.sh
|
||||||
../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"
|
echo "done"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user