Skip to content

Instantly share code, notes, and snippets.

@shizonic
Forked from bhundven/nineteen-wayland.sh
Created May 16, 2016 21:00
Show Gist options
  • Save shizonic/9294471c6f82a299ec2ea67a7d72bd82 to your computer and use it in GitHub Desktop.
Save shizonic/9294471c6f82a299ec2ea67a7d72bd82 to your computer and use it in GitHub Desktop.
Enlightenment 19 build script for Ubuntu/Debian with Wayland support.
#!/bin/bash
# vi: ts=4:sw=4:et
#
# NINETEEN.SH
# This script allows you to install/update Enlightenment 19 git version on
# Ubuntu Wily/15.10 or Debian stretch/sid, or remove E19 git from your system.
# ********************************************************************
# * This version builds enlightenment with wayland. *
# * That means this requires a very recent Ubuntu or Debian version. *
# * This may not work properly! You've been warned! *
# ********************************************************************
# Originally from: http://ubuntuforums.org/showthread.php?t=2203190
# By: Philippe J. Guillaumie (batden AT sfr DOT fr).
# Tons of additional updates by: Bryan Hundven (bryanhundven AT gmail DOT com).
#
# Tip:
# Running Ubuntu? Get the Faenza icon set for your enlightened desktop before
# running the script for the first time!
# See http://www.noobslab.com/2013/10/faience-and-faenza-icons-for.html
#
# If you are using Debian, you can find Faience theme here:
# http://gnome-look.org/content/show.php/Faenza?content=128143
# and the Faenza theme here:
# http://gnome-look.org/content/show.php/New+Faience+icon+pack?content=157437
#
# To execute the script:
# 1. Open Terminal
# 2. Change to the download folder
# 3. Make the script executable with chmod +x
# 4. Run it with ./nineteen-wayland.sh
#
# Feel free to use this script as you see fit.
#set -x
set -e
set -u
# VARIABLES
bld="\e[1m" # Bold text.
bdr="\e[1;31m" # Bold red text.
bdg="\e[1;32m" # Bold green text.
bdy="\e[1;33m" # Bold yellow text.
off="\e[0m" # Turn off ansi colors.
msg_bold () {
printf "\n${bld}%s ${off}%s\n" "$@"
}
msg_red () {
printf "\n${bdr}%s ${off}%s\n" "$@"
}
msg_green () {
printf "\n${bdg}%s ${off}%s\n" "$@"
}
msg_yellow () {
printf "\n${bdy}%s ${off}%s\n" "$@"
}
trap '{ msg_red " KEYBOARD INTERRUPT."; exit 130; }' SIGHUP SIGINT SIGTERM
PREFIX="/usr/local"
export CPPFLAGS="-I/usr/local/include -I${PREFIX}/include"
export LDFLAGS="-L/usr/local/lib -L${PREFIX}/lib"
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:${PREFIX}/lib/pkgconfig"
export CC="ccache gcc"
export CXX="ccache g++"
# Normal optimization
export CFLAGS="-O3 -ffast-math -march=native"
# Fast, Debugging
#export CFLAGS="-O2 -ffast-math -march=native -g -ggdb3"
# Less optimization, Debugging
#export CFLAGS="-O -ffast-math -march=native -g -ggdb3"
export CXXFLAGS="${CFLAGS}"
NCPU=$(getconf _NPROCESSORS_ONLN)
NJOBS=$((NCPU+1))
export MAKE="make -j ${NJOBS}"
BUILD_DIR="${HOME}/Enlightenment19"
GEN="./autogen.sh --prefix=${PREFIX} --sysconfdir=/etc --localstatedir=/var"
RELEASE="$(lsb_release -sc)"
CODE="$(locale | grep 'LANG=' | cut -d= -f2 | cut -d_ -f1)"
DROPB="https://dl.dropboxusercontent.com/u/"
NO_NLS=0
DOCUDIR="$(test -f ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs && \
source ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs
echo ${XDG_DOCUMENTS_DIR:-$HOME})"
DEPS="
aspell-${CODE}
autoconf
automake
autopoint
bison
build-essential
ccache
check
cmake
connman
connman-dev
connman-vpn
doxygen
flex
freeglut3-dev
git
graphviz
graphviz-dev
ibus-wayland
imagemagick
libasound2-dev
libblkid-dev
libblkid-dev
libbullet-dev
libclang-dev
libdbus-1-dev
libffi-dev
libffi6-dbg
libfontconfig1-dev
libfreetype6-dev
libfribidi-dev
libgbm-dev
libgif-dev
libgles2-mesa-dev
libglib2.0-dev
libgstreamer-plugins-bad1.0-dev
libgstreamer-plugins-base1.0-dev
libgstreamer1.0-dev
libharfbuzz-dev
libibus-1.0-dev
libiconv-hook-dev
libinput-dev
libjpeg-dev
libluajit-5.1-dev
libmount-dev
libmtdev-dev
libopenjpeg-dev
libpam0g-dev
libpng12-dev
libpoppler-dev
libpulse-dev
libraw-dev
librsvg2-dev
libscim-dev
libsndfile1-dev
libspectre-dev
libssl-dev
libsystemd-dev
libtiff5-dev
libtool
libtool-bin
libtorrent-rasterbar-dev
libudev-dev
libudisks2-dev
libunibreak-dev
libv8-dev
libvlc-dev
libwayland-dev
libwayland-egl1-mesa
libwebp-dev
libxcb-keysyms1-dev
libxcb-shape0-dev
libxcomposite-dev
libxcursor-dev
libxine2-dev
libxinerama-dev
libxkbcommon-dev
libxrandr-dev
libxrender-dev
libxss-dev
libxtst-dev
mtdev-tools
pkg-config
python-dbus
python-dev
python-distutils-extra
python-xdg
ragel
valgrind
wmctrl
xwayland
"
TRIM="${DEPS:91}"
BASEURL="git://git.enlightenment.org"
#BASEURL="file:///home/bhundven/enlightenment"
declare -a PKGS
declare -a PKGS_REV
# Core packages
PKGS+=("core/efl")
PKGS+=("core/evas_generic_loaders")
PKGS+=("core/emotion_generic_players")
PKGS+=("core/elementary")
PKGS+=("bindings/elev8")
PKGS+=("bindings/python/python-efl")
PKGS+=("misc/polkit-efl")
PKGS+=("core/enlightenment")
# Apps
PKGS+=("apps/econnman")
PKGS+=("apps/ecrire")
PKGS+=("apps/ephoto")
PKGS+=("apps/epour")
PKGS+=("apps/equate")
PKGS+=("apps/eruler")
PKGS+=("apps/espionage")
PKGS+=("apps/express")
PKGS+=("apps/rage")
PKGS+=("apps/terminology")
# Developer Tools
PKGS+=("tools/clouseau")
PKGS+=("tools/edi")
PKGS+=("tools/eflete")
PKGS+=("tools/enventor")
#PKGS+=("tools/erigo")
for (( idx=${#PKGS[@]}-1; idx>=0; idx-- )); do
PKGS_REV+=("${PKGS[idx]}")
done
# Enable this option to force messages to display in English
# during the build process (bug reporting):
# export LC_ALL=C
# TESTS
msg_bold "SYSTEM REQUIREMENTS CHECK..."; sleep 1
if [[ $(dpkg -l | egrep 'e17|enlightenment' | egrep '^i' &>/dev/null ) ]]; then
msg_red " ANOTHER VERSION OF ENLIGHTENMENT IS INSTALLED."
msg_red " SCRIPT ABORTED."
exit 1
fi
if [ "${RELEASE}" = "wily" ]; then
msg_green "Ubuntu ${RELEASE}... OK"; sleep 1
elif [ "${RELEASE}" = "sid" -o "${RELEASE}" = "stretch" ]; then
msg_green "Debian ${RELEASE}... OK"; sleep 1
else
msg_red " UNSUPPORTED VERSION."
exit 1
fi
# FUNCTIONS
warn () {
msg="If you proceed with the installation,\n\
nearly 1.5 GB of additional disk space\n\
will be used.\n
Bear in mind that running other applications\n\
during the build process will affect\n\
compilation time."
if [ -n "${DISPLAY}" ]; then
zenity --no-wrap --info --text "${msg}"
sleep 1
else
msg_yellow "${msg}"
fi
}
should_we_disable_nls () {
if [ ${NO_NLS} -eq 1 ]; then
GEN=${GEN} --disable-nls
msg_green "Building with NLS disabled!"
else
msg_green "Building with NLS enabled!"
fi
}
bin_deps () {
sudo apt-get update && sudo apt-get dist-upgrade --yes
if [ ! -f "${DOCUDIR}/installed.txt" ]; then
dpkg --get-selections > "${DOCUDIR}/installed.txt"
sed -i '/linux-headers*/d' "${DOCUDIR}/installed.txt"
sed -i '/linux-image*/d' "${DOCUDIR}/installed.txt"
sed -i '/linux-generic*/d' "${DOCUDIR}/installed.txt"
sed -i '/linux-signed*/d' "${DOCUDIR}/installed.txt"
fi
sudo apt-get install --yes ${DEPS}
sleep 1
}
ls_ppa () {
local PPA="$(awk '$1 == "Package:" { print $2 }' \
/var/lib/apt/lists/*ppa*Packages)"
for i in $(echo ${PPA} | xargs -n1 | sort -u); do
dpkg-query -Wf'${db:Status-abbrev}' ${i} &>/dev/null
if [ $? -eq 0 ]; then
sed -i "/${i}/d" "${DOCUDIR}/installed.txt"
fi
done
}
build () {
local rebuild=${1}; shift
local skip_make=0
pushd "${BUILD_DIR}"
for pkg in "${PKGS[@]}"; do
msg_bold "Processing ${pkg}..."
should_we_disable_nls
pushd "${pkg}"
if [ ${rebuild} -eq 1 ]; then
if [ -f "Makefile" ]; then
make distclean &>/dev/null
echo
elif [ -f "setup.py" ]; then
python ./setup.py clean
fi
fi
msg_bold "Building ${pkg}..."
case "${pkg}" in
"core/efl")
${GEN} --enable-harfbuzz --enable-image-loader-webp \
--enable-multisense --enable-xine --enable-xinput22 \
--enable-drm --enable-egl --with-opengl=es \
--enable-systemd --enable-image-loader-jp2k \
--enable-wayland --enable-wayland-ivi-shell
;;
"core/enlightenment")
${GEN} --enable-mount-eeze --enable-wayland --enable-wayland-egl \
--enable-wl-desktop-shell --enable-wl-drm --enable-xwayland
;;
"bindings/python/python-efl")
sed -i -e \
"s#setup.py install#setup.py install --prefix=${PREFIX} --record installed_files.txt#" \
Makefile
;;
"misc/polkit-efl")
skip_make=1
python ./setup.py build
sudo python ./setup.py install --prefix="${PREFIX}" --record installed_files.txt
;;
"apps/ecrire")
cmake .
;;
"apps/epour")
skip_make=1
python ./setup.py build
sudo python ./setup.py install --prefix="${PREFIX}" --record installed_files.txt
;;
"apps/espionage")
skip_make=1
python ./setup.py build
sudo python ./setup.py install --prefix="${PREFIX}" --record installed_files.txt
;;
"tools/erigo")
cmake .
;;
*)
${GEN}
;;
esac
echo
if [ ${skip_make} -ne 1 ]; then
make
if [ $? -ne 0 ]; then
msg_red " BUILD ERROR—TRY AGAIN LATER."
# (Relaunch the script at a later time and select option #1)
rm -rf "${BUILD_DIR}/${pkg}"
exit 1
fi
sudo make install
else
skip_make=0
fi
sudo ldconfig
echo
popd # ${pkg}
done
popd # BUILD_DIR
}
remove () {
pkg="$1"
msg_bold "Cleaning ${pkg}..."
pushd "${pkg}"
if [ -f Makefile ]; then
if ! [ "${pkg}" = "bindings/python/python-efl" ]; then
sudo make uninstall &>/dev/null
else
make clean &>/dev/null
cat installed_files.txt | xargs sudo rm -rf
fi
echo
elif [ -f setup.py ]; then
if [ -f installed_files.txt ]; then
cat installed_files.txt | xargs sudo rm -rf
fi
python ./setup.py clean
fi
popd
}
deep_clean () {
msg_bold "Deeper cleaning..."; sleep 1
for i in \
"econnman/" \
"polkit-efl/" \
"python-efl/" \
"terminology/" \
"enlightenment/" \
"elementary/" \
"emotion_generic_players/" \
"evas_generic_loaders/" \
"terminology/" \
"efl/" \
"custom*"; \
do
sudo rm -rf "${BUILD_DIR}/${i}"
done
for i in \
"Enlightenment19/" \
".e/" \
".elementary/" \
".cache/efreet/" \
".cache/evas_gl_common_caches/" \
".config/terminology/"; \
do
sudo rm -rf "${HOME}/${i}"
done
for i in \
"enlightenment/"; \
do
sudo rm -rf "${PREFIX}/etc/${i}"
done
for i in \
"ecore*" \
"ector*" \
"edje*" \
"eet*" \
"eeze*" \
"efl*" \
"efreet*" \
"eina*" \
"eio*" \
"eldbus*" \
"elementary*" \
"embryo*" \
"emotion*" \
"enlightenment*" \
"eo*" \
"ephysics*" \
"ethumb*" \
"evas*"; \
do
sudo rm -rf "${PREFIX}/include/${i}"
done
for i in \
"ecore*" \
"edje*" \
"eeze*" \
"efl*" \
"efreet*" \
"elementary*" \
"emotion*" \
"enlightenment*" \
"eo*" \
"ephysics*" \
"ethumb*" \
"evas*"; \
do
sudo rm -rf "${PREFIX}/lib/${i}"
done
for i in \
"Ecore*" \
"Edje*" \
"Eet*" \
"Eeze*" \
"Efreet*" \
"Eina*" \
"Eldbus*" \
"Elementary*" \
"Eo*" \
"Ethumb*" \
"Evas*" \
"Emotion*"; \
do
sudo rm -rf "${PREFIX}/lib/cmake/${i}"
done
for i in \
"ecore*" \
"e_dbus*" \
"edje*" \
"efl*" \
"elementary*" \
"emotion*" \
"evas*" \
"python_efl*.egg-info" \
"polkit_efl*.egg-info"; \
do
sudo rm -rf "${PREFIX}/lib/python2.7/dist-packages/${i}"
done
for i in \
"dbus*" \
"ecore*" \
"edje*" \
"eeze*" \
"efreet*" \
"elementary*" \
"embryo*" \
"emotion*" \
"enlightenment*" \
"eo*" \
"ethumb*" \
"evas*" \
"terminology*" \
"econnman*"; \
do
sudo rm -rf "${PREFIX}/share/${i}"
done
for i in \
"connman*"; \
do
sudo rm -rf "${PREFIX}/var/lib/{$i}"
done
cd /usr/share/
sudo rm -rf xsessions/enlightenment.desktop
if [ -d "unity-greeter" ]; then
cd unity-greeter/
sudo rm custom_enlightenment_badge.png &>/dev/null
cd ..
fi
if [ -d "dbus-1/services" ]; then
cd dbus-1/services/
sudo rm -rf org.enlightenment.Efreet.service
sudo rm -rf org.enlightenment.Ethumb.service
cd ..
fi
echo
}
# SELECTION
INPUT=0
msg_bold "Please enter the number of your choice."
if [ $INPUT -lt 1 ]; then
msg_bold "1. Install Enlightenment 19."
msg_bold "2. Update my E19 installation."
msg_bold "3. Uninstall E19 programs only."
msg_bold "4. Uninstall E19 programs AND binary dependencies."
sleep 1
msg_bold "(Or press Ctrl-C to quit)"
read INPUT
fi
# INSTALLATION
if [ ${INPUT} -eq 1 ]; then
clear
msg_bold "Proceeding to install Enlightenment 19..."
#warn 2>/dev/null; sleep 1
if grep -q ppa /var/lib/apt/lists/*ppa* &>/dev/null; then
bin_deps
ls_ppa
else
unset -f ls_ppa
bin_deps
fi
cd "${HOME}"; mkdir -p "${BUILD_DIR}"; cd "${BUILD_DIR}"
msg_bold "Fetching git code..."
for pkg in "${PKGS[@]}"; do
if ! [ -d "${pkg}" ]; then
msg_bold "Cloning ${pkg}"
git clone "${BASEURL}/${pkg}.git" "${pkg}"
else
msg_bold "Updating ${pkg}"
pushd "${pkg}"
git clean -ffxd &>/dev/null
git checkout -- * &> /dev/null
git pull --all
popd
fi
done
read -p "Build internationalization support in Enlightenment? [y/n] " answer
case "${answer}" in
[yY])
: Nothing... NLS is built by default.
build 0
;;
[nN])
NO_NLS=1
build 0
;;
*)
msg_yellow "Please answer y or n"
;;
esac
sudo ln -sf \
${PREFIX}/share/dbus-1/services/org.enlightenment.Ethumb.service \
/usr/share/dbus-1/services/org.enlightenment.Ethumb.service
sudo ln -sf \
${PREFIX}/share/dbus-1/services/org.enlightenment.Efreet.service \
/usr/share/dbus-1/services/org.enlightenment.Efreet.service
cd "${BUILD_DIR}"
wget "${DROPB}/58695863/custom_enlightenment_badge.png" &>/dev/null
sudo cp -f custom_enlightenment_badge.png /usr/share/unity-greeter
sudo ln -sf "${PREFIX}/share/xsessions/enlightenment.desktop" \
/usr/share/xsessions/enlightenment.desktop
sudo ldconfig
printf "\n%s\n\n" " That's All Folks..."
# UPDATE
elif [ ${INPUT} -eq 2 ]; then
clear
msg_bold "Proceeding to update Enlightenment 19..."
sleep 1
msg_bold "Checking required Ubuntu/Debian packages..."
sudo apt-get install --yes ${DEPS}
sleep 1
echo
read -p "Build internationalization support in Enlightenment? [y/n] " answer
case "${answer}" in
[yY])
# Rebuild
build 1; echo
;;
[nN])
# Rebuild without NLS
NO_NLS=1
build 1; echo
;;
*)
msg_yellow "Please answer y or n"
;;
esac
sudo ln -sf \
"${PREFIX}/share/dbus-1/services/org.enlightenment.Ethumb.service" \
/usr/share/dbus-1/services/org.enlightenment.Ethumb.service
sudo ln -sf \
"${PREFIX}/share/dbus-1/services/org.enlightenment.Efreet.service" \
/usr/share/dbus-1/services/org.enlightenment.Efreet.service
cd "${BUILD_DIR}"
wget -nc "$DROPB/58695863/custom_enlightenment_badge.png" &>/dev/null
sudo cp -f custom_enlightenment_badge.png /usr/share/unity-greeter
sudo ln -sf "${PREFIX}/share/xsessions/enlightenment.desktop" \
/usr/share/xsessions/enlightenment.desktop
sudo ldconfig
printf "\n%s\n\n" " That's All Folks..."
# UNINSTALL E19
elif [ ${INPUT} -eq 3 ]; then
clear
msg_bold "Proceeding to uninstall Enlightenment 19..."
sleep 1
pushd "${BUILD_DIR}"
for i in "${PKGS_REV[@]}"; do
msg_bold "Processing ${i}..."
remove "${i}"
done
popd
deep_clean
printf "%s\n\n" " That's All Folks..."
# COMPLETE UNINSTALL
elif [ ${INPUT} -eq 4 ]; then
clear
msg_bold "Complete uninstallation of E19 and deps..."
sleep 1
pushd "${BUILD_DIR}"
for i in "${PKGS_REV[@]}"; do
msg_bold "Processing ${i}..."
remove "${i}"
done
popd
deep_clean
msg_bold "Removing binary dependencies..."
sudo apt-get autoremove ${TRIM}
sleep 1
sudo dpkg --set-selections < "${DOCUDIR}/installed.txt"
sudo apt-get dselect-upgrade
sudo apt-get update
sudo apt-get dist-upgrade
rm "${DOCUDIR}/installed.txt" &>/dev/null
sudo updatedb
sudo apt-get autoremove --purge
sudo dpkg --purge $(COLUMNS=200 dpkg -l | grep '^rc' | tr -s ' ' | \
cut -d ' ' -f 2) &>/dev/null
printf "\n%s\n\n" " That's All Folks..."
printf "\n%s\n\n" " If you want, you should delete your ~/.ccache to save space."
else
echo; exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment