mirror of
https://github.com/jetkvm/rv1106-system.git
synced 2026-05-21 05:20:41 +00:00
chore: include dependency headers in buildkit (#40)
This commit is contained in:
@@ -58,11 +58,7 @@ jobs:
|
||||
retention-days: 7
|
||||
- name: Create compressed buildkit
|
||||
run: |
|
||||
tar "-I zstd -10 -T0 --long=31" -cf \
|
||||
buildkit.tar.zst \
|
||||
tools/linux/toolchain \
|
||||
media/out/include \
|
||||
media/out/lib
|
||||
./make_buildkit.sh
|
||||
- name: Upload buildkit
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -94,4 +90,4 @@ jobs:
|
||||
fail_on_unmatched_files: true
|
||||
tag_name: ${{ github.ref }}
|
||||
name: ${{ github.ref }}
|
||||
generate_release_notes: true
|
||||
generate_release_notes: true
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
TMP_PATH=$(mktemp -d)
|
||||
echo "TMP_PATH: $TMP_PATH"
|
||||
clean_up () {
|
||||
ARG=$?
|
||||
echo "> Cleaning up, exit code: $ARG"
|
||||
rm -rf $TMP_PATH
|
||||
exit $ARG
|
||||
}
|
||||
trap clean_up EXIT
|
||||
set -e
|
||||
|
||||
RK_PATH=$(pwd)
|
||||
RK_ARCH=arm-rockchip830-linux-uclibcgnueabihf
|
||||
RK_BOARD_PATH=${RK_PATH}/sysdrv/tools/board/
|
||||
|
||||
echo "Copying toolchain"
|
||||
cp -r $RK_PATH/tools/linux/toolchain/$RK_ARCH/* ${TMP_PATH}/
|
||||
|
||||
TARGET_SYSROOT_PATH="${TMP_PATH}/${RK_ARCH}/sysroot"
|
||||
TARGET_INCLUDE_PATH="${TARGET_SYSROOT_PATH}/usr/include"
|
||||
TARGET_LIB_PATH="${TARGET_SYSROOT_PATH}/usr/lib"
|
||||
|
||||
echo "Copying Rockchip Media files"
|
||||
cp -r $RK_PATH/media/out/include/* ${TARGET_INCLUDE_PATH}/
|
||||
cp -r $RK_PATH/media/out/lib/* ${TARGET_LIB_PATH}/
|
||||
|
||||
echo "Copying dependencies"
|
||||
function copy_dep() {
|
||||
local PKG_NAME=$1
|
||||
local PKG_PATH=${RK_BOARD_PATH}/${PKG_NAME}
|
||||
echo "Copying ${PKG_NAME} to ${TARGET_LIB_PATH}"
|
||||
cp -r ${PKG_PATH}/out/lib/* ${TARGET_LIB_PATH}/
|
||||
echo "Copying headers"
|
||||
cp -r ${PKG_PATH}/out/include/* ${TARGET_INCLUDE_PATH}/
|
||||
}
|
||||
|
||||
copy_dep toolkits/openssl
|
||||
copy_dep toolkits/zlib
|
||||
|
||||
cp $RK_PATH/rv1106-jetkvm-v2.cmake ${TMP_PATH}/
|
||||
|
||||
tar "-I zstd -10 -T0 --long=31" -cvf \
|
||||
buildkit.tar.zst -C ${TMP_PATH} .
|
||||
|
||||
echo "Done"
|
||||
@@ -0,0 +1,75 @@
|
||||
SET(JK_TARGET_ARCH "arm-rockchip830-linux-uclibcgnueabihf")
|
||||
SET(JK_BUILDKIT_PATH "/opt/jetkvm-native-buildkit")
|
||||
|
||||
SET(JK_TOOLCHAIN_PATH "${JK_BUILDKIT_PATH}/${JK_TARGET_ARCH}")
|
||||
SET(JK_SYSROOT_PATH "${JK_TOOLCHAIN_PATH}/sysroot")
|
||||
|
||||
SET(JK_SYS_INCLUDE_PATH "${JK_TOOLCHAIN_PATH}/include/c++/8.3.0")
|
||||
SET(JK_SYS_INCLUDE_PATH_ARCH "${JK_TOOLCHAIN_PATH}/include/c++/8.3.0/${JK_TARGET_ARCH}")
|
||||
SET(JK_SYS_INCLUDE_PATH_SYSROOT "${JK_SYSROOT_PATH}/usr/include")
|
||||
|
||||
IF (NOT EXISTS "${JK_SYS_INCLUDE_PATH}")
|
||||
MESSAGE(FATAL_ERROR "JK_SYS_INCLUDE_PATH not found: ${JK_SYS_INCLUDE_PATH}")
|
||||
ENDIF()
|
||||
|
||||
IF (NOT EXISTS "${JK_SYS_INCLUDE_PATH_ARCH}")
|
||||
MESSAGE(FATAL_ERROR "JK_SYS_INCLUDE_PATH_ARCH not found: ${JK_SYS_INCLUDE_PATH_ARCH}")
|
||||
ENDIF()
|
||||
|
||||
IF (NOT EXISTS "${JK_SYS_INCLUDE_PATH_SYSROOT}")
|
||||
MESSAGE(FATAL_ERROR "JK_SYS_INCLUDE_PATH_SYSROOT not found: ${JK_SYS_INCLUDE_PATH_SYSROOT}")
|
||||
ENDIF()
|
||||
|
||||
SET(MULTIARCH "$JK_TARGET_ARCH")
|
||||
SET(ROOTFS "${JK_SYSROOT_PATH}")
|
||||
|
||||
# this is required
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR "armv7l")
|
||||
|
||||
# specify the cross compiler
|
||||
SET(CMAKE_C_COMPILER ${JK_BUILDKIT_PATH}/bin/${JK_TARGET_ARCH}-gcc)
|
||||
SET(CMAKE_CXX_COMPILER ${JK_BUILDKIT_PATH}/bin/${JK_TARGET_ARCH}-g++)
|
||||
|
||||
# This is very important, so that we find the right headers and libraries
|
||||
# without explicitly listing the default include directories (e.g. JSC)
|
||||
SET(CMAKE_SYSROOT "${ROOTFS}")
|
||||
|
||||
# Ensure that FIND_PACKAGE() functions and friends look in the rootfs
|
||||
# only for libraries and header files, but not for programs (e.g perl)
|
||||
SET(CMAKE_FIND_ROOT_PATH "${ROOTFS}")
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
# Add include directories from the rootfs matching the current toolchain
|
||||
INCLUDE_DIRECTORIES(SYSTEM
|
||||
"${JK_SYS_INCLUDE_PATH}"
|
||||
"${JK_SYS_INCLUDE_PATH_ARCH}"
|
||||
"${JK_SYS_INCLUDE_PATH_SYSROOT}"
|
||||
)
|
||||
|
||||
SET(JK_CPPFLAGS "-D_GNU_SOURCE")
|
||||
SET(JK_CPPFLAGS_DEPS "-I${JK_SYS_INCLUDE_PATH_SYSROOT} -isystem ${JK_SYS_INCLUDE_PATH} -isystem ${JK_SYS_INCLUDE_PATH_ARCH}")
|
||||
|
||||
# CMake does not pick CPPFLAGS, so we add it manually into CFLAGS and CXXFLAGS
|
||||
# Note: I have no idea why the first include directory from the previous list
|
||||
# gets ignored when building some components, so I pass it here as well.
|
||||
SET(CPPFLAGS "-DG_DISABLE_CAST_CHECKS -DNDEBUG -Os -s")
|
||||
SET(ENV{CFLAGS} "${CPPFLAGS} -fstack-protector-strong -Wall -Wformat -Werror=format-security ${JK_CPPFLAGS} ${JK_CPPFLAGS_DEPS}")
|
||||
SET(ENV{CXXFLAGS} "${CPPFLAGS} -fstack-protector-strong -Wall -Wformat -Werror=format-security ${JK_CPPFLAGS} ${JK_CPPFLAGS_DEPS}")
|
||||
|
||||
# CMake does not pick LDFLAGS, so we add it manually too
|
||||
SET(ENV{LDFLAGS} "-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -Wl,-rpath-link,${ROOTFS}/usr/lib")
|
||||
|
||||
# Need to export this variables for pkg-config to pick them up, so that it
|
||||
# sets the right search path and prefixes the result paths with the rootfs.
|
||||
SET(ENV{PKG_CONFIG_PATH} "${ROOTFS}/usr/share/pkgconfig")
|
||||
SET(ENV{PKG_CONFIG_LIBDIR} "${ROOTFS}/usr/lib/pkgconfig:${ROOTFS}/usr/lib")
|
||||
SET(ENV{PKG_CONFIG_SYSROOT_DIR} "${ROOTFS}")
|
||||
|
||||
# These variables make sure that pkg-config does never discard standard
|
||||
# include and library paths from the compile and linking flags.
|
||||
SET(ENV{PKG_CONFIG_ALLOW_SYSTEM_CFLAGS} 1)
|
||||
SET(ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS} 1)
|
||||
SET(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
|
||||
Reference in New Issue
Block a user