|
| 1 | +-- Licensed under the Apache License, Version 2.0 (the "License"); |
| 2 | +-- You may not use this file except in compliance with the License. |
| 3 | +-- You may obtain a copy of the License at |
| 4 | +-- |
| 5 | +-- http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | +-- |
| 7 | +-- Unless required by applicable law or agreed to in writing, software |
| 8 | +-- distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | +-- See the License for the specific language governing permissions and |
| 11 | +-- limitations under the License. |
| 12 | +-- |
| 13 | +-- Copyright (C) 2023-2023 RT-Thread Development Team |
| 14 | +-- |
| 15 | +-- @author xqyjlj |
| 16 | +-- @file xmake.lua |
| 17 | +-- |
| 18 | +-- Change Logs: |
| 19 | +-- Date Author Notes |
| 20 | +-- ------------ ---------- ----------------------------------------------- |
| 21 | +-- 2023-04-17 xqyjlj initial version |
| 22 | +-- |
| 23 | +package("rt-tests") |
| 24 | +do |
| 25 | + set_homepage("https://wiki.linuxfoundation.org/realtime/documentation/howto/tools/rt-tests") |
| 26 | + set_description("suite of real-time tests") |
| 27 | + |
| 28 | + add_urls("https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git/snapshot/rt-tests-$(version).tar.gz") |
| 29 | + |
| 30 | + add_versions("1.0", "c543672cdeeb9033284b55ea64a7c7c7c385949646332dfbdd295cbedbf610b8") |
| 31 | + |
| 32 | + add_patches("1.0", path.join(os.scriptdir(), "patches", "1.0", "01_stable_v1.0.diff"), |
| 33 | + "45068026d52fb21a3ed205255f3da563e64a4ebacca8cb692612b3769bfafc0c") |
| 34 | + add_patches("1.0", path.join(os.scriptdir(), "patches", "1.0", "02_cyclictest_c.diff"), |
| 35 | + "5bac2ea74f34bd986ab69a1ef8c4a0f3df99c166369bcb919e98b8a830742b59") |
| 36 | + add_patches("1.0", path.join(os.scriptdir(), "patches", "1.0", "03_Makefile.diff"), |
| 37 | + "1ecdb0083170492118da7d98fb2cbebde80d3e1f9f92f0fcb5e577cdf1f03c47") |
| 38 | + add_patches("1.0", path.join(os.scriptdir(), "patches", "1.0", "04_cyclictest_signed.diff"), |
| 39 | + "70c5730323fe17219b5953e0c7fb6ed6de0c306fd4e1efabc39ca3dd6ed01780") |
| 40 | + add_patches("1.0", path.join(os.scriptdir(), "patches", "1.0", "05_fix_high_resolution_timers_check.diff"), |
| 41 | + "deae130cd138ce85f3554821754c36bc624105224045e6c85231cde92163a026") |
| 42 | + |
| 43 | + add_configs("shared", { |
| 44 | + description = "Build shared library.", |
| 45 | + default = os.getenv("RT_XMAKE_LINK_TYPE") ~= "static", |
| 46 | + type = "boolean" |
| 47 | + }) |
| 48 | + add_configs("cyclictest", {description = "high resolution test program", default = true, type = "boolean"}) |
| 49 | + |
| 50 | + on_install("cross@linux", function(package) |
| 51 | + import("rt.private.build.rtflags") |
| 52 | + local info = rtflags.get_package_info(package) |
| 53 | + local host = info.host |
| 54 | + local cc = info.cc |
| 55 | + local ldflags = {} |
| 56 | + local configs = {} |
| 57 | + os.setenv("PATH", path.directory(cc) .. ":" .. os.getenv("PATH")) |
| 58 | + |
| 59 | + local buildenvs = import("package.tools.autoconf").buildenvs(package, {ldflags = ldflags}) |
| 60 | + buildenvs["prefix"] = package:installdir() |
| 61 | + if package:config("cyclictest") then |
| 62 | + table.insert(configs, "cyclictest") |
| 63 | + end |
| 64 | + if package:config("debug") then |
| 65 | + table.insert(configs, "DEBUG=1") |
| 66 | + end |
| 67 | + |
| 68 | + import("package.tools.make").build(package, configs, {envs = buildenvs}) |
| 69 | + |
| 70 | + if package:config("cyclictest") then |
| 71 | + os.vcp("cyclictest", package:installdir("bin")) |
| 72 | + os.vcp("src/cyclictest/cyclictest.8", package:installdir("share/man")) |
| 73 | + end |
| 74 | + end) |
| 75 | + |
| 76 | + on_test(function(package) |
| 77 | + if package:config("cyclictest") then |
| 78 | + assert(os.isfile(path.join(package:installdir("bin"), "cyclictest"))) |
| 79 | + end |
| 80 | + end) |
| 81 | +end |
0 commit comments