Skip to content

Commit

Permalink
Decrease number of shared libs
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaraslaut committed Jun 28, 2024
1 parent e4626a3 commit ec3196f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
5 changes: 2 additions & 3 deletions .github/static/DockerUbuntu
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ FROM yaraslaut/static_qt:$VERSION
#FROM qt_static:$VERSION
ARG ARCH="x86_64"

RUN apt-get install -y git libutempter-dev make

RUN apt-get install -y xutils-dev pkg-config binutils gettext autoconf libtool
RUN apt-get install -y xutils-dev pkg-config binutils gettext autoconf libtool make git

WORKDIR /
COPY . /contour
Expand All @@ -15,6 +13,7 @@ WORKDIR /contour
RUN LD_LIBRARY_PATH=/usr/local/lib cmake -S . -B build -G Ninja \
-D CONTOUR_BUILD_STATIC=ON \
-D CONTOUR_USE_CPM=ON \
-D CONTOUR_WITH_UTEMPTER=OFF \
-D CMAKE_CXX_COMPILER=clang++-18 \
-D CMAKE_C_COMPILER=clang-18 \
-D CMAKE_CXX_FLAGS="-I/contour/build/_deps/yaml-cpp-src/include" \
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ option(CONTOUR_STACKTRACE_ADDR2LINE "Uses addr2line to pretty-print SEGV stacktr
option(CONTOUR_BUILD_WITH_MIMALLOC "Builds with mimalloc [default: OFF]" OFF)
option(CONTOUR_INSTALL_TOOLS "Installs tools, if built [default: OFF]" OFF)
option(CONTOUR_PACKAGE_TERMINFO "Package terminfo files" ON)
option(CONTOUR_WITH_UTEMPTER "Build with utempter support [default: ON]" ON)
option(CONTOUR_USE_CPM "Use CPM to fetch dependencies [default: OFF]" OFF)
option(CONTOUR_BUILD_STATIC "Link to static libraries [default: OFF]" OFF)

Expand Down
5 changes: 5 additions & 0 deletions scripts/install-static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,8 @@ autogen_install_package "https://github.com/PCRE2Project/pcre2/releases/download
cmake_install_package "double-conversion-3.3.0" "https://github.com/google/double-conversion/archive/refs/tags/v3.3.0.tar.gz"
# install libX11
configure_install_package "https://www.x.org/releases/individual/lib/libX11-1.8.9.tar.gz"

# some xcb dependencies
for package in xcb-proto-1.17.0 xcb-util-0.4.0 libxcb-1.17.0 xcb-util-cursor-0.1.4 xcb-util-keysyms-0.4.1 xcb-util-renderutil-0.3.9; do
configure_install_package "https://xcb.freedesktop.org/dist/$package.tar.gz"
done
8 changes: 4 additions & 4 deletions src/vtpty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ else()
endif()

if(EXISTS "/.flatpak-info")
set(FLATPAK TRUE)
set(CONTOUR_WITH_UTEMPTER OFF)
endif()

set(vtpty_LIBRARIES crispy::core fmt::fmt-header-only Microsoft.GSL::GSL)
Expand Down Expand Up @@ -51,7 +51,7 @@ else()
endif()

if(LINUX)
if(NOT FLATPAK)
if(CONTOUR_WITH_UTEMPTER)
set(vtpty_LIBRARIES ${vtpty_LIBRARIES} utempter)
endif()
endif()
Expand All @@ -68,8 +68,8 @@ endif()

add_library(vtpty STATIC ${vtpty_SOURCES} ${vtpty_HEADERS})
set_target_properties(vtpty PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE}")
if(FLATPAK)
target_compile_definitions(vtpty PRIVATE FLATPAK=1)
if(CONTOUR_WITH_UTEMPTER)
target_compile_definitions(vtpty PRIVATE UTEMPTER=1)
endif()
if(_include_SshSession_module)
target_compile_definitions(vtpty PUBLIC VTPTY_LIBSSH2=1)
Expand Down
6 changes: 3 additions & 3 deletions src/vtpty/UnixPty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <pwd.h>
#include <unistd.h>

#if defined(__linux__) && !defined(FLATPAK)
#if defined(__linux__) && defined(UTEMPTER)
#include <utempter.h>
#endif

Expand Down Expand Up @@ -85,7 +85,7 @@ namespace
return { PtyMasterHandle::cast_from(masterFd), PtySlaveHandle::cast_from(slaveFd) };
}

#if defined(__linux__) && !defined(FLATPAK)
#if defined(__linux__) && defined(UTEMPTER)
char const* hostnameForUtmp()
{
for (auto const* env: { "DISPLAY", "WAYLAND_DISPLAY" })
Expand Down Expand Up @@ -223,7 +223,7 @@ void UnixPty::start()
_readSelector.want_read(_masterFd);
_readSelector.want_read(_stdoutFastPipe.reader());

#if defined(__linux__) && !defined(FLATPAK)
#if defined(__linux__) && defined(UTEMPTER)
utempter_add_record(_masterFd, hostnameForUtmp());
#endif
}
Expand Down

0 comments on commit ec3196f

Please sign in to comment.