diff --git a/x11-packages/qt-creator/build.sh b/x11-packages/qt-creator/build.sh new file mode 100644 index 0000000000..fe86be2585 --- /dev/null +++ b/x11-packages/qt-creator/build.sh @@ -0,0 +1,34 @@ +TERMUX_PKG_HOMEPAGE=https://www.qt.io/ +TERMUX_PKG_DESCRIPTION="Integrated Development Environment for Qt" +TERMUX_PKG_LICENSE="GPL-3.0-only" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION="18.0.0" +TERMUX_PKG_SRCURL="https://download.qt.io/official_releases/qtcreator/${TERMUX_PKG_VERSION%.*}/${TERMUX_PKG_VERSION}/qt-creator-opensource-src-${TERMUX_PKG_VERSION}.tar.gz" +TERMUX_PKG_SHA256=6c8bcbd2f33aa6851f265ab22fc8bee7fc4cfcb3cc1d0db73978c7afe9272eb3 +TERMUX_PKG_AUTO_UPDATE=true +TERMUX_PKG_DEPENDS="clang, glib, libandroid-execinfo, libarchive, libelf, libllvm, libsecret, opengl, python, qt6-qtbase, qt6-qtcharts, qt6-qtdeclarative, qt6-qttools, qt6-qtsvg, libyaml-cpp, zstd" +TERMUX_PKG_BUILD_DEPENDS="libllvm-static, qt6-qtbase-cross-tools, qt6-qtcharts-cross-tools, qt6-qtdeclarative-cross-tools, qt6-qttools-cross-tools, qt6-qtsvg-cross-tools" +TERMUX_PKG_RECOMMENDS="gdb, git, make, cmake, mlocate" +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_NO_STATICSPLIT=true +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +-DCMAKE_SYSTEM_NAME=Linux +-DCMAKE_INSTALL_LIBDIR=lib +-DCMAKE_INSTALL_INCLUDEDIR=include +-DBUILD_WITH_PCH=OFF +" + +termux_step_pre_configure() { + termux_setup_golang + + LDFLAGS+=" -landroid-execinfo" + + # add the directories of all .so files found in the package + # to the library run paths of all executables in the package + # the 'qtcreator.sh' script sets LD_LIBRARY_PATH automatically so does not + # seem to need this, but setting these makes the 'qtcreator' binary + # possible to launch directly without errors. + LDFLAGS+=" -Wl,-rpath=$TERMUX_PREFIX/lib/qtcreator" + LDFLAGS+=" -Wl,-rpath=$TERMUX_PREFIX/lib/qtcreator/plugins" + LDFLAGS+=" -Wl,-rpath=$TERMUX_PREFIX/lib/qtcreator/plugins/qmldesigner" +} diff --git a/x11-packages/qt-creator/no-malloc_trim.patch b/x11-packages/qt-creator/no-malloc_trim.patch new file mode 100644 index 0000000000..48b3f9ff9f --- /dev/null +++ b/x11-packages/qt-creator/no-malloc_trim.patch @@ -0,0 +1,13 @@ +diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp +index e1416f31..235e6d27 100644 +--- a/src/plugins/coreplugin/icore.cpp ++++ b/src/plugins/coreplugin/icore.cpp +@@ -1494,7 +1494,7 @@ void ICorePrivate::init() + using namespace std::chrono_literals; + m_trimTimer.setInterval(60s); + // glibc may not actually free memory in free(). +-#ifdef Q_OS_LINUX ++#if defined(Q_OS_LINUX) && !defined(__ANDROID__) + connect(&m_trimTimer, &QTimer::timeout, this, [] { malloc_trim(0); }); + #endif + } diff --git a/x11-packages/qt-creator/no-pthread_getname_np.patch b/x11-packages/qt-creator/no-pthread_getname_np.patch new file mode 100644 index 0000000000..bde573c32f --- /dev/null +++ b/x11-packages/qt-creator/no-pthread_getname_np.patch @@ -0,0 +1,11 @@ +--- a/src/libs/nanotrace/nanotracehr.cpp ++++ b/src/libs/nanotrace/nanotracehr.cpp +@@ -104,7 +104,7 @@ std::string getThreadName() + { + std::array buffer; + buffer[0] = 0; +-#ifdef Q_OS_UNIX ++#if (defined(Q_OS_UNIX) && !defined(__ANDROID__)) || (defined(__ANDROID__) && __ANDROID_API__ >= 26) + auto rc = pthread_getname_np(pthread_self(), buffer.data(), buffer.size()); + if (rc != 0) + return {}; diff --git a/x11-packages/qt-creator/no-utmpxname.patch b/x11-packages/qt-creator/no-utmpxname.patch new file mode 100644 index 0000000000..b58957c4b6 --- /dev/null +++ b/x11-packages/qt-creator/no-utmpxname.patch @@ -0,0 +1,13 @@ +diff --git a/src/libs/3rdparty/libptyqt/unixptyprocess.cpp b/src/libs/3rdparty/libptyqt/unixptyprocess.cpp +index d76349a4..85cfd3f9 100644 +--- a/src/libs/3rdparty/libptyqt/unixptyprocess.cpp ++++ b/src/libs/3rdparty/libptyqt/unixptyprocess.cpp +@@ -323,7 +323,7 @@ void ShellProcess::configChildProcess() + ioctl(m_handleSlave, TIOCSCTTY, 0); + tcsetpgrp(m_handleSlave, sid); + +-#if !defined(Q_OS_ANDROID) && !defined(Q_OS_FREEBSD) ++#if !defined(Q_OS_ANDROID) && !defined(Q_OS_FREEBSD) && !defined(__ANDROID__) + // on Android imposible to put record to the 'utmp' file + struct utmpx utmpxInfo; + memset(&utmpxInfo, 0, sizeof(utmpxInfo)); diff --git a/x11-packages/qt-creator/shm_open.patch b/x11-packages/qt-creator/shm_open.patch new file mode 100644 index 0000000000..f92492368a --- /dev/null +++ b/x11-packages/qt-creator/shm_open.patch @@ -0,0 +1,70 @@ +diff --git a/src/libs/qmlpuppetcommunication/container/sharedmemory_unix.cpp b/src/libs/qmlpuppetcommunication/container/sharedmemory_unix.cpp +index 76b93a3c..ebdf3917 100644 +--- a/src/libs/qmlpuppetcommunication/container/sharedmemory_unix.cpp ++++ b/src/libs/qmlpuppetcommunication/container/sharedmemory_unix.cpp +@@ -23,6 +23,65 @@ + + #include + ++static int shm_unlink(const char *name) { ++ size_t namelen; ++ char *fname; ++ ++ /* Construct the filename. */ ++ while (name[0] == '/') ++name; ++ ++ if (name[0] == '\0') { ++ /* The name "/" is not supported. */ ++ errno = EINVAL; ++ return -1; ++ } ++ ++ namelen = strlen(name); ++ fname = (char *) alloca(sizeof("@TERMUX_PREFIX@/tmp/") - 1 + namelen + 1); ++ memcpy(fname, "@TERMUX_PREFIX@/tmp/", sizeof("@TERMUX_PREFIX@/tmp/") - 1); ++ memcpy(fname + sizeof("@TERMUX_PREFIX@/tmp/") - 1, name, namelen + 1); ++ ++ return unlink(fname); ++} ++ ++static int shm_open(const char *name, int oflag, mode_t mode) { ++ size_t namelen; ++ char *fname; ++ int fd; ++ ++ /* Construct the filename. */ ++ while (name[0] == '/') ++name; ++ ++ if (name[0] == '\0') { ++ /* The name "/" is not supported. */ ++ errno = EINVAL; ++ return -1; ++ } ++ ++ namelen = strlen(name); ++ fname = (char *) alloca(sizeof("@TERMUX_PREFIX@/tmp/") - 1 + namelen + 1); ++ memcpy(fname, "@TERMUX_PREFIX@/tmp/", sizeof("@TERMUX_PREFIX@/tmp/") - 1); ++ memcpy(fname + sizeof("@TERMUX_PREFIX@/tmp/") - 1, name, namelen + 1); ++ ++ fd = open(fname, oflag, mode); ++ if (fd != -1) { ++ /* We got a descriptor. Now set the FD_CLOEXEC bit. */ ++ int flags = fcntl(fd, F_GETFD, 0); ++ flags |= FD_CLOEXEC; ++ flags = fcntl(fd, F_SETFD, flags); ++ ++ if (flags == -1) { ++ /* Something went wrong. We cannot return the descriptor. */ ++ int save_errno = errno; ++ close(fd); ++ fd = -1; ++ errno = save_errno; ++ } ++ } ++ ++ return fd; ++} ++ + namespace QmlDesigner { + + class SharedMemoryLocker