Skip to content

Commit

Permalink
Boring build stuff
Browse files Browse the repository at this point in the history
* Adapt docker stuff (Ubuntu) to changes in Friction
* Removed support for Ubuntu Lunar (EOL this month)
  • Loading branch information
rodlie committed Jan 17, 2024
1 parent 7fee40b commit 5a5f7b8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 132 deletions.
2 changes: 1 addition & 1 deletion src/scripts/Dockerfile.jammy
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:jammy
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update -y
RUN apt upgrade -y
RUN apt install -y curl build-essential clang git libtool autoconf automake cmake python3 python-is-python3 ninja-build libfontconfig1-dev libfreetype-dev libavcodec-dev libavformat-dev libavutil-dev libqscintilla2-qt5-dev libqt5opengl5-dev libqt5svg5-dev libswresample-dev libswscale-dev libunwind-dev qt5-image-formats-plugins libqt5multimedia5-plugins qtbase5-dev-tools qtbase5-dev qtdeclarative5-dev-tools qtdeclarative5-dev qtmultimedia5-dev qttools5-dev-tools libexpat1-dev libfreetype-dev libjpeg-turbo8-dev libpng-dev libwebp-dev zlib1g-dev libicu-dev libharfbuzz-dev
RUN apt install -y curl build-essential file clang git cmake python3 python-is-python3 ninja-build libfontconfig1-dev libfreetype-dev libavcodec-dev libavformat-dev libavutil-dev libqscintilla2-qt5-dev libqt5opengl5-dev libqt5svg5-dev libswresample-dev libswscale-dev libunwind-dev libqt5multimedia5-plugins qtbase5-dev-tools qtbase5-dev qtdeclarative5-dev-tools qtdeclarative5-dev qtmultimedia5-dev qttools5-dev-tools libexpat1-dev libfreetype-dev libjpeg-turbo8-dev libpng-dev libwebp-dev zlib1g-dev libicu-dev libharfbuzz-dev

COPY build_docker.sh /
CMD [ "bash", "./build_docker.sh" ]
9 changes: 0 additions & 9 deletions src/scripts/Dockerfile.lunar

This file was deleted.

2 changes: 1 addition & 1 deletion src/scripts/Dockerfile.mantic
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ubuntu:mantic
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update -y
RUN apt upgrade -y
RUN apt install -y curl build-essential clang git libtool autoconf automake cmake python3 python-is-python3 ninja-build libfontconfig1-dev libfreetype-dev libavcodec-dev libavformat-dev libavutil-dev libqscintilla2-qt5-dev libqt5opengl5-dev libqt5svg5-dev libswresample-dev libswscale-dev libunwind-dev qt5-image-formats-plugins libqt5multimedia5-plugins qtbase5-dev-tools qtbase5-dev qtdeclarative5-dev-tools qtdeclarative5-dev qtmultimedia5-dev qttools5-dev-tools libglx-mesa0 libglx-dev libxcb-glx0-dev libexpat1-dev libfreetype-dev libjpeg-turbo8-dev libpng-dev libwebp-dev zlib1g-dev libicu-dev libharfbuzz-dev
RUN apt install -y curl build-essential file clang git cmake python3 python-is-python3 ninja-build libfontconfig1-dev libfreetype-dev libavcodec-dev libavformat-dev libavutil-dev libqscintilla2-qt5-dev libqt5opengl5-dev libqt5svg5-dev libswresample-dev libswscale-dev libunwind-dev libqt5multimedia5-plugins qtbase5-dev-tools qtbase5-dev qtdeclarative5-dev-tools qtdeclarative5-dev qtmultimedia5-dev qttools5-dev-tools libglx-mesa0 libglx-dev libxcb-glx0-dev libexpat1-dev libfreetype-dev libjpeg-turbo8-dev libpng-dev libwebp-dev zlib1g-dev libicu-dev libharfbuzz-dev

COPY build_docker.sh /
CMD [ "bash", "./build_docker.sh" ]
96 changes: 7 additions & 89 deletions src/scripts/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,15 @@
# Deploy Friction on Ubuntu.

set -e -x
g++ --version
clang++ --version
cmake --version
python --version
qmake-qt5 --version || qmake --version
env
cat /etc/os-release

SNAP=${SNAP:-0}
REL=${REL:-0}
MKJOBS=${MKJOBS:-4}
CLANG=${CLANG:-1}

if [ "${REL}" = 0 ] && [ "${SNAP}" = 0 ]; then
echo "REL or SNAP?"
exit 1
fi

if [ "${REL}" = 1 ]; then
SNAP=0
elif [ "${SNAP}" = 1 ]; then
REL=0
fi

DISTRO_ID=`cat /etc/os-release | sed '/^ID=/!d;s/ID=//;s/"//g'`
if [ "${DISTRO_ID}" != "ubuntu" ]; then
Expand All @@ -59,7 +45,6 @@ FRICTION_DIR="${FRICTION_ROOT}/friction"
FRICTION_SRC_DIR="${FRICTION_DIR}/src"
FRICTION_OUT_DIR="/snapshots"

