Skip to content

Commit

Permalink
Merge pull request #826 from contour-terminal/fix/qt6-linux
Browse files Browse the repository at this point in the history
Fixes building Contour with Qt 6 on X11 based systems.
  • Loading branch information
christianparpart authored Sep 24, 2022
2 parents abe099b + 2744f7e commit 94fb93f
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/fedora/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN dnf install -y \
git gcc rpm-build rpm-devel make coreutils diffutils patch rpmdevtools desktop-file-utils

# Install contour dependencies
RUN SYSDEP_ASSUME_YES=ON ./scripts/install-deps.sh
RUN SYSDEP_ASSUME_YES=ON QTVER=6 ./scripts/install-deps.sh

RUN useradd -d /app builder
RUN echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
Expand Down
18 changes: 10 additions & 8 deletions .github/fedora/contour.spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,22 @@ BuildRequires: gcc-c++
BuildRequires: harfbuzz-devel
BuildRequires: ninja-build
BuildRequires: pkgconf
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qtbase-gui
BuildRequires: qt5-qtmultimedia-devel
BuildRequires: qt6-qtbase-devel
BuildRequires: qt6-qtbase-gui
BuildRequires: qt6-qtdeclarative-devel
BuildRequires: qt6-qtmultimedia-devel

Requires: fontconfig
Requires: freetype
Requires: harfbuzz
Requires: qt5-qtbase
Requires: qt5-qtbase-gui
Requires: qt6-qtbase
Requires: qt6-qtbase-gui
Requires: qt6-qtmultimedia-devel
Requires: yaml-cpp
Requires: qt5-qtmultimedia-devel

%description
contour is a modern terminal emulator, for everyday use.
It is aiming for power users with a modern feature mindset.
Contour is a modern and actually fast, modal, virtual terminal emulator,
for everyday use. It is aiming for power users with a modern feature mindset.


%prep
Expand All @@ -49,6 +50,7 @@ It is aiming for power users with a modern feature mindset.
cmake . \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCONTOUR_BUILD_WITH_QT6=ON \
-DPEDANTIC_COMPILER=ON \
-DPEDANTIC_COMPILER_WERROR=ON \
-B build \
Expand Down
43 changes: 27 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ jobs:
fedora:
strategy:
matrix:
os_version: [35, 36]
arch:
[
"linux/amd64 x86_64"
]
name: "Fedora ${{ matrix.arch }}"
name: "Fedora ${{ matrix.os_version }} ${{ matrix.arch }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -132,6 +133,8 @@ jobs:
set -x
ARCH="${{ steps.tags.outputs.ARCH }}"
VERSION="${{ steps.set_vars.outputs.VERSION }}"
OS_VERSION="${{ matrix.os_version }}"
sed -i -e "s/fedora:35/fedora:${{ matrix.os_version }}/" .github/fedora/Dockerfile
docker buildx build --platform ${{ steps.tags.outputs.PLATFORM }} \
--tag contour:${ARCH} \
--build-arg VERSION=${VERSION} \
Expand All @@ -140,33 +143,33 @@ jobs:
--load \
.
docker create --name contour-${ARCH} contour:${ARCH}
docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-${VERSION}-1.fc35.${ARCH}.rpm \
contour-${VERSION}-1.fc35.${ARCH}.rpm
docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-debuginfo-${VERSION}-1.fc35.${ARCH}.rpm \
contour-debuginfo-${VERSION}-1.fc35.${ARCH}.rpm
docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-debugsource-${VERSION}-1.fc35.${ARCH}.rpm \
contour-debugsource-${VERSION}-1.fc35.${ARCH}.rpm
docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm \
contour-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm
docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-debuginfo-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm \
contour-debuginfo-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm
docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-debugsource-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm \
contour-debugsource-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm
docker container rm contour-${{ steps.tags.outputs.ARCH }}
echo "pwd: `pwd`" && ls -hla
- name: "Uploading Fedora RPM package"
uses: actions/upload-artifact@v2
with:
name: "contour-${{ steps.set_vars.outputs.VERSION }}-1.fc35.${{ steps.tags.outputs.ARCH }}.rpm"
path: "contour-${{ steps.set_vars.outputs.VERSION }}-1.fc35.${{ steps.tags.outputs.ARCH }}.rpm"
name: "contour-${{ steps.set_vars.outputs.VERSION }}-1.fc${{ matrix.os_version }}.${{ steps.tags.outputs.ARCH }}.rpm"
path: "contour-${{ steps.set_vars.outputs.VERSION }}-1.fc${{ matrix.os_version }}.${{ steps.tags.outputs.ARCH }}.rpm"
if-no-files-found: error
retention-days: 7
- name: "Uploading Fedora RPM package (debuginfo)"
uses: actions/upload-artifact@v2
with:
name: "contour-debuginfo-${{ steps.set_vars.outputs.VERSION }}-1.fc35.${{ steps.tags.outputs.ARCH }}.rpm"
path: "contour-debuginfo-${{ steps.set_vars.outputs.VERSION }}-1.fc35.${{ steps.tags.outputs.ARCH }}.rpm"
name: "contour-debuginfo-${{ steps.set_vars.outputs.VERSION }}-1.fc${{ matrix.os_version }}.${{ steps.tags.outputs.ARCH }}.rpm"
path: "contour-debuginfo-${{ steps.set_vars.outputs.VERSION }}-1.fc${{ matrix.os_version }}.${{ steps.tags.outputs.ARCH }}.rpm"
if-no-files-found: error
retention-days: 7
- name: "Uploading Fedora RPM package (debugsource)"
uses: actions/upload-artifact@v2
with:
name: "contour-debugsource-${{ steps.set_vars.outputs.VERSION }}-1.fc35.${{ steps.tags.outputs.ARCH }}.rpm"
path: "contour-debugsource-${{ steps.set_vars.outputs.VERSION }}-1.fc35.${{ steps.tags.outputs.ARCH }}.rpm"
name: "contour-debugsource-${{ steps.set_vars.outputs.VERSION }}-1.fc${{ matrix.os_version }}.${{ steps.tags.outputs.ARCH }}.rpm"
path: "contour-debugsource-${{ steps.set_vars.outputs.VERSION }}-1.fc${{ matrix.os_version }}.${{ steps.tags.outputs.ARCH }}.rpm"
if-no-files-found: error
retention-days: 7

