diff --git a/README.md b/README.md index 34743a2..21ac3ea 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # 介绍与快速入门 > 本文档环境为 `ubuntu 20.04` -> -> 更多文档请前往 https://club.rt-thread.org/ask/article/1c95a3e1c58c0c25.html ## 介绍 @@ -38,19 +36,7 @@ xmake 是一个基于 Lua 的轻量级跨平台构建工具,使用 xmake.lua sudo apt install xmake ``` -3. **安装 qemu** - - userapps 已提供 qemu 7.1.0 的安装包,请自行下载 https://download-redirect.rt-thread.org/download/rt-smart/native/tools/qemu/qemu_7.1.0-2022111713_amd64.deb - - ```shell - sudo apt-get install -y libglib2.0-dev libpixman-1-dev - curl -L https://download-redirect.rt-thread.org/download/rt-smart/native/tools/qemu/qemu_7.1.0-2022111713_amd64.deb -o ./qemu.deb - sudo dpkg -i ./qemu.deb - ``` - - 如若想安装最新版本,请自行下载 qemu 源码进行编译安装 - -4. **编译** +3. **编译** 由于 smart 采用 xmake 编译用户态环境,因此 smart 的编译方式非常简单。 @@ -70,30 +56,19 @@ xmake 是一个基于 Lua 的轻量级跨平台构建工具,使用 xmake.lua ![image-20230531173059551](./assets/image-20230531173059551.png) + 支持的平台:arm、aarch64、riscv64gc。 + 5. **镜像制作** 运行 `xmake smart-rootfs` 制作 rootfs ,运行 `xmake smart-image` 制作镜像 ```shell xmake smart-rootfs - xmake smart-image -o ../prebuilt/qemu-virt64-aarch64/ext4.img # 将镜像输出至 qemu-virt64-aarch64 目录 + xmake smart-image -f ext4 #制作 ext4 镜像 ``` ![image-20230531173829621](./assets/image-20230531173829621.png) -6. **运行 qemu** - - 进入 `userapp/prebuilt/qemu-virt64-aarch64`,运行 qemu.sh 脚本启动 qemu - - ```shell - cd prebuilt/qemu-virt64-aarch64/ - ./run.sh - ``` - - ![image-20230531174321326](./assets/image-20230531174321326.png) - - 在 qemu 中 输入 `ctrl+a` 抬起后,再输入 `x` 即可退出 qemu - ## prebuilt 的版本 会在每天凌晨生成 aarch64/riscv64 for qemu 的 prebuilt 版本,包括内核和 rootfs 文件系统: diff --git a/apps/rt-tests/xmake.lua b/apps/rt-tests/xmake.lua new file mode 100644 index 0000000..bd26f90 --- /dev/null +++ b/apps/rt-tests/xmake.lua @@ -0,0 +1,33 @@ +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- You may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2022-2023 RT-Thread Development Team +-- +-- @author xqyjlj +-- @file xmake.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-06-21 xqyjlj initial version +-- + +add_rules("mode.debug", "mode.release") + +add_requires("rt-tests") + +target("rt-tests") +do + set_kind("phony") + add_packages("rt-tests") +end +target_end() diff --git a/assets/image-20230531174321326.png b/assets/image-20230531174321326.png deleted file mode 100644 index a44438b..0000000 Binary files a/assets/image-20230531174321326.png and /dev/null differ diff --git a/prebuilt/qemu-virt64-aarch64/ext4.img b/prebuilt/qemu-virt64-aarch64/ext4.img deleted file mode 100644 index 03e168d..0000000 Binary files a/prebuilt/qemu-virt64-aarch64/ext4.img and /dev/null differ diff --git a/prebuilt/qemu-virt64-aarch64/rtthread.bin b/prebuilt/qemu-virt64-aarch64/rtthread.bin deleted file mode 100755 index 9466317..0000000 Binary files a/prebuilt/qemu-virt64-aarch64/rtthread.bin and /dev/null differ diff --git a/prebuilt/qemu-virt64-aarch64/run.sh b/prebuilt/qemu-virt64-aarch64/run.sh deleted file mode 100755 index 980a451..0000000 --- a/prebuilt/qemu-virt64-aarch64/run.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# @author xqyjlj -# @file run.sh -# -# Change Logs: -# Date Author Notes -# ------------ ---------- ----------------------------------------------- -# 2023-01-12 xqyjlj initial version -# - -script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -qemu-system-aarch64 \ - -M virt,gic-version=2 \ - -cpu cortex-a53 \ - -m 128M \ - -kernel ${script_dir}/rtthread.bin \ - -nographic \ - -drive if=none,file=${script_dir}/ext4.img,format=raw,id=blk0 \ - -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \ - -netdev user,id=net0,hostfwd=tcp::8080-:80 \ - -device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 \ - -device virtio-serial-device \ - -chardev socket,host=127.0.0.1,port=43211,server=on,wait=off,telnet=on,id=console0 \ - -device virtserialport,chardev=console0 diff --git a/prebuilt/qemu-virt64-aarch64/run_debug.sh b/prebuilt/qemu-virt64-aarch64/run_debug.sh deleted file mode 100755 index 432e70e..0000000 --- a/prebuilt/qemu-virt64-aarch64/run_debug.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# @author xqyjlj -# @file run.sh -# -# Change Logs: -# Date Author Notes -# ------------ ---------- ----------------------------------------------- -# 2023-01-12 xqyjlj initial version -# - -script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -qemu-system-aarch64 \ - -M virt,gic-version=2 \ - -cpu cortex-a53 \ - -m 128M \ - -kernel ${script_dir}/rtthread.bin \ - -nographic \ - -drive if=none,file=${script_dir}/ext4.img,format=raw,id=blk0 \ - -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \ - -netdev user,id=net0,hostfwd=tcp::8080-:80 \ - -device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 \ - -device virtio-serial-device \ - -chardev socket,host=127.0.0.1,port=43211,server=on,wait=off,telnet=on,id=console0 \ - -device virtserialport,chardev=console0 \ - -S \ - -gdb tcp::1234 diff --git a/prebuilt/qemu-virt64-riscv/ext4.img b/prebuilt/qemu-virt64-riscv/ext4.img deleted file mode 100644 index f7356d1..0000000 Binary files a/prebuilt/qemu-virt64-riscv/ext4.img and /dev/null differ diff --git a/prebuilt/qemu-virt64-riscv/rtthread.bin b/prebuilt/qemu-virt64-riscv/rtthread.bin deleted file mode 100755 index c512f90..0000000 Binary files a/prebuilt/qemu-virt64-riscv/rtthread.bin and /dev/null differ diff --git a/prebuilt/qemu-virt64-riscv/run.sh b/prebuilt/qemu-virt64-riscv/run.sh deleted file mode 100755 index 1de4a9b..0000000 --- a/prebuilt/qemu-virt64-riscv/run.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# @author xqyjlj -# @file run.sh -# -# Change Logs: -# Date Author Notes -# ------------ ---------- ----------------------------------------------- -# 2023-01-12 xqyjlj initial version -# - -script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -qemu-system-riscv64 \ - -nographic \ - -machine virt \ - -m 256M \ - -kernel ${script_dir}/rtthread.bin \ - -drive if=none,file=${script_dir}/ext4.img,format=raw,id=blk0 \ - -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \ - -netdev user,id=tap0,hostfwd=tcp::8080-:80 \ - -device virtio-net-device,netdev=tap0,bus=virtio-mmio-bus.1 \ - -device virtio-serial-device \ - -chardev socket,host=127.0.0.1,port=43212,server=on,wait=off,telnet=on,id=console0 \ - -device virtserialport,chardev=console0 diff --git a/prebuilt/qemu-virt64-riscv/run_debug.sh b/prebuilt/qemu-virt64-riscv/run_debug.sh deleted file mode 100755 index 4dfcd0f..0000000 --- a/prebuilt/qemu-virt64-riscv/run_debug.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# @author xqyjlj -# @file run.sh -# -# Change Logs: -# Date Author Notes -# ------------ ---------- ----------------------------------------------- -# 2023-01-12 xqyjlj initial version -# - -script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -qemu-system-riscv64 \ - -nographic \ - -machine virt \ - -m 256M \ - -kernel ${script_dir}/rtthread.bin \ - -drive if=none,file=${script_dir}/ext4.img,format=raw,id=blk0 \ - -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \ - -netdev user,id=tap0,hostfwd=tcp::8080-:80 \ - -device virtio-net-device,netdev=tap0,bus=virtio-mmio-bus.1 \ - -device virtio-serial-device \ - -chardev socket,host=127.0.0.1,port=43212,server=on,wait=off,telnet=on,id=console0 \ - -device virtserialport,chardev=console0 \ - -S \ - -gdb tcp::1234 diff --git a/prebuilt/sha1sum.txt b/prebuilt/sha1sum.txt deleted file mode 100644 index 6e3b0e3..0000000 --- a/prebuilt/sha1sum.txt +++ /dev/null @@ -1 +0,0 @@ -https://github.com/RT-Thread/rt-thread: 3e4797c63c43384825d63166966289bb60b6be78 diff --git a/repo/packages/r/riscv64gc-unknown-smart-musl/xmake.lua b/repo/packages/r/riscv64gc-unknown-smart-musl/xmake.lua index a305c61..1d3b506 100644 --- a/repo/packages/r/riscv64gc-unknown-smart-musl/xmake.lua +++ b/repo/packages/r/riscv64gc-unknown-smart-musl/xmake.lua @@ -36,7 +36,7 @@ do if (version and sha256) then add_versions(version, sha256) else - add_versions("203957-8a397096c1", "0c4a43bc40ddee60774ce384d13760d235e51fd70658c5da0503caec1dd511e4") + add_versions("222725-8a397096c1", "488b1c8a5b82d94a57eff16c5ed705e91196eff4fda81ade9516da16241e007c") end elseif is_host("linux") then add_urls( @@ -45,7 +45,7 @@ do if (version and sha256) then add_versions(version, sha256) else - add_versions("203957-8a397096c1", "19d9a73b1dff1d941953fcb673443259d89362c2e56d1d260af0cc503d9e9f5b") + add_versions("222725-8a397096c1", "6d4b67648f8471910323a0fe39d8d4a58153a5d81ea24362a8cf48d4f1894181") end end diff --git a/repo/packages/r/rt-tests/patches/1.0/01_stable_v1.0.diff b/repo/packages/r/rt-tests/patches/1.0/01_stable_v1.0.diff new file mode 100644 index 0000000..7cd647a --- /dev/null +++ b/repo/packages/r/rt-tests/patches/1.0/01_stable_v1.0.diff @@ -0,0 +1,61 @@ +diff --git a/Makefile b/Makefile +index 5110357..569adc1 100644 +--- a/Makefile ++++ b/Makefile +@@ -172,6 +172,7 @@ install: all install_hwlatdetect + gzip -c src/cyclictest/cyclictest.8 >"$(DESTDIR)$(mandir)/man8/cyclictest.8.gz" + gzip -c src/pi_tests/pi_stress.8 >"$(DESTDIR)$(mandir)/man8/pi_stress.8.gz" + gzip -c src/ptsematest/ptsematest.8 >"$(DESTDIR)$(mandir)/man8/ptsematest.8.gz" ++ gzip -c src/rt-migrate-test/rt-migrate-test.8 >"$(DESTDIR)$(mandir)/man8/rt-migrate-test.8.gz" + gzip -c src/sigwaittest/sigwaittest.8 >"$(DESTDIR)$(mandir)/man8/sigwaittest.8.gz" + gzip -c src/svsematest/svsematest.8 >"$(DESTDIR)$(mandir)/man8/svsematest.8.gz" + gzip -c src/pmqtest/pmqtest.8 >"$(DESTDIR)$(mandir)/man8/pmqtest.8.gz" +diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c +index 00e5f3d..3f1bef1 100644 +--- a/src/cyclictest/cyclictest.c ++++ b/src/cyclictest/cyclictest.c +@@ -927,10 +927,14 @@ static int has_smi_counter(void) + case 0x56: /* BDX-DE */ + case 0x4E: /* SKL */ + case 0x5E: /* SKL */ ++ case 0x8E: /* KBL */ ++ case 0x9E: /* KBL */ ++ case 0x55: /* SKX */ + case 0x37: /* BYT */ + case 0x4D: /* AVN */ + case 0x4C: /* AMT */ + case 0x57: /* PHI */ ++ case 0x5C: /* BXT */ + break; + default: + return 0; +@@ -1684,7 +1688,6 @@ static void process_options (int argc, char *argv[], int max_cpus) + case 'R': + case OPT_RESOLUTION: + check_clock_resolution = 1; break; +- case 's': + case OPT_SECALIGNED: + secaligned = 1; + if (optarg != NULL) +@@ -1694,6 +1697,7 @@ static void process_options (int argc, char *argv[], int max_cpus) + else + offset = 0; + break; ++ case 's': + case OPT_SYSTEM: + use_system = MODE_SYS_OFFSET; break; + case 'S': +diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c +index d7b68dd..0a0bb77 100644 +--- a/src/rt-migrate-test/rt-migrate-test.c ++++ b/src/rt-migrate-test/rt-migrate-test.c +@@ -20,9 +20,6 @@ + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ +-#ifndef _GNU_SOURCE +-#define _GNU_SOURCE +-#endif + #include + #ifndef __USE_XOPEN2K + # define __USE_XOPEN2K diff --git a/repo/packages/r/rt-tests/patches/1.0/02_cyclictest_c.diff b/repo/packages/r/rt-tests/patches/1.0/02_cyclictest_c.diff new file mode 100644 index 0000000..80b0541 --- /dev/null +++ b/repo/packages/r/rt-tests/patches/1.0/02_cyclictest_c.diff @@ -0,0 +1,65 @@ +diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c +index 3f1bef1..dc33eca 100644 +--- a/src/cyclictest/cyclictest.c ++++ b/src/cyclictest/cyclictest.c +@@ -25,7 +25,6 @@ + #include + #include + #include +-#include + + #include + #include +@@ -56,7 +55,7 @@ + + /* Ugly, but .... */ + #define gettid() syscall(__NR_gettid) +-#define sigev_notify_thread_id _sigev_un._tid ++#define sigev_notify_thread_id __sev_fields.sigev_notify_thread_id + + #ifdef __UCLIBC__ + #define MAKE_PROCESS_CPUCLOCK(pid, clock) \ +@@ -1009,18 +1008,18 @@ static void *timerthread(void *param) + sigprocmask(SIG_BLOCK, &sigset, NULL); + + if (par->mode == MODE_CYCLIC) { +- sigev.sigev_notify = SIGEV_THREAD_ID | SIGEV_SIGNAL; ++ sigev.sigev_notify = 4 | SIGEV_SIGNAL; + sigev.sigev_signo = par->signal; +- sigev.sigev_notify_thread_id = stat->tid; ++ // sigev.sigev_notify_thread_id = stat->tid; + timer_create(par->clock, &sigev, &timer); + tspec.it_interval = interval; + } + + memset(&schedp, 0, sizeof(schedp)); + schedp.sched_priority = par->prio; +- if (setscheduler(0, par->policy, &schedp)) +- fatal("timerthread%d: failed to set priority to %d\n", +- par->cpu, par->prio); ++ if (setscheduler(0, par->policy, &schedp)) ++ fatal("timerthread%d: failed to set priority to %d\n", ++ par->cpu, par->prio); + + if(smi) { + par->msr_fd = open_msr_file(par->cpu); +@@ -1257,7 +1256,7 @@ out: + close(par->msr_fd); + /* switch to normal */ + schedp.sched_priority = 0; +- sched_setscheduler(0, SCHED_OTHER, &schedp); ++ // sched_setscheduler(0, SCHED_OTHER, &schedp); + stat->threadstarted = -1; + + return NULL; +@@ -2195,8 +2194,8 @@ int main(int argc, char **argv) + + process_options(argc, argv, max_cpus); + +- if (check_privs()) +- exit(EXIT_FAILURE); ++ // if (check_privs()) ++ // exit(EXIT_FAILURE); + + if (verbose) + printf("Max CPUs = %d\n", max_cpus); diff --git a/repo/packages/r/rt-tests/patches/1.0/03_Makefile.diff b/repo/packages/r/rt-tests/patches/1.0/03_Makefile.diff new file mode 100644 index 0000000..89a6a6c --- /dev/null +++ b/repo/packages/r/rt-tests/patches/1.0/03_Makefile.diff @@ -0,0 +1,22 @@ +diff --git a/Makefile b/Makefile +index 569adc1..3fae87e 100644 +--- a/Makefile ++++ b/Makefile +@@ -98,7 +98,7 @@ $(OBJDIR): + mkdir $(OBJDIR) + + # Include dependency files, automatically generate them if needed. +--include $(addprefix $(OBJDIR)/,$(sources:.c=.d)) ++# -include $(addprefix $(OBJDIR)/,$(sources:.c=.d)) + + cyclictest: $(OBJDIR)/cyclictest.o $(OBJDIR)/librttest.a + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(RTTESTLIB) $(NUMA_LIBS) +@@ -162,7 +162,7 @@ rebuild: + $(MAKE) all + + .PHONY: install +-install: all install_hwlatdetect ++install: install_hwlatdetect + mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(mandir)/man4" + mkdir -p "$(DESTDIR)$(srcdir)" "$(DESTDIR)$(mandir)/man8" + cp $(TARGETS) "$(DESTDIR)$(bindir)" diff --git a/repo/packages/r/rt-tests/patches/1.0/04_cyclictest_signed.diff b/repo/packages/r/rt-tests/patches/1.0/04_cyclictest_signed.diff new file mode 100644 index 0000000..c5d4e22 --- /dev/null +++ b/repo/packages/r/rt-tests/patches/1.0/04_cyclictest_signed.diff @@ -0,0 +1,33 @@ +diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c +index dc33eca..1129c87 100644 +--- a/src/cyclictest/cyclictest.c ++++ b/src/cyclictest/cyclictest.c +@@ -154,8 +154,8 @@ struct thread_param { + + /* Struct for statistics */ + struct thread_stat { +- unsigned long cycles; +- unsigned long cyclesread; ++ long cycles; ++ long cyclesread; + long min; + long max; + long act; +@@ -172,7 +172,7 @@ struct thread_stat { + long cycleofmax; + long hist_overflow; + long num_outliers; +- unsigned long smi_count; ++ long smi_count; + }; + + static pthread_mutex_t trigger_lock = PTHREAD_MUTEX_INITIALIZER; +@@ -1088,7 +1088,7 @@ static void *timerthread(void *param) + + while (!shutdown) { + +- uint64_t diff; ++ int64_t diff; + unsigned long diff_smi = 0; + int sigs, ret; + diff --git a/repo/packages/r/rt-tests/patches/1.0/05_fix_high_resolution_timers_check.diff b/repo/packages/r/rt-tests/patches/1.0/05_fix_high_resolution_timers_check.diff new file mode 100644 index 0000000..47f7951 --- /dev/null +++ b/repo/packages/r/rt-tests/patches/1.0/05_fix_high_resolution_timers_check.diff @@ -0,0 +1,13 @@ +diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c +index 1129c87..a648246 100644 +--- a/src/cyclictest/cyclictest.c ++++ b/src/cyclictest/cyclictest.c +@@ -1917,7 +1917,7 @@ static int check_timer(void) + if (clock_getres(CLOCK_MONOTONIC, &ts)) + return 1; + +- return (ts.tv_sec != 0 || ts.tv_nsec != 1); ++ return (ts.tv_sec != 0 || ts.tv_nsec == 0); + } + + static void sighand(int sig) diff --git a/repo/packages/r/rt-tests/scripts/deploy.lua b/repo/packages/r/rt-tests/scripts/deploy.lua new file mode 100644 index 0000000..71eea69 --- /dev/null +++ b/repo/packages/r/rt-tests/scripts/deploy.lua @@ -0,0 +1,35 @@ +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- You may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2023-2023 RT-Thread Development Team +-- +-- @author xqyjlj +-- @file deploy.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-05-11 xqyjlj initial version +-- +import("rt.rt_utils") + +function main(rootfs, installdir) + for _, filepath in ipairs(os.files(path.join(installdir, "bin") .. "/*")) do + local filename = path.filename(filepath) + rt_utils.cp_with_symlink(filepath, path.join(rootfs, "bin", filename)) + end + + for _, filepath in ipairs(os.files(path.join(installdir, "sbin") .. "/*")) do + local filename = path.filename(filepath) + rt_utils.cp_with_symlink(filepath, path.join(rootfs, "sbin", filename)) + end +end diff --git a/repo/packages/r/rt-tests/xmake.lua b/repo/packages/r/rt-tests/xmake.lua new file mode 100644 index 0000000..0db98ee --- /dev/null +++ b/repo/packages/r/rt-tests/xmake.lua @@ -0,0 +1,81 @@ +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- You may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2023-2023 RT-Thread Development Team +-- +-- @author xqyjlj +-- @file xmake.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-04-17 xqyjlj initial version +-- +package("rt-tests") +do + set_homepage("https://wiki.linuxfoundation.org/realtime/documentation/howto/tools/rt-tests") + set_description("suite of real-time tests") + + add_urls("https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/snapshot/rt-tests-$(version).tar.gz") + + add_versions("1.0", "c543672cdeeb9033284b55ea64a7c7c7c385949646332dfbdd295cbedbf610b8") + + add_patches("1.0", path.join(os.scriptdir(), "patches", "1.0", "01_stable_v1.0.diff"), + "45068026d52fb21a3ed205255f3da563e64a4ebacca8cb692612b3769bfafc0c") + add_patches("1.0", path.join(os.scriptdir(), "patches", "1.0", "02_cyclictest_c.diff"), + "5bac2ea74f34bd986ab69a1ef8c4a0f3df99c166369bcb919e98b8a830742b59") + add_patches("1.0", path.join(os.scriptdir(), "patches", "1.0", "03_Makefile.diff"), + "1ecdb0083170492118da7d98fb2cbebde80d3e1f9f92f0fcb5e577cdf1f03c47") + add_patches("1.0", path.join(os.scriptdir(), "patches", "1.0", "04_cyclictest_signed.diff"), + "70c5730323fe17219b5953e0c7fb6ed6de0c306fd4e1efabc39ca3dd6ed01780") + add_patches("1.0", path.join(os.scriptdir(), "patches", "1.0", "05_fix_high_resolution_timers_check.diff"), + "deae130cd138ce85f3554821754c36bc624105224045e6c85231cde92163a026") + + add_configs("shared", { + description = "Build shared library.", + default = os.getenv("RT_XMAKE_LINK_TYPE") ~= "static", + type = "boolean" + }) + add_configs("cyclictest", {description = "high resolution test program", default = true, type = "boolean"}) + + on_install("cross@linux", function(package) + import("rt.private.build.rtflags") + local info = rtflags.get_package_info(package) + local host = info.host + local cc = info.cc + local ldflags = {} + local configs = {} + os.setenv("PATH", path.directory(cc) .. ":" .. os.getenv("PATH")) + + local buildenvs = import("package.tools.autoconf").buildenvs(package, {ldflags = ldflags}) + buildenvs["prefix"] = package:installdir() + if package:config("cyclictest") then + table.insert(configs, "cyclictest") + end + if package:config("debug") then + table.insert(configs, "DEBUG=1") + end + + import("package.tools.make").build(package, configs, {envs = buildenvs}) + + if package:config("cyclictest") then + os.vcp("cyclictest", package:installdir("bin")) + os.vcp("src/cyclictest/cyclictest.8", package:installdir("share/man")) + end + end) + + on_test(function(package) + if package:config("cyclictest") then + assert(os.isfile(path.join(package:installdir("bin"), "cyclictest"))) + end + end) +end diff --git a/repo/packages/s/sdl2_image/xmake.lua b/repo/packages/s/sdl2_image/xmake.lua index b78035c..19b2a82 100644 --- a/repo/packages/s/sdl2_image/xmake.lua +++ b/repo/packages/s/sdl2_image/xmake.lua @@ -35,11 +35,38 @@ do type = "boolean" }) + local features = { + bmp = {boolean = true, package = nil}, + gif = {boolean = false, package = "unsupport!!!"}, + jpg = {boolean = true, package = "libjpeg"}, + lbm = {boolean = false, package = "unsupport!!!"}, + pcx = {boolean = false, package = "unsupport!!!"}, + png = {boolean = true, package = "libpng"}, + pnm = {boolean = false, package = "unsupport!!!"}, + svg = {boolean = false, package = "unsupport!!!"}, + tga = {boolean = false, package = "unsupport!!!"}, + tif = {boolean = false, package = "unsupport!!!"}, + xcf = {boolean = false, package = "unsupport!!!"}, + xpm = {boolean = false, package = "unsupport!!!"}, + xv = {boolean = false, package = "unsupport!!!"}, + webp = {boolean = false, package = "unsupport!!!"} + } + + for feature, cfg in pairs(features) do + add_configs(feature, + {description = "enable " .. feature .. " support.", default = cfg.boolean, type = "boolean"}) + end + on_load(function(package) package:add("deps", "zlib", {debug = package:config("debug"), configs = {shared = package:config("shared")}}) - package:add("deps", "libpng", {debug = package:config("debug"), configs = {shared = package:config("shared")}}) - package:add("deps", "libjpeg", {debug = package:config("debug"), configs = {shared = package:config("shared")}}) package:add("deps", "sdl2", {debug = package:config("debug"), configs = {shared = package:config("shared")}}) + for feature, cfg in pairs(features) do + if package:config(feature) and cfg.package then + package:add("deps", cfg.package, + {debug = package:config("debug"), configs = {shared = package:config("shared")}}) + end + end + end) on_install("cross@linux", function(package) @@ -51,6 +78,7 @@ do local ldflags = {} os.setenv("PATH", path.directory(cc) .. ":" .. os.getenv("PATH")) local sdl2 = package:dep("sdl2") + local packagedeps = {"sdl2", "zlib"} if package:config("shared") then table.insert(configs, "--enable-shared=yes") @@ -60,12 +88,23 @@ do table.insert(configs, "--enable-static=yes") end + table.insert(configs, "--enable-jpg-shared=no") + table.insert(configs, "--enable-png-shared=no") + table.insert(configs, "--enable-tif-shared=no") + table.insert(configs, "--enable-webp-shared=no") + + for feature, cfg in pairs(features) do + if package:config(feature) and cfg.package then + table.insert(packagedeps, cfg.package) + end + table.insert(configs, string.format("--enable-%s=%s", feature, package:config(feature) and "yes" or "no")) + end + table.insert(configs, "--build=i686-pc-linux-gnu") table.insert(configs, "--with-sdl-prefix=" .. sdl2:installdir()) - local buildenvs = import("package.tools.autoconf").buildenvs(package, { - ldflags = ldflags, - packagedeps = {"libpng", "libjpeg", "sdl2", "zlib"} - }) + + local buildenvs = import("package.tools.autoconf").buildenvs(package, + {ldflags = ldflags, packagedeps = packagedeps}) -- os.vrun("autoreconf -fiv || true", {envs = buildenvs}) import("package.tools.autoconf").configure(package, configs, {envs = buildenvs}) import("package.tools.make").install(package, {}, {envs = buildenvs})