FRICTION_DIST="${FRICTION_OUT_DIR}/distfiles"
FRICTION_BRANCH=${FRICTION_BRANCH:-""}
FRICTION_COMMIT=${FRICTION_COMMIT:-""}
FRICTION_TAG=${FRICTION_TAG:-""}
Expand All @@ -75,29 +60,16 @@ elif [ "${FRICTION_TAG}" != "" ]; then
FRICTION_COMMIT=""
fi

GPERF_V="4df0b85"
SKIA_V="5ae542b872"

SF_NET_SRC="https://sourceforge.net/projects/friction/files/source"

COMPILER=""
if [ "${CLANG}" = 1 ]; then
#COMPILER="-clang"
export CC=clang
export CXX=clang++
fi
export CC=clang
export CXX=clang++

if [ ! -d "${FRICTION_ROOT}" ]; then
mkdir -p ${FRICTION_ROOT}
fi

if [ ! -d "${FRICTION_DIST}" ]; then
mkdir -p ${FRICTION_DIST}
fi

if [ ! -d "${FRICTION_SRC_DIR}" ]; then
cd ${FRICTION_ROOT}
git clone https://github.com/friction2d/friction
git clone --recurse-submodules https://github.com/friction2d/friction
if [ "${FRICTION_BRANCH}" != "" ]; then
(cd friction; git checkout ${FRICTION_BRANCH})
fi
Expand All @@ -107,57 +79,7 @@ if [ ! -d "${FRICTION_SRC_DIR}" ]; then
if [ "${FRICTION_TAG}" != "" ]; then
(cd friction; git checkout tags/${FRICTION_TAG})
fi
(cd friction; git submodule update -i docs)
fi

if [ ! -f "${FRICTION_SRC_DIR}/gperftools/.libs/libtcmalloc.a" ]; then
if [ ! -f "${FRICTION_DIST}/gperftools-${GPERF_V}.tar.xz" ]; then
curl -k -L "${SF_NET_SRC}/gperftools-${GPERF_V}.tar.xz/download" --output ${FRICTION_DIST}/gperftools-${GPERF_V}.tar.xz
fi
if [ -d "${FRICTION_SRC_DIR}/gperftools-${GPERF_V}" ]; then
rm -rf ${FRICTION_SRC_DIR}/gperftools-${GPERF_V}
fi
if [ -d "${FRICTION_SRC_DIR}/gperftools" ]; then
rm -rf ${FRICTION_SRC_DIR}/gperftools
fi
cd ${FRICTION_SRC_DIR}
tar xf ${FRICTION_DIST}/gperftools-${GPERF_V}.tar.xz
mv gperftools-${GPERF_V} gperftools
cd gperftools
if [ -f "${FRICTION_DIST}/gperftools-${GPERF_V}-build-${DID}${COMPILER}.tar.xz" ]; then
tar xf ${FRICTION_DIST}/gperftools-${GPERF_V}-build-${DID}${COMPILER}.tar.xz
else
./autogen.sh
./configure --disable-shared
make -j${MKJOBS}
tar cvvfJ ${FRICTION_DIST}/gperftools-${GPERF_V}-build-${DID}${COMPILER}.tar.xz .
fi
fi

if [ ! -f "${FRICTION_SRC_DIR}/skia/out/build/libskia.a" ]; then
if [ ! -f "${FRICTION_DIST}/skia-${SKIA_V}.tar.xz" ]; then
curl -k -L "${SF_NET_SRC}/skia-${SKIA_V}.tar.xz/download" --output ${FRICTION_DIST}/skia-${SKIA_V}.tar.xz
fi
if [ -d "${FRICTION_SRC_DIR}/skia-${SKIA_V}" ]; then
rm -rf ${FRICTION_SRC_DIR}/skia-${SKIA_V}
fi
if [ -d "${FRICTION_SRC_DIR}/skia" ]; then
rm -rf ${FRICTION_SRC_DIR}/skia
fi
cd ${FRICTION_SRC_DIR}
tar xf ${FRICTION_DIST}/skia-${SKIA_V}.tar.xz
mv skia-${SKIA_V} skia
cd skia
if [ -f "${FRICTION_DIST}/skia-${SKIA_V}-build-${DID}${COMPILER}.tar.xz" ]; then
tar xf ${FRICTION_DIST}/skia-${SKIA_V}-build-${DID}${COMPILER}.tar.xz
else
if [ ! -f "bin/gn" ]; then
(cd bin ; python3 fetch-gn)
fi
bin/gn gen out/build --args='is_official_build=true is_debug=false cc="clang" cxx="clang++" extra_cflags=["-Wno-error"] target_os="linux" target_cpu="x64" skia_use_system_expat=true skia_use_system_freetype2=true skia_use_system_libjpeg_turbo=true skia_use_system_libpng=true skia_use_system_libwebp=true skia_use_system_zlib=true skia_use_system_icu=true skia_use_system_harfbuzz=true skia_use_dng_sdk=false'
ninja -C out/build -j${MKJOBS} skia
tar cvvfJ ${FRICTION_DIST}/skia-${SKIA_V}-build-${DID}${COMPILER}.tar.xz out
fi
#(cd friction; git submodule update -i docs)
fi