Expand Down Expand Up @@ -538,10 +541,17 @@ jobs:
with:
key: "ccache-ubuntu-${{ matrix.os_version }}"
max-size: 256M
- name: set QTVER
id: set_qtver
run: |
# Recent Ubuntu versions ship with Qt 6. Use it.
if [[ ${{ matrix.os_version }} = "22.04" ]]; then
echo "::set-output name=QTVER::6"
fi
- name: "install dependencies"
run: sudo ./scripts/install-deps.sh
run: sudo env QTVER="${{ steps.set_qtver.outputs.QTVER }}" ./scripts/install-deps.sh
- name: "install GCC 10"
if: ${{ startsWith(matrix.OS_VERSION, '18.04') }}
if: ${{ startsWith(matrix.os_version, '18.04') }}
run: sudo apt install g++-10
- name: "create build directory"
run: mkdir build
Expand All @@ -552,8 +562,9 @@ jobs:
if [[ "${{ matrix.os_version }}" = "18.04" ]]; then
CMAKE_CXX_STANDARD=17
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DUSE_BOOST_FILESYSTEM=ON"
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCONTOUR_INSTALL_TOOLS=ON"
export CXX="g++-10"
elif [[ "${{ matrix.os_version }}" = "22.04" ]]; then
EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DCONTOUR_BUILD_WITH_QT6=ON"
fi
BUILD_DIR="build" \
CMAKE_BUILD_TYPE=RelWithDebInfo \
Expand Down
65 changes: 51 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,12 @@ jobs:
build_fedora:
strategy:
matrix:
os_version: [35, 36]
arch:
[
"linux/amd64 x86_64"
]
name: "Fedora ${{ matrix.arch }}"
name: "Fedora ${{ matrix.os_version }} ${{ matrix.arch }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -258,6 +259,8 @@ jobs:
set -x
ARCH="${{ steps.tags.outputs.ARCH }}"
VERSION="${{ steps.set_vars.outputs.VERSION }}"
OS_VERSION="${{ matrix.os_version }}"
sed -i -e "s/fedora:35/fedora:${{ matrix.os_version }}/" .github/fedora/Dockerfile
docker buildx build --platform ${{ steps.tags.outputs.PLATFORM }} \
--tag contour:${ARCH} \
--build-arg VERSION=${VERSION} \
Expand All @@ -266,30 +269,30 @@ jobs:
--load \
.
docker create --name contour-${ARCH} contour:${ARCH}
docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-${VERSION}-1.fc35.${ARCH}.rpm \
contour-${VERSION}-1.fc35.${ARCH}.rpm
docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-debuginfo-${VERSION}-1.fc35.${ARCH}.rpm \
contour-debuginfo-${VERSION}-1.fc35.${ARCH}.rpm
docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-debugsource-${VERSION}-1.fc35.${ARCH}.rpm \
contour-debugsource-${VERSION}-1.fc35.${ARCH}.rpm
docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm \
contour-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm
docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-debuginfo-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm \
contour-debuginfo-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm
docker cp contour-${ARCH}:/app/rpmbuild/RPMS/${ARCH}/contour-debugsource-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm \
contour-debugsource-${VERSION}-1.fc${OS_VERSION}.${ARCH}.rpm
docker container rm contour-${{ steps.tags.outputs.ARCH }}
echo "pwd: `pwd`" && ls -hla
- name: "Uploading Fedora RPM package"
uses: actions/upload-artifact@v2
with:
path: "contour-${{ steps.set_vars.outputs.VERSION }}-1.fc35.${{ steps.tags.outputs.ARCH }}.rpm"
path: "contour-${{ steps.set_vars.outputs.VERSION }}-1.fc${OS_VERSION}.${{ steps.tags.outputs.ARCH }}.rpm"
if-no-files-found: error
retention-days: 7
- name: "Uploading Fedora RPM package (debuginfo)"
uses: actions/upload-artifact@v2
with:
path: "contour-debuginfo-${{ steps.set_vars.outputs.VERSION }}-1.fc35.${{ steps.tags.outputs.ARCH }}.rpm"
path: "contour-debuginfo-${{ steps.set_vars.outputs.VERSION }}-1.fc${OS_VERSION}.${{ steps.tags.outputs.ARCH }}.rpm"
if-no-files-found: error
retention-days: 7
- name: "Uploading Fedora RPM package (debugsource)"
uses: actions/upload-artifact@v2
with:
path: "contour-debugsource-${{ steps.set_vars.outputs.VERSION }}-1.fc35.${{ steps.tags.outputs.ARCH }}.rpm"
path: "contour-debugsource-${{ steps.set_vars.outputs.VERSION }}-1.fc${OS_VERSION}.${{ steps.tags.outputs.ARCH }}.rpm"
if-no-files-found: error
retention-days: 7

