toolchain: Added autoconf-2.69 and automake-1.15.1

Environment variables changed:
- KOS_SDK_DIR to install libraries
- KOS_PORTS_DIR for ported applications to KolibriOS

Signed-off-by: Max Logaev <maxlogaev@proton.me>
This commit is contained in:
2025-12-24 17:24:18 +03:00
parent aa7a9c99f3
commit 4d8e694c2e
5 changed files with 59 additions and 21 deletions

View File

@@ -8,21 +8,21 @@ include(ExternalProject)
set(JOBS 6)
# Installation directory for GCC and Binutils
if(NOT DEFINED ENV{SDK_TOOLCHAIN_DIR})
message(FATAL_ERROR "The environment variable SDK_TOOLCHAIN_DIR is not set!")
if(NOT DEFINED ENV{KOS_SDK_DIR})
message(FATAL_ERROR "The environment variable KOS_SDK_DIR is not set!")
endif()
set(SDK_TOOLCHAIN_DIR $ENV{SDK_TOOLCHAIN_DIR})
set(KOS_SDK_DIR $ENV{KOS_SDK_DIR})
message(STATUS "SDK_TOOLCHAIN_DIR=${SDK_TOOLCHAIN_DIR}")
message(STATUS "KOS_SDK_DIR=${KOS_SDK_DIR}")
# Directory for installing ports
if(NOT DEFINED ENV{SDK_SYSROOT_DIR})
message(FATAL_ERROR "The environment variable SDK_SYSROOT_DIR is not set!")
if(NOT DEFINED ENV{KOS_PORTS_DIR})
message(FATAL_ERROR "The environment variable KOS_PORTS_DIR is not set!")
endif()
set(SDK_SYSROOT_DIR $ENV{SDK_SYSROOT_DIR})
message(STATUS "SDK_SYSROOT_DIR=${SDK_SYSROOT_DIR}")
set(KOS_PORTS_DIR $ENV{KOS_PORTS_DIR})
message(STATUS "SDK_SYSROOT_DIR=${KOS_PORTS_DIR}")
add_subdirectory(toolchain)
add_subdirectory(libraries)

View File

@@ -1,10 +1,8 @@
#!/bin/bash
# Installation directory for GCC and Binutils"
export SDK_TOOLCHAIN_DIR="$(pwd)/sdk/toolchain"
# Installation directory for GCC and Binutils
export KOS_SDK_DIR="$(pwd)/sdk"
export KOS_PORTS_DIR="$(pwd)/ports"
# Directory for installing ports"
export SDK_SYSROOT_DIR="$(pwd)/sdk/sysroot"
# Add i586-kolibrios toolchain to PATH
export PATH=$PATH:"$SDK_TOOLCHAIN_DIR/bin"
# Add i586-kolibrios toolchain to PATH
export PATH="$KOS_SDK_DIR/bin:$PATH"

View File

@@ -12,4 +12,4 @@ if [ ! -f "kolibri.img" ]; then
download_kolibrios
fi
qemu-system-i386 -boot a -fda kolibri.img -m 512 -drive file=fat:rw:"$SDK_SYSROOT_DIR" -usbdevice tablet
qemu-system-i386 -boot a -fda kolibri.img -m 512 -drive file=fat:rw:"$KOS_PORTS_DIR" -usbdevice tablet

View File

@@ -1,5 +1,33 @@
# Rules for building the i586-kolibrios-gcc toolchain
# Autoconf
set(AUTOCONF_VER 2.69)
ExternalProject_Add(
autoconf
URL https://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VER}.tar.gz
URL_HASH SHA256=954bd69b391edc12d6a4a51a2dd1476543da5c6bbf05a95b59dc0dd6fd4c2969
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${KOS_SDK_DIR}
BUILD_COMMAND make
INSTALL_COMMAND make install
)
# Automake
set(AUTOMAKE_VER 1.15.1)
ExternalProject_Add(
automake
CONFIGURE_COMMAND
URL https://ftp.gnu.org/gnu/automake/automake-${AUTOMAKE_VER}.tar.gz
URL_HASH SHA256=988e32527abe052307d21c8ca000aa238b914df363a617e38f4fb89f5abf6260
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/automake/add-kolibrios.diff
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${KOS_SDK_DIR}
BUILD_COMMAND make -j${JOBS}
INSTALL_COMMAND make install
)
# Binutils
set(BINUTILS_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/binutils)
@@ -9,8 +37,7 @@ ExternalProject_Add(
CONFIGURE_COMMAND
${BINUTILS_SRC_DIR}/configure
--target=i586-kolibrios
--prefix=${SDK_TOOLCHAIN_DIR}
--with-sysroot=${SDK_SYSROOT_DIR}
--prefix=${KOS_SDK_DIR}
--disable-werror
--disable-nls
--disable-intl
@@ -30,8 +57,8 @@ ExternalProject_Add(
CONFIGURE_COMMAND
${GCC_SRC_DIR}/configure
--target=i586-kolibrios
--with-sysroot=${SDK_SYSROOT_DIR}
--prefix=${SDK_TOOLCHAIN_DIR}
--with-sysroot=${KOS_SDK_DIR}/i586-kolibrios
--prefix=${KOS_SDK_DIR}
--disable-multilib
--disable-nls
--enable-shared
@@ -48,5 +75,5 @@ add_dependencies(gcc newlib-headers)
# Copy kos-app.lds
file(
COPY "${CMAKE_CURRENT_SOURCE_DIR}/kos-app.lds"
DESTINATION "${SDK_TOOLCHAIN_DIR}/i586-kolibrios/lib/"
DESTINATION "${KOS_SDK_DIR}/i586-kolibrios/lib/"
)

View File

@@ -0,0 +1,13 @@
diff --git a/lib/config.sub b/lib/config.sub
index 40ea5df..5c666fb 100755
--- a/lib/config.sub
+++ b/lib/config.sub
@@ -1417,7 +1417,7 @@ case $os in
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
- | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
+ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -kolibrios* )
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)