cd ${FRICTION_DIR}
Expand All @@ -173,22 +95,18 @@ fi
mkdir build
cd build

CMAKE_EXTRA="-DUSE_SKIA_SYSTEM_LIBS=ON"
if [ "${CLANG}" = 1 ]; then
CMAKE_EXTRA="${CMAKE_EXTRA} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"
fi
CMAKE_EXTRA="-DCMAKE_BUILD_TYPE=Release -DUSE_SKIA_SYSTEM_LIBS=ON"
CMAKE_EXTRA="${CMAKE_EXTRA} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang"

if [ "${REL}" = 1 ]; then
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DFRICTION_OFFICIAL_RELEASE=ON \
${CMAKE_EXTRA} ..
VERSION=`cat version.txt`
else
cmake -G Ninja \
-DGIT_COMMIT=${COMMIT} \
-DGIT_BRANCH=${BRANCH} \
-DCMAKE_BUILD_TYPE=Release \
${CMAKE_EXTRA} ..
VERSION=`cat version.txt`
VERSION="${VERSION}-dev-${COMMIT}"
Expand All @@ -199,7 +117,7 @@ PKG_EXT="deb"
cpack -G DEB

OPKG="friction.${PKG_EXT}"
PKG="friction-${VERSION}-${DID}${COMPILER}.${PKG_EXT}"
PKG="friction-${VERSION}-${DID}.${PKG_EXT}"
mv ${OPKG} ${PKG}

FRICTION_PKG_DIR="${FRICTION_OUT_DIR}/${VERSION}"
Expand Down
39 changes: 7 additions & 32 deletions src/scripts/run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,20 @@ set -e -x

CWD=`pwd`

REL=${REL:-1}
SNAP=${SNAP:-0}
REL=${REL:-0}
BRANCH=${BRANCH:-""}
COMMIT=${COMMIT:-""}
TAG=${TAG:-""}
MKJOBS=${JOBS:-4}
CLANG=${CLANG:-1}

JAMMY=${JAMMY:-1}
LUNAR=${LUNAR:-1}
MANTIC=${MANTIC:-1}

if [ "${SNAP}" = 1 ]; then
REL=0
elif [ "${REL}" = 1 ]; then
SNAP=0
fi
NOBLE=${NOBLE:-0}

MOUNT_DIR="snapshots"
SF_NET_SRC="https://sourceforge.net/projects/friction/files/source"

DOCKER_MOUNT="-t --mount type=bind,source=${CWD}/${MOUNT_DIR},target=/${MOUNT_DIR}"
DOCKER="docker run -e REL=${REL} -e SNAP=${SNAP} -e MKJOBS=${JOBS} -e CLANG=${CLANG}"
DOCKER="docker run -e REL=${REL} -e MKJOBS=${JOBS}"

if [ "${BRANCH}" != "" ]; then
DOCKER="${DOCKER} -e FRICTION_BRANCH=${BRANCH}"
fi
Expand All @@ -56,28 +47,12 @@ if [ "${TAG}" != "" ]; then
fi
DOCKER="${DOCKER} ${DOCKER_MOUNT}"

FRICTION_DIST="${CWD}/snapshots/distfiles"

GPERF_V="4df0b85"
SKIA_V="5ae542b872"

if [ ! -d "${FRICTION_DIST}" ]; then
mkdir -p ${FRICTION_DIST}
fi

if [ ! -f "${FRICTION_DIST}/gperftools-${GPERF_V}.tar.xz" ]; then
curl -k -L "${SF_NET_SRC}/gperftools-${GPERF_V}.tar.xz/download" --output ${FRICTION_DIST}/gperftools-${GPERF_V}.tar.xz
fi
if [ ! -f "${FRICTION_DIST}/skia-${SKIA_V}.tar.xz" ]; then
curl -k -L "${SF_NET_SRC}/skia-${SKIA_V}.tar.xz/download" --output ${FRICTION_DIST}/skia-${SKIA_V}.tar.xz
fi

if [ "${JAMMY}" = 1 ]; then
$DOCKER friction-jammy
fi
if [ "${LUNAR}" = 1 ]; then
$DOCKER friction-lunar
fi
if [ "${MANTIC}" = 1 ]; then
$DOCKER friction-mantic
fi
if [ "${NOBLE}" = 1 ]; then
$DOCKER friction-noble
fi

1 comment on commit 5a5f7b8

@AlexKiryanov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool name сommit)

Please sign in to comment.