Expand Down Expand Up @@ -570,8 +573,8 @@ jobs:
asset_name: contour_${{ steps.set_vars.outputs.version }}-archlinux_aarch64
asset_content_type: application/x-zstd-compressed-tar

# -------------------------------------------------------------
- name: Upload Fedora package x86_64
# {{{ Fedora 35 packages
- name: Upload Fedora 35 package x86_64
id: upload-release-asset-fedora-x86_64
uses: actions/upload-release-asset@v1
env:
Expand All @@ -582,7 +585,6 @@ jobs:
asset_name: contour-${{ steps.set_vars.outputs.VERSION }}-1.fc35.x86_64.rpm
asset_content_type: application/x-rpm

# -------------------------------------------------------------
- name: Upload Fedora (debuginfo) package x86_64
id: upload-release-asset-fedora-debuginfo-x86_64
uses: actions/upload-release-asset@v1
Expand All @@ -594,7 +596,6 @@ jobs:
asset_name: contour-debuginfo-${{ steps.set_vars.outputs.VERSION }}-1.fc35.x86_64.rpm
asset_content_type: application/x-rpm

# -------------------------------------------------------------
- name: Upload Fedora (debugsource) package x86_64
id: upload-release-asset-fedora-debugsource-x86_64
uses: actions/upload-release-asset@v1
Expand All @@ -605,6 +606,42 @@ jobs:
asset_path: "./contour-debugsource-${{ steps.set_vars.outputs.VERSION }}-1.fc35.x86_64.rpm"
asset_name: contour-debugsource-${{ steps.set_vars.outputs.VERSION }}-1.fc35.x86_64.rpm
asset_content_type: application/x-rpm
# }}}

# {{{ Fedora 36 packages
- name: Upload Fedora 36 package x86_64
id: upload-release-asset-fedora-x86_64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "./contour-${{ steps.set_vars.outputs.VERSION }}-1.fc36.x86_64.rpm"
asset_name: contour-${{ steps.set_vars.outputs.VERSION }}-1.fc36.x86_64.rpm
asset_content_type: application/x-rpm

- name: Upload Fedora 36 (debuginfo) package x86_64
id: upload-release-asset-fedora-debuginfo-x86_64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "./contour-debuginfo-${{ steps.set_vars.outputs.VERSION }}-1.fc36.x86_64.rpm"
asset_name: contour-debuginfo-${{ steps.set_vars.outputs.VERSION }}-1.fc36.x86_64.rpm
asset_content_type: application/x-rpm

- name: Upload Fedora (debugsource) package x86_64
id: upload-release-asset-fedora-debugsource-x86_64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "./contour-debugsource-${{ steps.set_vars.outputs.VERSION }}-1.fc36.x86_64.rpm"
asset_name: contour-debugsource-${{ steps.set_vars.outputs.VERSION }}-1.fc36.x86_64.rpm
asset_content_type: application/x-rpm
# }}}

# -------------------------------------------------------------
- name: Upload Windows MSI package
Expand Down
12 changes: 9 additions & 3 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,17 @@ CXX_NAME=$(basename $CXX)
BUILD_TYPE="${1:-Debug}"
BUILD_DIR="${ROOTDIR}/target/$(uname -m)-$(uname -s)-${CXX_NAME}-${BUILD_TYPE}"

if test v$QTVER = v6; then
EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DCONTOUR_BUILD_WITH_QT6=ON"
fi

case "$OSTYPE" in
darwin*)
EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DQt5_DIR=$(brew --prefix qt5)/lib/cmake/Qt5"
# EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DQt6_DIR=$(brew --prefix qt6)/lib/cmake/Qt6"
# EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DCONTOUR_BUILD_WITH_QT6=ON"
if test v$QTVER = v6; then
EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DQt6_DIR=$(brew --prefix qt6)/lib/cmake/Qt6"
else
EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DQt5_DIR=$(brew --prefix qt5)/lib/cmake/Qt5"
fi
;;
*)
;;
Expand Down
45 changes: 36 additions & 9 deletions scripts/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,33 @@ install_deps_ubuntu()
libfontconfig1-dev
libfreetype6-dev
libharfbuzz-dev
libqt5gui5
libqt5opengl5-dev
libqt5x11extras5-dev
libx11-xcb-dev
libyaml-cpp-dev
make
ncurses-bin
pkg-config
qtbase5-dev
qtmultimedia5-dev
"

if test x$QTVER = x6; then
packages="$packages
libgl1-mesa-dev
libglvnd-dev
libqt6opengl6-dev
libqt6widgets6
qt6-base-dev
qt6-base-dev-tools
qt6-multimedia-dev
"
else
packages="$packages
libqt5gui5
libqt5opengl5-dev
libqt5x11extras5-dev
qtbase5-dev
qtmultimedia5-dev
"
fi

RELEASE=`grep VERSION_ID /etc/os-release | cut -d= -f2 | tr -d '"'`

local NAME=`grep ^NAME /etc/os-release | cut -d= -f2 | cut -f1 | tr -d '"'`
Expand Down Expand Up @@ -336,13 +351,25 @@ install_deps_fedora()
libxcb-devel
ninja-build
pkgconf
qt5-qtbase-devel
qt5-qtbase-gui
qt5-qtmultimedia-devel
qt5-qtx11extras-devel
range-v3-devel
yaml-cpp-devel
"

if test x$QTVER = x6; then
packages="$packages
qt6-qtbase-devel
qt6-qtbase-gui
qt6-qtdeclarative-devel
qt6-qtmultimedia-devel
"
else
packages="$packages
qt5-qtbase-devel
qt5-qtbase-gui
qt5-qtmultimedia-devel
qt5-qtx11extras-devel
"
fi
# Sadly, gsl-devel system package is too old to be used.
sudo dnf install $SYSDEP_ASSUME_YES $packages
}
Expand Down
Loading

0 comments on commit 94fb93f

Please sign in to comment.