add llvm support

This commit is contained in:
superconvert 2022-10-01 22:33:38 +08:00
parent d1a95e421c
commit 9d956731f1
2 changed files with 46 additions and 8 deletions

View File

@ -167,18 +167,36 @@ echo "${CYAN}--- build diskfs ---${NC}"
cp rootfs/* ${diskfs} -r
# 带有 gcc 编译器
if [ "${with_gcc}" = true ]; then
echo "${RED} ... build gcc tools${NC}"
echo "${RED} ... build with-gcc${NC}"
cp ${gcc_install}/* ${diskfs} -r
cp ${binutils_install}/usr/x86_64-pc-linux-gnu/* ${diskfs} -r
fi
rm -rf ${diskfs}/init ${diskfs}/lost+found
# 测试用户登陆模式: root/123456
if [ "${with_login}" = true ]; then
echo "${RED} ... build with-login${NC}"
./mk_login.sh ${diskfs}
fi
# 带有 xfce 编译器
if [ "${with_xfce}" = true ]; then
echo "${RED} ... build xfce desktop${NC}"
# 构建 Xorg 的键盘数据
rm ${xfce_install}/usr/local/share/X11/xkb -rf
ln -s /usr/share/X11/xkb ${xfce_install}/usr/local/share/X11
mv ${xfce_install}/usr/local/lib/libpcre.so.1 ${xfce_install}/usr/local/lib/libpcre.so.3
# 依赖版本 3
if [ -f "${xfce_install}/usr/local/lib/libpcre.so.1" ]; then
mv ${xfce_install}/usr/local/lib/libpcre.so.1 ${xfce_install}/usr/local/lib/libpcre.so.3
fi
# dbus 用户添加
echo "messagebus:x:107:" >> ${diskfs}/etc/group
echo "messagebus:x:103:107::/nonexistent:/usr/sbin/nologin" >> ${diskfs}/etc/passwd
# dbus 启动脚本
# dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
# dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
# dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3
# 拷贝 xfce4 到镜像目录
cp ${xfce_install}/* ${diskfs} -r -n
echo "xinit /usr/local/bin/xfce4-session -- /usr/local/bin/Xorg :10" > ${diskfs}/xfce.sh
chmod +x ${diskfs}/xfce.sh
@ -190,12 +208,6 @@ if [ "${with_xfce}" = true ]; then
# 3. xfce4-session 需要 libuuid.so
fi
# 测试用户登陆模式: root/123456
if [ "${with_login}" = true ]; then
echo "${RED} ... with-login${NC}"
./mk_login.sh ${diskfs}
fi
# 我们测试驱动, 制作的镜像启动后,我们进入此目录 insmod hello_world.ko 即可
./mk_drv.sh $(pwd)/${diskfs}/lib/modules
# 编译网卡驱动 ( 目前版本内核已集成 e1000 )

View File

@ -47,6 +47,7 @@ EXPAT_SRC_URL=https://nchc.dl.sourceforge.net/project/expat/expat/2.4.9/expat-2.
LIBUDEV_SRC_URL=https://dev.gentoo.org/~blueness/eudev/eudev-3.2.9.tar.gz
LIBNETTLE_SRC_URL=https://ftp.gnu.org/gnu/nettle/nettle-3.8.1.tar.gz
LIBPCRE_SRC_URL=https://nchc.dl.sourceforge.net/project/pcre/pcre/8.39/pcre-8.39.tar.gz
LLVM_SRC_URL=https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/llvm-10.0.0.src.tar.xz
NCURSES_SRC_URL=https://invisible-island.net/datafiles/release/ncurses.tar.gz
XFCE_SRC_URL=https://archive.xfce.org/xfce/4.16/fat_tarballs/xfce-4.16.tar.bz2
@ -165,6 +166,7 @@ LIBPCRE_SRC_NAME=$(download_src ${LIBPCRE_SRC_URL})
LIBPCRE2_SRC_NAME=$(download_src ${LIBPCRE2_SRC_URL})
LIBNOTIFY_SRC_NAME=$(download_src ${LIBNOTIFY_SRC_URL})
GLIB_SRC_NAME=$(download_src ${GLIB_SRC_URL})
LLVM_SRC_NAME=$(download_src ${LLVM_SRC_URL})
EXPAT_SRC_NAME=$(download_src ${EXPAT_SRC_URL})
PIXMAN_SRC_NAME=$(download_src ${PIXMAN_SRC_URL})
FREETYPE_SRC_NAME=$(download_src ${FREETYPE_SRC_URL})
@ -294,6 +296,7 @@ LIBPCRE_SRC_DIR=$(unzip_src ".tar.gz" ${LIBPCRE_SRC_NAME}); echo "unzip ${LIBPCR
LIBPCRE2_SRC_DIR=$(unzip_src ".tar.gz" ${LIBPCRE2_SRC_NAME}); echo "unzip ${LIBPCRE2_SRC_NAME} source code"
LIBNOTIFY_SRC_DIR=$(unzip_src ".tar.xz" ${LIBNOTIFY_SRC_NAME}); echo "unzip ${LIBNOTIFY_SRC_NAME} source code"
GLIB_SRC_DIR=$(unzip_src ".tar.xz" ${GLIB_SRC_NAME}); echo "unzip ${GLIB_SRC_NAME} source code"
LLVM_SRC_DIR=$(unzip_src ".tar.xz" ${LLVM_SRC_NAME}); echo "unzip ${LLVM_SRC_NAME} source code"
EXPAT_SRC_DIR=$(unzip_src ".tar.xz" ${EXPAT_SRC_NAME}); echo "unzip ${EXPAT_SRC_NAME} source code"
PIXMAN_SRC_DIR=$(unzip_src ".tar.gz" ${PIXMAN_SRC_NAME}); echo "unzip ${PIXMAN_SRC_NAME} source code"
FREETYPE_SRC_DIR=$(unzip_src ".tar.xz" ${FREETYPE_SRC_NAME}); echo "unzip ${FREETYPE_SRC_NAME} source code"
@ -577,6 +580,27 @@ common_build() {
fi
}
#----------------------------------------------------------------------------------------------------------------
# llvm 编译
#----------------------------------------------------------------------------------------------------------------
llvm_build() {
local name=$1
local srcdir=$2
shift
shift
if [ ! -f .${name} ]; then
echo "${CYAN}build ${name} begin${NC}" && cd ${srcdir} && mkdir -pv build && cd build
if [ -f CMakeLists.txt ]; then
cmake . -DCMAKE_INSTALL_PREFIX=/usr
fi
if [ -f ./configure ]; then
./configure ${cfg_opt} "$@" ${xwin_opt}
fi
make -j8 && make install DESTDIR=${xfce_install} && echo "ok" > ../../.${name} || exit
cd ../.. && echo "${GREEN}build ${name} end${NC}"
fi
}
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# 编译 harfbuzz 遇到问题: linking of temporary binary failed关闭 glibc 的链接,问题就解决了,原因推测如下:
@ -709,6 +733,8 @@ common_build() {
meson_build pango ${PANGO_SRC_DIR}
# 编译基础库 ( 这些都是系统库,新系统需要集成 )
if [ "${with_xfce}" = true ] && [ "$1" = "img" ]; then
# 编译 llvm ( swrast 依赖此库 )
llvm_build llvm ${LLVM_SRC_DIR}
# 编译 expat
common_build expat ${EXPAT_SRC_DIR}
# 编译 libudev