Welcome to mirror list, hosted at ThFree Co, Russian Federation.

BuildLinux.sh - github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0107695d94e13e2d027dc01af654e338ed653e0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash

export ROOT=`pwd`
export NCORES=`nproc --all`


while getopts ":dsiuh" opt; do
  case ${opt} in
    u )
        UPDATE_LIB="1"
        ;;
    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
done

# mkdir build
if [ ! -d "build" ]
then
    mkdir build
fi

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 cmake git
    echo "done"
    exit 0
fi

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

echo "[2/9] Changing date in version..."
{
    # change date in version
    sed -i "s/+UNKNOWN/_$(date '+%F')/" version.inc
}
# &> $ROOT/build/Build.log # Capture all command output
echo "done"

# mkdir in deps
if [ ! -d "deps/build" ]
then
    mkdir deps/build
fi

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

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 "[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
echo "done"