Skip to content

Instantly share code, notes, and snippets.

@guysoft
Created April 5, 2019 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guysoft/6233e9911d6bd55e08e898732b29479a to your computer and use it in GitHub Desktop.
Save guysoft/6233e9911d6bd55e08e898732b29479a to your computer and use it in GitHub Desktop.
#!/bin/bash
sudo sed -i '/^CONF_SWAPSIZE.*/s//CONF_SWAPSIZE=1000/' /etc/dphys-swapfile
SLIC3R_REPO="https://github.com/alexrj/Slic3r.git"
SLIC3R_VERSION="master"
SLIC3R_DIR=/home/pi/Slic3r
sudo apt-get update
sudo apt-get install -y git libboost-all-dev libboost-geometry-utils-perl libboost-system-dev libboost-thread-dev git-core build-essential libgtk2.0-dev libwxgtk2.8-dev libwx-perl libmodule-build-perl libnet-dbus-perl cpanminus libextutils-cbuilder-perl gcc-4.7 g++-4.7 libwx-perl libperl-dev libextutils-cppguess-perl libeigen3-dev libglew-dev libglewmx-dev cpanminus
sudo apt install -y git libboost-all-dev libboost-geometry-utils-perl libboost-system-dev libboost-thread-dev git-core build-essential libwxgtk3.0-dev libgtk-3-dev libwx-perl libmodule-build-perl libnet-dbus-perl cpanminus gcc-4.7 g++-4.7 libwx-perl libperl-dev libextutils-cppguess-perl libeigen3-dev libglew-dev cpanminus libcurl4-openssl-dev
sudo cpan ExtUtils::CBuilder ExtUtils::CppGuess Alien::wxWidgets CPAN::Mini ExtUtils::XSpp::Cmd ExtUtils::Typemaps::Basic
if [ ! -z "${TBB_DIR}" ]; then
sudo rm -rf ${TBB_DIR}
fi
mkdir -p ${TBB_DIR}
cd ${TBB_DIR}
wget ${TBB_RELEASE}
tar xzvf $(basename ${TBB_RELEASE})
cd tbb*
make tbb CXXFLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0"
cd ${TBB_DIR}
mkdir libtbb-dev_${TBB_VERSION}_armhf
cd libtbb-dev_${TBB_VERSION}_armhf
mkdir -p usr/local/lib/pkgconfig
mkdir -p usr/local/include
mkdir DEBIAN
cd ${TBB_DIR}/libtbb-dev_${TBB_VERSION}_armhf/DEBIAN
cat > control << EOF
Package: libtbb-dev
Priority: extra
Section: universe/libdevel
Maintainer: ${YOUR_NAME} <${YOUR_EMAIL}>
Architecture: armhf
Version: ${TBB_VERSION}
Homepage: http://threadingbuildingblocks.org/
Description: parallelism library for C++ - development files
TBB is a library that helps you leverage multi-core processor
performance without having to be a threading expert. It represents a
higher-level, task-based parallelism that abstracts platform details
and threading mechanism for performance and scalability.
.
(Note: if you are a user of the i386 architecture, i.e., 32-bit Intel
or compatible hardware, this package only supports Pentium4-compatible
and higher processors.)
.
This package includes the TBB headers, libs and pkg-config
EOF
cd ${TBB_DIR}/libtbb-dev_${TBB_VERSION}_armhf/usr/local/lib
cp ${TBB_DIR}/tbb*/build/*_release/libtbb.so.2 .
ln -s libtbb.so.2 libtbb.so
cd ${TBB_DIR}/tbb*/include
cp -r serial tbb ${TBB_DIR}/libtbb-dev_${TBB_VERSION}_armhf/usr/local/include
cd ${TBB_DIR}/libtbb-dev_${TBB_VERSION}_armhf/usr/local/lib/pkgconfig
cat > tbb.pc << EOF
# Manually added pkg-config file for tbb - START
prefix=/usr/local
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
Name: tbb
Description: thread building block
Version: ${TBB_VERSION}
Cflags: -I\${includedir} -DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0
Libs: -L\${libdir} -ltbb
# Manually added pkg-config file for tbb - END
EOF
cd ${TBB_DIR}
sudo chown -R root:staff libtbb-dev_${TBB_VERSION}_armhf
sudo dpkg-deb --build libtbb-dev_${TBB_VERSION}_armhf
sudo dpkg -i ${TBB_DIR}/libtbb-dev_${TBB_VERSION}_armhf.deb
sudo ldconfig
sudo rm -rf ${SLIC3R_DIR}
git clone ${SLIC3R_REPO} ${SLIC3R_DIR}
cd ${SLIC3R_DIR}
git fetch ${SLIC3R_REPO}
git checkout ${SLIC3R_VERSION}
perl Build.PL --sudo
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
sudo make -j2
ctest --verbose
cd ..
./slic3r.pl --help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment