diff --git a/apps/ffmpeg/xmake.lua b/apps/ffmpeg/xmake.lua new file mode 100644 index 0000000..78dec54 --- /dev/null +++ b/apps/ffmpeg/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 zbtrs +-- @file xmake.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-08-09 zbtrs initial version +-- + +add_rules("mode.debug", "mode.release") + +add_requires("ffmpeg") + +target("ffmpeg") +do + set_kind("phony") + add_packages("ffmpeg") +end +target_end() diff --git a/apps/player/main.c b/apps/player/main.c new file mode 100644 index 0000000..d138a74 --- /dev/null +++ b/apps/player/main.c @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2006-2020, RT-Thread Development Team + * + * SPDX-License-Identifier: GPL-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-9-14 zbtrs The first version + */ + + +#include +#include +#include +#include +#include +#include +#include + +#define rtt_screen_width 480 +#define rtt_screen_height 272 + + +int main (int argc, char *argv[]) +{ + int ret = -1; + AVFormatContext *pFormatCtx = NULL; + int videoStream; + AVCodecParameters *pCodecParameters = NULL; + AVCodecContext *pCodecCtx = NULL; + AVCodec *pCodec = NULL; + AVFrame *pFrame = NULL; + AVPacket packet; + + + SDL_Rect rect; + SDL_Window *win = NULL; + SDL_Renderer *renderer = NULL; + SDL_Texture *texture = NULL; + + if(( argc != 2 )) + { + printf("error input arguments!\n"); + return(1); + } + + // 默认窗口大小 + int w_width = rtt_screen_width; + int w_height = rtt_screen_height; + + // use dummy video driver + SDL_setenv("SDL_VIDEODRIVER","rtt",1); + //Initialize SDL + if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) + { + printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); + return -1; + } + + // 打开输入文件 + if (avformat_open_input(&pFormatCtx, argv[1], NULL, NULL) != 0) + { + printf("Couldn't open video file!: %s\n", argv[1]); + goto __exit; + } + + // 找到视频流 + videoStream = av_find_best_stream(pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0); + if (videoStream == -1) + { + printf("Din't find a video stream!\n"); + goto __exit;// Didn't find a video stream + } + + // 流参数 + pCodecParameters = pFormatCtx->streams[videoStream]->codecpar; + + // 获取解码器 + pCodec = avcodec_find_decoder(pCodecParameters->codec_id); + if (pCodec == NULL) + { + printf("Unsupported codec!\n"); + goto __exit; // Codec not found + } + + // 初始化一个编解码上下文 + pCodecCtx = avcodec_alloc_context3(pCodec); + if (avcodec_parameters_to_context(pCodecCtx, pCodecParameters) != 0) + { + printf("Couldn't copy codec context\n"); + goto __exit;// Error copying codec context + } + + // 打开解码器 + if (avcodec_open2(pCodecCtx, pCodec, NULL) < 0) + { + printf("Failed to open decoder!\n"); + goto __exit; // Could not open codec + } + + // Allocate video frame + pFrame = av_frame_alloc(); + if (NULL == pFrame) { + printf("av_frame_alloc error\n"); + goto __exit; + } + + w_width = pCodecCtx->width; + w_height = pCodecCtx->height; + + // 创建窗口 + win = SDL_CreateWindow("Media Player", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + w_width, w_height, + SDL_WINDOW_SHOWN ); + if (!win) + { + printf("Failed to create window by SDL\n"); + goto __exit; + } + + // 创建渲染器 + renderer = SDL_CreateRenderer(win, -1, 0); + if (!renderer) + { + printf("Failed to create Renderer by SDL\n"); + goto __exit; + } + + // 创建纹理 + texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_IYUV, + SDL_TEXTUREACCESS_STREAMING, + w_width, + w_height); + if (!texture) { + printf("SDL_CreateTexture Error: %s\n",SDL_GetError()); + goto __exit; + } + + int receive_frame_ret = 0; + + // 读取数据 + while (av_read_frame(pFormatCtx, &packet) >= 0) + { + if (packet.stream_index == videoStream) + { + // 解码 + avcodec_send_packet(pCodecCtx, &packet); + while (receive_frame_ret = avcodec_receive_frame(pCodecCtx, pFrame) == 0) + { + if (receive_frame_ret < 0) { + printf("avcodec_receive_frame error: %d\n",receive_frame_ret); + goto __exit; + } + SDL_UpdateYUVTexture(texture, NULL, + pFrame->data[0], pFrame->linesize[0], + pFrame->data[1], pFrame->linesize[1], + pFrame->data[2], pFrame->linesize[2]); + + // set size of Window + rect.x = 0; + rect.y = 0; + rect.w = pCodecCtx->width; + rect.h = pCodecCtx->height; + + SDL_RenderClear(renderer); + SDL_RenderCopy(renderer, texture, NULL, &rect); + SDL_RenderPresent(renderer); + } + } + + av_packet_unref(&packet); + } + + __exit: + + if (pFrame) + { + av_frame_free(&pFrame); + } + + if (pCodecCtx) + { + avcodec_close(pCodecCtx); + } + + if (pCodecParameters) + { + avcodec_parameters_free(&pCodecParameters); + } + + if (pFormatCtx) + { + avformat_close_input(&pFormatCtx); + } + + if (win) + { + SDL_DestroyWindow(win); + } + + if (renderer) + { + SDL_DestroyRenderer(renderer); + } + + if (texture) + { + SDL_DestroyTexture(texture); + } + + SDL_Quit(); + + return ret; +} \ No newline at end of file diff --git a/apps/player/xmake.lua b/apps/player/xmake.lua new file mode 100644 index 0000000..0f3953b --- /dev/null +++ b/apps/player/xmake.lua @@ -0,0 +1,14 @@ +add_rules("mode.debug", "mode.release") + +add_requires("sdl2") +add_requires("sdl2_image") +add_requires("ffmpeg") + +target("player") +do + add_files("*.c") + add_packages("sdl2") + add_packages("sdl2_image") + add_packages("ffmpeg") +end +target_end() diff --git a/repo/packages/d/dropbear/patches/2022.83/01_adapt_smart.diff b/repo/packages/d/dropbear/patches/2022.83/01_adapt_smart.diff new file mode 100644 index 0000000..d1e3dd5 --- /dev/null +++ b/repo/packages/d/dropbear/patches/2022.83/01_adapt_smart.diff @@ -0,0 +1,302 @@ +diff --git a/common-session.c b/common-session.c +index 5fb33a6..1dd6a0d 100644 +--- a/common-session.c ++++ b/common-session.c +@@ -332,7 +332,7 @@ void session_cleanup() { + #endif + + m_free(ses.remoteident); +- m_free(ses.authstate.pw_dir); ++ // m_free(ses.authstate.pw_dir); + m_free(ses.authstate.pw_name); + m_free(ses.authstate.pw_shell); + m_free(ses.authstate.pw_passwd); +@@ -610,11 +610,12 @@ static long select_timeout() { + + const char* get_user_shell() { + /* an empty shell should be interpreted as "/bin/sh" */ +- if (ses.authstate.pw_shell[0] == '\0') { +- return "/bin/sh"; +- } else { +- return ses.authstate.pw_shell; +- } ++ // if (ses.authstate.pw_shell[0] == '\0') { ++ // return "/bin/sh"; ++ // } else { ++ // return ses.authstate.pw_shell; ++ // } ++ return "/bin/ash"; + } + void fill_passwd(const char* username) { + struct passwd *pw = NULL; +diff --git a/default_options.h b/default_options.h +index 5132775..bf9b551 100644 +--- a/default_options.h ++++ b/default_options.h +@@ -37,14 +37,14 @@ IMPORTANT: Some options will require "make clean" after changes */ + * Both of these flags can be defined at once, don't compile without at least + * one of them. */ + #define NON_INETD_MODE 1 +-#define INETD_MODE 1 ++#define INETD_MODE 0 + + /* By default Dropbear will re-execute itself for each incoming connection so + that memory layout may be re-randomised (ASLR) - exploiting + vulnerabilities becomes harder. Re-exec causes slightly more memory use + per connection. + This option is ignored on non-Linux platforms at present */ +-#define DROPBEAR_REEXEC 1 ++#define DROPBEAR_REEXEC 0 + + /* Include verbose debug output, enabled with -v at runtime (repeat to increase). + * define which level of debug output you compile in +@@ -218,6 +218,7 @@ group1 in Dropbear server too */ + #define DO_HOST_LOOKUP 0 + + /* Whether to print the message of the day (MOTD). */ ++ + #define DO_MOTD 1 + #define MOTD_FILENAME "/etc/motd" + +diff --git a/gensignkey.c b/gensignkey.c +index cfe0a80..9474933 100644 +--- a/gensignkey.c ++++ b/gensignkey.c +@@ -161,15 +161,15 @@ int signkey_generate(enum signkey_type keytype, int bits, const char* filename, + /* If generating keys on connection (skipexist) it's OK to get EEXIST + - we probably just lost a race with another connection to generate the key */ + if (!(skip_exist && errno == EEXIST)) { +- if (errno == EPERM || errno == EACCES) { ++ // if (errno == EPERM || errno == EACCES) { + /* Non-atomic fallback when hard-links not allowed or unsupported */ + buf_setpos(buf, 0); + ret = buf_writefile(buf, filename, skip_exist); +- } else { +- dropbear_log(LOG_ERR, "Failed moving key file to %s: %s", filename, +- strerror(errno)); +- ret = DROPBEAR_FAILURE; +- } ++ // } else { ++ // dropbear_log(LOG_ERR, "Failed moving key file to %s: %s", filename, ++ // strerror(errno)); ++ // ret = DROPBEAR_FAILURE; ++ // } + + goto out; + } +diff --git a/sshpty.c b/sshpty.c +index fceb7fd..202a009 100644 +--- a/sshpty.c ++++ b/sshpty.c +@@ -59,7 +59,7 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) + "pty_allocate: openpty: %.100s", strerror(errno)); + return 0; + } +- name = ttyname(*ttyfd); ++ name = ptsname(*ptyfd); + if (!name) { + dropbear_exit("ttyname fails for openpty device"); + } +@@ -357,18 +357,18 @@ pty_setowner(struct passwd *pw, const char *tty_name) + { + struct group *grp; + gid_t gid; +- mode_t mode; ++ mode_t mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH; + struct stat st; + + /* Determine the group to make the owner of the tty. */ +- grp = getgrnam("tty"); +- if (grp) { +- gid = grp->gr_gid; +- mode = S_IRUSR | S_IWUSR | S_IWGRP; +- } else { +- gid = pw->pw_gid; +- mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH; +- } ++ // grp = getgrnam("tty"); ++ // if (grp) { ++ // gid = grp->gr_gid; ++ // mode = S_IRUSR | S_IWUSR | S_IWGRP; ++ // } else { ++ // gid = pw->pw_gid; ++ // mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH; ++ // } + + /* + * Change owner and mode of the tty as required. +@@ -380,21 +380,21 @@ pty_setowner(struct passwd *pw, const char *tty_name) + tty_name, strerror(errno)); + } + +- if (st.st_uid != pw->pw_uid || st.st_gid != gid) { +- if (chown(tty_name, pw->pw_uid, gid) < 0) { +- if (errno == EROFS && +- (st.st_uid == pw->pw_uid || st.st_uid == 0)) { +- dropbear_log(LOG_ERR, +- "chown(%.100s, %u, %u) failed: %.100s", +- tty_name, (unsigned int)pw->pw_uid, (unsigned int)gid, +- strerror(errno)); +- } else { +- dropbear_exit("chown(%.100s, %u, %u) failed: %.100s", +- tty_name, (unsigned int)pw->pw_uid, (unsigned int)gid, +- strerror(errno)); +- } +- } +- } ++ // if (st.st_uid != pw->pw_uid || st.st_gid != gid) { ++ // if (chown(tty_name, pw->pw_uid, gid) < 0) { ++ // if (errno == EROFS && ++ // (st.st_uid == pw->pw_uid || st.st_uid == 0)) { ++ // dropbear_log(LOG_ERR, ++ // "chown(%.100s, %u, %u) failed: %.100s", ++ // tty_name, (unsigned int)pw->pw_uid, (unsigned int)gid, ++ // strerror(errno)); ++ // } else { ++ // dropbear_exit("chown(%.100s, %u, %u) failed: %.100s", ++ // tty_name, (unsigned int)pw->pw_uid, (unsigned int)gid, ++ // strerror(errno)); ++ // } ++ // } ++ // } + + if ((st.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO)) != mode) { + if (chmod(tty_name, mode) < 0) { +diff --git a/svr-auth.c b/svr-auth.c +index 05ac6a9..e13ef40 100644 +--- a/svr-auth.c ++++ b/svr-auth.c +@@ -114,7 +114,11 @@ void recv_msg_userauth_request() { + * the 'incrfail' varies depending on the auth method to + * avoid giving away which users exist on the system through + * the time delay. */ +- if (checkusername(username, userlen) == DROPBEAR_SUCCESS) { ++ ++ ++ if (strncmp("root",username,4) == 0) { ++ valid_user = 1; ++ } else if (checkusername(username, userlen) == DROPBEAR_SUCCESS) { + valid_user = 1; + } + +diff --git a/svr-authpubkey.c b/svr-authpubkey.c +index 5d298cb..1fecd7d 100644 +--- a/svr-authpubkey.c ++++ b/svr-authpubkey.c +@@ -449,39 +449,38 @@ static int checkpubkey(const char* keyalgo, unsigned int keyalgolen, + + TRACE(("enter checkpubkey")) + +-#if DROPBEAR_SVR_MULTIUSER +- /* access the file as the authenticating user. */ +- origuid = getuid(); +- origgid = getgid(); +- if ((setegid(ses.authstate.pw_gid)) < 0 || +- (seteuid(ses.authstate.pw_uid)) < 0) { +- dropbear_exit("Failed to set euid"); +- } +-#endif ++// #if DROPBEAR_SVR_MULTIUSER ++// /* access the file as the authenticating user. */ ++// origuid = getuid(); ++// origgid = getgid(); ++// if ((setegid(ses.authstate.pw_gid)) < 0 || ++// (seteuid(ses.authstate.pw_uid)) < 0) { ++// dropbear_exit("Failed to set euid"); ++// } ++// #endif + /* check file permissions, also whether file exists */ +- if (checkpubkeyperms() == DROPBEAR_FAILURE) { +- TRACE(("bad authorized_keys permissions, or file doesn't exist")) +- } else { ++ // if (checkpubkeyperms() == DROPBEAR_FAILURE) { ++ // TRACE(("bad authorized_keys permissions, or file doesn't exist")) ++ // } else { + /* we don't need to check pw and pw_dir for validity, since + * its been done in checkpubkeyperms. */ +- len = strlen(ses.authstate.pw_dir); ++ // len = strlen(ses.authstate.pw_dir); + /* allocate max required pathname storage, + * = path + "/.ssh/authorized_keys" + '\0' = pathlen + 22 */ +- filename = m_malloc(len + 22); +- snprintf(filename, len + 22, "%s/.ssh/authorized_keys", +- ses.authstate.pw_dir); ++ filename = m_malloc(22); ++ snprintf(filename, 22, "/.ssh/authorized_keys"); + + authfile = fopen(filename, "r"); + if (!authfile) { + TRACE(("checkpubkey: failed opening %s: %s", filename, strerror(errno))) + } +- } +-#if DROPBEAR_SVR_MULTIUSER +- if ((seteuid(origuid)) < 0 || +- (setegid(origgid)) < 0) { +- dropbear_exit("Failed to revert euid"); +- } +-#endif ++ // } ++// #if DROPBEAR_SVR_MULTIUSER ++// if ((seteuid(origuid)) < 0 || ++// (setegid(origgid)) < 0) { ++// dropbear_exit("Failed to revert euid"); ++// } ++// #endif + + if (authfile == NULL) { + goto out; +diff --git a/svr-chansession.c b/svr-chansession.c +index 656a968..56e5474 100644 +--- a/svr-chansession.c ++++ b/svr-chansession.c +@@ -611,10 +611,11 @@ static int sessionpty(struct ChanSess * chansess) { + dropbear_exit("Out of memory"); /* TODO disconnect */ + } + ++ ses.authstate.pw_name = "root"; + pw = getpwnam(ses.authstate.pw_name); +- if (!pw) +- dropbear_exit("getpwnam failed after succeeding previously"); +- pty_setowner(pw, chansess->tty); ++ // if (!pw) ++ // dropbear_exit("getpwnam failed after succeeding previously"); ++ // pty_setowner(pw, chansess->tty); + + /* Set up the rows/col counts */ + sessionwinchange(chansess); +@@ -867,10 +868,10 @@ static int ptycommand(struct Channel *channel, struct ChanSess *chansess) { + /* don't show the motd if ~/.hushlogin exists */ + + /* 12 == strlen("/.hushlogin\0") */ +- len = strlen(ses.authstate.pw_dir) + 12; ++ len = 12; + + hushpath = m_malloc(len); +- snprintf(hushpath, len, "%s/.hushlogin", ses.authstate.pw_dir); ++ snprintf(hushpath, len, "/.hushlogin"); + + if (stat(hushpath, &sb) < 0) { + char *expand_path = NULL; +@@ -983,8 +984,8 @@ static void execchild(const void *user_data) { + + #if DROPBEAR_SVR_MULTIUSER + /* We can only change uid/gid as root ... */ +- if (getuid() == 0) { +- ++ // if (getuid() == 0) { ++ if (0) { + if ((setgid(ses.authstate.pw_gid) < 0) || + (initgroups(ses.authstate.pw_name, + ses.authstate.pw_gid) < 0)) { +@@ -1008,8 +1009,9 @@ static void execchild(const void *user_data) { + #endif + + /* set env vars */ +- addnewvar("USER", ses.authstate.pw_name); +- addnewvar("LOGNAME", ses.authstate.pw_name); ++ ses.authstate.pw_dir = ""; ++ addnewvar("USER", "root"); ++ addnewvar("LOGNAME", "root"); + addnewvar("HOME", ses.authstate.pw_dir); + addnewvar("SHELL", get_user_shell()); + if (getuid() == 0) { diff --git a/repo/packages/d/dropbear/patches/2022.83/02_adapt_user.diff b/repo/packages/d/dropbear/patches/2022.83/02_adapt_user.diff new file mode 100644 index 0000000..c258972 --- /dev/null +++ b/repo/packages/d/dropbear/patches/2022.83/02_adapt_user.diff @@ -0,0 +1,16 @@ +diff --git a/svr-chansession.c b/svr-chansession.c +index 56e5474..4257f68 100644 +--- a/svr-chansession.c ++++ b/svr-chansession.c +@@ -1010,8 +1010,9 @@ static void execchild(const void *user_data) { + + /* set env vars */ + ses.authstate.pw_dir = ""; +- addnewvar("USER", "root"); +- addnewvar("LOGNAME", "root"); ++ ses.authstate.pw_name = "root"; ++ addnewvar("USER", ses.authstate.pw_name); ++ addnewvar("LOGNAME", ses.authstate.pw_name); + addnewvar("HOME", ses.authstate.pw_dir); + addnewvar("SHELL", get_user_shell()); + if (getuid() == 0) { diff --git a/repo/packages/d/dropbear/patches/2022.83/03_fix_memory.diff b/repo/packages/d/dropbear/patches/2022.83/03_fix_memory.diff new file mode 100644 index 0000000..1b1961e --- /dev/null +++ b/repo/packages/d/dropbear/patches/2022.83/03_fix_memory.diff @@ -0,0 +1,43 @@ +diff --git a/common-session.c b/common-session.c +index 1dd6a0d..3755cc4 100644 +--- a/common-session.c ++++ b/common-session.c +@@ -321,22 +321,22 @@ void session_cleanup() { + buf_free(dequeue(&ses.writequeue)); + } + +- m_free(ses.newkeys); +-#ifndef DISABLE_ZLIB +- if (ses.keys->recv.zstream != NULL) { +- if (inflateEnd(ses.keys->recv.zstream) == Z_STREAM_ERROR) { +- dropbear_exit("Crypto error"); +- } +- m_free(ses.keys->recv.zstream); +- } +-#endif +- +- m_free(ses.remoteident); +- // m_free(ses.authstate.pw_dir); +- m_free(ses.authstate.pw_name); +- m_free(ses.authstate.pw_shell); +- m_free(ses.authstate.pw_passwd); +- m_free(ses.authstate.username); ++// m_free(ses.newkeys); ++// #ifndef DISABLE_ZLIB ++// if (ses.keys->recv.zstream != NULL) { ++// if (inflateEnd(ses.keys->recv.zstream) == Z_STREAM_ERROR) { ++// dropbear_exit("Crypto error"); ++// } ++// m_free(ses.keys->recv.zstream); ++// } ++// #endif ++ ++// m_free(ses.remoteident); ++// // m_free(ses.authstate.pw_dir); ++// m_free(ses.authstate.pw_name); ++// m_free(ses.authstate.pw_shell); ++// m_free(ses.authstate.pw_passwd); ++// m_free(ses.authstate.username); + #endif + + cleanup_buf(&ses.session_id); diff --git a/repo/packages/d/dropbear/scripts/deploy.lua b/repo/packages/d/dropbear/scripts/deploy.lua new file mode 100644 index 0000000..cba655a --- /dev/null +++ b/repo/packages/d/dropbear/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 zbtrs +-- @file deploy.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-09-01 zbtrs 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, "lib") .. "/lib*.so*")) do + local filename = path.filename(filepath) + rt_utils.cp_with_symlink(filepath, path.join(rootfs, "lib", filename)) + end +end diff --git a/repo/packages/d/dropbear/scripts/export.lua b/repo/packages/d/dropbear/scripts/export.lua new file mode 100644 index 0000000..9ee73da --- /dev/null +++ b/repo/packages/d/dropbear/scripts/export.lua @@ -0,0 +1,42 @@ +-- 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 zbtrs +-- @file export.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-09-01 zbtrs initial version +-- +import("rt.rt_utils") + +function main(rootfs, installdir) + for _, filedir in ipairs(os.filedirs(path.join(installdir, "include") .. "/*")) do + local inc = path.join(installdir, "include") + local name = path.relative(filedir, inc) + rt_utils.cp_with_symlink(path.join(inc, name), path.join(rootfs, "include", name), + {rootdir = inc, symlink = true}) + end + + for _, filepath in ipairs(os.files(path.join(installdir, "lib") .. "/lib*.a")) do + local filename = path.filename(filepath) + rt_utils.cp_with_symlink(filepath, path.join(rootfs, "lib", filename)) + end + + for _, filepath in ipairs(os.files(path.join(installdir, "lib") .. "/lib*.so*")) do + local filename = path.filename(filepath) + rt_utils.cp_with_symlink(filepath, path.join(rootfs, "lib", filename)) + end +end diff --git a/repo/packages/d/dropbear/xmake.lua b/repo/packages/d/dropbear/xmake.lua new file mode 100644 index 0000000..e65790f --- /dev/null +++ b/repo/packages/d/dropbear/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 zbtrs +-- @file xmake.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-09-01 zbtrs initial version +-- +package("dropbear") +do + set_homepage("https://matt.ucc.asn.au/dropbear/dropbear.html") + set_description("Dropbear is a relatively small SSH server and client. It runs on a variety of unix platforms. Dropbear is open source software, distributed under a MIT-style license. Dropbear is particularly useful for embedded-type Linux (or other Unix) systems, such as wireless routers.") + + add_urls("https://matt.ucc.asn.au/dropbear/releases/dropbear-$(version).tar.bz2") + + add_versions("2022.83","bc5a121ffbc94b5171ad5ebe01be42746d50aa797c9549a4639894a16749443b") + + add_patches("2022.83",path.join(os.scriptdir(), "patches", "2022.83", "01_adapt_smart.diff"), + "b15127fcee613fe7771d8f8dcc93b0ea3739ac6b3a2b06c99d51456fa8f81606") + add_patches("2022.83",path.join(os.scriptdir(), "patches", "2022.83", "03_fix_memory.diff"), + "a12b7ee10502d47994c089e39b5b30640516971323eed9af93cdf96bcdc7815d") + + on_load(function(package) + package:add("deps", "zlib", {debug = package:config("debug"), configs = {shared = package:config("shared")}}) + end) + + + on_install("cross@linux", function(package) + import("rt.private.build.rtflags") + local info = rtflags.get_package_info(package) + local version = info.version + local host = info.host + local cc = info.cc + local configs = {host = host} + local ldflags = {} + local cxflags = {} + os.setenv("PATH", path.directory(cc) .. ":" .. os.getenv("PATH")) + print(path.directory(cc)) + + local ldscript = rtflags.get_ldscripts(false) + table.join2(ldflags, ldscript.ldflags) + + local sdk = rtflags.get_sdk() + table.join2(ldflags, sdk.ldflags) + table.join2(cxflags, sdk.cxflags) + + local buildenvs = import("package.tools.autoconf").buildenvs(package, { + cxflags = cxflags, + ldflags = ldflags, + packagedeps = {"zlib"} + }) + + buildenvs["CROSS_COMPILE"] = host .. "-" + buildenvs.LDFLAGS = table.concat(ldflags, " ") + local zlib_path = buildenvs["PKG_CONFIG_PATH"] .. "/.." .. "/.." + table.insert(configs,"--with-zlib=" .. zlib_path) + + import("package.tools.autoconf").configure(package,configs,{envs = buildenvs}) + import("package.tools.make").build(package, {PROGRAMS = "dropbear dbclient dropbearkey dropbearconvert scp"}, {envs = buildenvs}) + import("package.tools.make").build(package, {PROGRAMS = "dropbear dbclient dropbearkey dropbearconvert scp","install"}, {envs = buildenvs}) + end) + + on_test(function(package) + assert(os.isfile(path.join(package:installdir("bin"), "dropbearkey"))) + end) + +end \ No newline at end of file diff --git a/repo/packages/f/ffmpeg/xmake.lua b/repo/packages/f/ffmpeg/xmake.lua index 89bf6f5..c2c685f 100644 --- a/repo/packages/f/ffmpeg/xmake.lua +++ b/repo/packages/f/ffmpeg/xmake.lua @@ -12,23 +12,25 @@ -- -- Copyright (C) 2023-2023 RT-Thread Development Team -- --- @author xqyjlj +-- @author zbtrs -- @file xmake.lua -- -- Change Logs: -- Date Author Notes -- ------------ ---------- ----------------------------------------------- -- 2023-05-06 xqyjlj initial version +-- 2023-09-17 zbtrs update version -- package("ffmpeg") do set_homepage("https://www.ffmpeg.org") + set_description( "A collection of libraries to process multimedia content such as audio, video, subtitles and related metadata.") add_urls("https://ffmpeg.org/releases/ffmpeg-$(version).tar.bz2") - add_versions("5.1.2", "39a0bcc8d98549f16c570624678246a6ac736c066cebdb409f9502e915b22f2b") + add_versions("5.1.3", "5d5bef6a11f0c500588f9870ec965a30acc0d54d8b1e535da6554a32902d236d") add_configs("shared", { description = "Build shared library.", @@ -49,11 +51,6 @@ do local packagedeps = {} os.setenv("PATH", info.toolchainsdir .. ":" .. os.getenv("PATH")) - if host == "aarch64-linux-musleabi" then - arch = "aarch64" - cpu = "armv8-a" - end - table.insert(configs, "--cross-prefix=" .. host .. "-") table.insert(configs, "--enable-cross-compile") table.insert(configs, "--target-os=none") @@ -61,16 +58,21 @@ do table.insert(configs, "--cxx=" .. cxx) table.insert(configs, "--arch=" .. arch) table.insert(configs, "--cpu=" .. cpu) + + if arch == "x86_64" then + table.insert(configs,"--disable-x86asm") + end + if package:config("shared") then table.insert(configs, "--enable-shared") end - -- table.insert(configs, "$ADDITIONAL_CONFIGURE_FLAG") - local buildenvs = import("package.tools.autoconf").buildenvs(package, {ldflags = ldflags, packagedeps = packagedeps}) import("package.tools.autoconf").configure(package, configs, {envs = buildenvs}) + import("package.tools.make").install(package, {}, {envs = buildenvs}) + for _, suffix in ipairs({".a", ".so"}) do if os.isfile(path.join(package:installdir("lib"), "libavdevice" .. suffix)) then package:add("links", "avdevice") -- avdevice first diff --git a/repo/packages/s/sdl2/patches/2.0.14/01_adapt_smart.diff b/repo/packages/s/sdl2/patches/2.0.16/01_adapt_smart.diff similarity index 78% rename from repo/packages/s/sdl2/patches/2.0.14/01_adapt_smart.diff rename to repo/packages/s/sdl2/patches/2.0.16/01_adapt_smart.diff index b6b1ad5..cb37f2b 100644 --- a/repo/packages/s/sdl2/patches/2.0.14/01_adapt_smart.diff +++ b/repo/packages/s/sdl2/patches/2.0.16/01_adapt_smart.diff @@ -1,8 +1,8 @@ diff --git a/configure.ac b/configure.ac -index b7e519b8f..a0b2ddcdf 100644 +index 2dbfd29..2a4c1ff 100644 --- a/configure.ac +++ b/configure.ac -@@ -2281,6 +2281,48 @@ AS_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[defa +@@ -2302,6 +2302,48 @@ CheckKMSDRM() fi } @@ -51,7 +51,7 @@ index b7e519b8f..a0b2ddcdf 100644 dnl rcg04172001 Set up the Null video driver. CheckDummyVideo() { -@@ -3536,6 +3578,10 @@ case "$host" in +@@ -3579,6 +3621,10 @@ case "$host" in CheckVisibilityHidden CheckDeclarationAfterStatement CheckDummyVideo @@ -63,10 +63,10 @@ index b7e519b8f..a0b2ddcdf 100644 CheckDummyAudio CheckDLOPEN diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in -index 3a2a7149d..24e3f2e29 100644 +index ea87723..af4e95f 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in -@@ -344,6 +344,10 @@ +@@ -359,6 +359,10 @@ #undef SDL_VIDEO_DRIVER_DIRECTFB #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC #undef SDL_VIDEO_DRIVER_DUMMY @@ -78,20 +78,21 @@ index 3a2a7149d..24e3f2e29 100644 #undef SDL_VIDEO_DRIVER_WAYLAND #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH diff --git a/src/core/linux/SDL_evdev_capabilities.h b/src/core/linux/SDL_evdev_capabilities.h -index e9c66c05f..a0021cca4 100644 +index 6822425..7488fde 100644 --- a/src/core/linux/SDL_evdev_capabilities.h +++ b/src/core/linux/SDL_evdev_capabilities.h -@@ -25,7 +25,7 @@ +@@ -25,8 +25,7 @@ #ifndef SDL_evdev_capabilities_h_ #define SDL_evdev_capabilities_h_ -#if HAVE_LIBUDEV_H || defined(SDL_JOYSTICK_LINUX) +- +#if HAVE_LIBUDEV_H || defined(SDL_JOYSTICK_LINUX) || defined(SDL_HAPTIC_LINUX) - #include + /* A device can be any combination of these classes */ diff --git a/src/events/SDL_quit.c b/src/events/SDL_quit.c -index d210fdba0..17d4215ae 100644 +index 628bf1b..892a9ec 100644 --- a/src/events/SDL_quit.c +++ b/src/events/SDL_quit.c @@ -35,6 +35,8 @@ @@ -113,10 +114,10 @@ index d210fdba0..17d4215ae 100644 static void diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h -index c8c425b6b..38d3979e4 100644 +index 0be19c1..ffff42c 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h -@@ -439,6 +439,7 @@ extern VideoBootStrap QNX_bootstrap; +@@ -447,6 +447,7 @@ extern VideoBootStrap QNX_bootstrap; extern VideoBootStrap OFFSCREEN_bootstrap; extern VideoBootStrap OS2DIVE_bootstrap; extern VideoBootStrap OS2VMAN_bootstrap; @@ -125,10 +126,10 @@ index c8c425b6b..38d3979e4 100644 extern SDL_VideoDevice *SDL_GetVideoDevice(void); extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode); diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c -index a0ca32243..b9990236c 100644 +index 057dce0..1efe4a1 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c -@@ -119,6 +119,9 @@ static VideoBootStrap *bootstrap[] = { +@@ -121,6 +121,9 @@ static VideoBootStrap *bootstrap[] = { #endif #if SDL_VIDEO_DRIVER_DUMMY &DUMMY_bootstrap, @@ -138,20 +139,12 @@ index a0ca32243..b9990236c 100644 #endif NULL }; -@@ -462,6 +465,7 @@ SDL_GetVideoDriver(int index) - return NULL; - } - -+ - /* - * Initialize the video and event subsystems -- determine native pixel format - */ diff --git a/src/video/rtt/SDL_rttcommon.h b/src/video/rtt/SDL_rttcommon.h new file mode 100644 -index 000000000..8bc85fe7b +index 0000000..1c03c59 --- /dev/null +++ b/src/video/rtt/SDL_rttcommon.h -@@ -0,0 +1,43 @@ +@@ -0,0 +1,44 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -160,6 +153,7 @@ index 000000000..8bc85fe7b + * Change Logs: + * Date Author Notes + * 2023-02-12 xqyjlj adapt rt-smart ++ * 2023-09-21 zbtrs upgrade version + */ + +#ifndef __SDL_RTTCOMMON_H__ @@ -197,10 +191,10 @@ index 000000000..8bc85fe7b +#endif diff --git a/src/video/rtt/SDL_rttframebuffer.c b/src/video/rtt/SDL_rttframebuffer.c new file mode 100755 -index 000000000..b20219c0d +index 0000000..f15ce34 --- /dev/null +++ b/src/video/rtt/SDL_rttframebuffer.c -@@ -0,0 +1,76 @@ +@@ -0,0 +1,77 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -209,6 +203,7 @@ index 000000000..b20219c0d + * Change Logs: + * Date Author Notes + * 2021-1-14 eason The first version ++ * 2023-09-21 zbtrs upgrade version + */ + +#include "../../SDL_internal.h" @@ -279,10 +274,10 @@ index 000000000..b20219c0d +#endif diff --git a/src/video/rtt/SDL_rttframebuffer.h b/src/video/rtt/SDL_rttframebuffer.h new file mode 100755 -index 000000000..d0de80f8d +index 0000000..1225b72 --- /dev/null +++ b/src/video/rtt/SDL_rttframebuffer.h -@@ -0,0 +1,18 @@ +@@ -0,0 +1,19 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -291,6 +286,7 @@ index 000000000..d0de80f8d + * Change Logs: + * Date Author Notes + * 2021-1-14 eason The first version ++ * 2023-09-21 zbtrs upgrade version + */ + +#ifndef __SDL_RTTFRAMEBUFFER_H__ @@ -303,10 +299,10 @@ index 000000000..d0de80f8d +#endif diff --git a/src/video/rtt/SDL_rttkeyboard.c b/src/video/rtt/SDL_rttkeyboard.c new file mode 100644 -index 000000000..5f432e366 +index 0000000..0f98ddd --- /dev/null +++ b/src/video/rtt/SDL_rttkeyboard.c -@@ -0,0 +1,46 @@ +@@ -0,0 +1,47 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -315,6 +311,7 @@ index 000000000..5f432e366 + * Change Logs: + * Date Author Notes + * 2023-02-12 xqyjlj adapt rt-smart ++ * 2023-09-21 zbtrs upgrade version + */ + +#include "../../SDL_internal.h" @@ -355,10 +352,10 @@ index 000000000..5f432e366 +#endif diff --git a/src/video/rtt/SDL_rttkeyboard.h b/src/video/rtt/SDL_rttkeyboard.h new file mode 100644 -index 000000000..1cad947ea +index 0000000..e9f0d74 --- /dev/null +++ b/src/video/rtt/SDL_rttkeyboard.h -@@ -0,0 +1,18 @@ +@@ -0,0 +1,19 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -367,6 +364,7 @@ index 000000000..1cad947ea + * Change Logs: + * Date Author Notes + * 2023-02-12 xqyjlj adapt rt-smart ++ * 2023-09-21 zbtrs upgrade version + */ + +#ifndef __SDL_RTTKEYBOARD_H__ @@ -379,10 +377,10 @@ index 000000000..1cad947ea +#endif diff --git a/src/video/rtt/SDL_rttmouse.c b/src/video/rtt/SDL_rttmouse.c new file mode 100644 -index 000000000..d96c46dd6 +index 0000000..d8fc5e2 --- /dev/null +++ b/src/video/rtt/SDL_rttmouse.c -@@ -0,0 +1,34 @@ +@@ -0,0 +1,35 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -391,6 +389,7 @@ index 000000000..d96c46dd6 + * Change Logs: + * Date Author Notes + * 2023-02-12 xqyjlj adapt rt-smart ++ * 2023-09-21 zbtrs upgrade version + */ + +#include "../../SDL_internal.h" @@ -419,10 +418,10 @@ index 000000000..d96c46dd6 +#endif diff --git a/src/video/rtt/SDL_rttmouse.h b/src/video/rtt/SDL_rttmouse.h new file mode 100644 -index 000000000..c82509744 +index 0000000..f81c2d1 --- /dev/null +++ b/src/video/rtt/SDL_rttmouse.h -@@ -0,0 +1,18 @@ +@@ -0,0 +1,19 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -431,6 +430,7 @@ index 000000000..c82509744 + * Change Logs: + * Date Author Notes + * 2023-02-12 xqyjlj adapt rt-smart ++ * 2023-09-21 zbtrs upgrade version + */ + +#ifndef __SDL_RTTMOUSE_H__ @@ -443,10 +443,10 @@ index 000000000..c82509744 +#endif diff --git a/src/video/rtt/SDL_rttscreen.c b/src/video/rtt/SDL_rttscreen.c new file mode 100755 -index 000000000..4e76086d1 +index 0000000..dae6a45 --- /dev/null +++ b/src/video/rtt/SDL_rttscreen.c -@@ -0,0 +1,387 @@ +@@ -0,0 +1,439 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -457,6 +457,7 @@ index 000000000..4e76086d1 + * 2021-1-14 eason The first version + * 2021-9-6 songchao modify for art-pi-samrt + * 2023-02-12 xqyjlj adapt rt-smart ++ * 2023-09-21 zbtrs upgrade version + */ + +#include "../../SDL_internal.h" @@ -572,6 +573,7 @@ index 000000000..4e76086d1 +#define FBIOGET_VSCREENINFO 0x4600 +#define FBIOPUT_VSCREENINFO 0x4601 +#define FBIOGET_FSCREENINFO 0x4602 ++#define FBIOGET_PIXELINFO 0x4603 + +#define FBIOPAN_DISPLAY 0x4606 + @@ -583,6 +585,23 @@ index 000000000..4e76086d1 +#define VESA_HSYNC_SUSPEND 2 +#define VESA_POWERDOWN 3 + ++ ++/* graphic device pixel format */ ++#define RTGRAPHIC_PIXEL_FORMAT_MONO 0 ++#define RTGRAPHIC_PIXEL_FORMAT_GRAY4 1 ++#define RTGRAPHIC_PIXEL_FORMAT_GRAY16 2 ++#define RTGRAPHIC_PIXEL_FORMAT_RGB332 3 ++#define RTGRAPHIC_PIXEL_FORMAT_RGB444 4 ++#define RTGRAPHIC_PIXEL_FORMAT_RGB565 5 ++#define RTGRAPHIC_PIXEL_FORMAT_RGB565P 6 ++#define RTGRAPHIC_PIXEL_FORMAT_BGR565 6 ++#define RTGRAPHIC_PIXEL_FORMAT_RGB666 7 ++#define RTGRAPHIC_PIXEL_FORMAT_RGB888 8 ++#define RTGRAPHIC_PIXEL_FORMAT_BGR888 9 ++#define RTGRAPHIC_PIXEL_FORMAT_ARGB888 10 ++#define RTGRAPHIC_PIXEL_FORMAT_ABGR888 11 ++#define RTGRAPHIC_PIXEL_FORMAT_RESERVED 12 ++ +enum +{ + /* screen: unblanked, hsync: on, vsync: on */ @@ -681,6 +700,34 @@ index 000000000..4e76086d1 +uint32_t g_sdl_rtt_screen_width; +uint32_t g_sdl_rtt_screen_heigth; + ++static int get_pixfmt() ++{ ++ int fmt; ++ if (ioctl(fbfd,FBIOGET_PIXELINFO,&fmt) < 0) ++ { ++ printf("can not get pixel format\n"); ++ return 0; ++ } ++ ++ switch(fmt) { ++ case RTGRAPHIC_PIXEL_FORMAT_RGB565: ++ return SDL_PIXELFORMAT_RGB565; ++ case RTGRAPHIC_PIXEL_FORMAT_BGR565: ++ return SDL_PIXELFORMAT_BGR565; ++ case RTGRAPHIC_PIXEL_FORMAT_RGB888: ++ return SDL_PIXELFORMAT_RGB888; ++ case RTGRAPHIC_PIXEL_FORMAT_BGR888: ++ return SDL_PIXELFORMAT_BGR888; ++ case RTGRAPHIC_PIXEL_FORMAT_ARGB888: ++ return SDL_PIXELFORMAT_ARGB8888; ++ case RTGRAPHIC_PIXEL_FORMAT_ABGR888: ++ return SDL_PIXELFORMAT_ABGR8888; ++ default: ++ return 0; ++ } ++ ++} ++ +static int __var_to_pixfmt(struct fb_var_screeninfo *var) +{ + /* @@ -744,6 +791,7 @@ index 000000000..4e76086d1 + { + fbp_offset = (g_sdl_rtt_screen_width * pitch * (i + y)) + pitch * x; + pixels_offset = surface->pitch * i; ++ // printf("%d %d %d\n",i,fbp_offset,pixels_offset); + + if(fbp_offset + surface->pitch > screensize) + { @@ -797,8 +845,11 @@ index 000000000..4e76086d1 + } + + screensize = finfo.smem_len; // finfo.line_length * vinfo.yres; ++ printf("screensize: %d\n",screensize); + -+ pixel_format = __var_to_pixfmt(&vinfo); ++ pixel_format = get_pixfmt(); ++ printf("pixel_format: %d\n",pixel_format); ++ //pixel_format = __var_to_pixfmt(&vinfo); + if(pixel_format <= 0) + { + printf("unknown pixel format, use default format: %d\n", RTT_SDL_FORMAT); @@ -814,6 +865,7 @@ index 000000000..4e76086d1 + config->height = vinfo.yres; + g_sdl_rtt_screen_width = config->width; + g_sdl_rtt_screen_heigth = config->height; ++ printf("config->width,config->height : %d %d\n",config->width,config->height); + + fbp = (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0); + if((intptr_t)fbp == -1) @@ -836,10 +888,10 @@ index 000000000..4e76086d1 +#endif diff --git a/src/video/rtt/SDL_rttscreen.h b/src/video/rtt/SDL_rttscreen.h new file mode 100755 -index 000000000..868d4e2c6 +index 0000000..8e7e178 --- /dev/null +++ b/src/video/rtt/SDL_rttscreen.h -@@ -0,0 +1,29 @@ +@@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -850,6 +902,7 @@ index 000000000..868d4e2c6 + * 2021-1-14 eason The first version + * 2021-9-6 songchao modify for art-pi-smart + * 2023-02-12 xqyjlj adapt rt-smart ++ * 2023-09-21 zbtrs upgrade version + */ + +#ifndef __SDL_RTTSCREEN_H__ @@ -871,10 +924,10 @@ index 000000000..868d4e2c6 +#endif diff --git a/src/video/rtt/SDL_rtttouch.c b/src/video/rtt/SDL_rtttouch.c new file mode 100644 -index 000000000..60f41ae5f +index 0000000..6bb6336 --- /dev/null +++ b/src/video/rtt/SDL_rtttouch.c -@@ -0,0 +1,96 @@ +@@ -0,0 +1,97 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -883,6 +936,7 @@ index 000000000..60f41ae5f + * Change Logs: + * Date Author Notes + * 2023-02-12 xqyjlj adapt rt-smart ++ * 2023-09-21 zbtrs upgrade version + */ + +#include "../../SDL_internal.h" @@ -973,10 +1027,10 @@ index 000000000..60f41ae5f +#endif diff --git a/src/video/rtt/SDL_rtttouch.h b/src/video/rtt/SDL_rtttouch.h new file mode 100644 -index 000000000..3c2b8409b +index 0000000..d21c344 --- /dev/null +++ b/src/video/rtt/SDL_rtttouch.h -@@ -0,0 +1,18 @@ +@@ -0,0 +1,19 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -985,6 +1039,7 @@ index 000000000..3c2b8409b + * Change Logs: + * Date Author Notes + * 2023-02-12 xqyjlj adapt rt-smart ++ * 2023-09-21 zbtrs upgrade version + */ + +#ifndef __SDL_RTTTOUCH_H__ @@ -997,10 +1052,10 @@ index 000000000..3c2b8409b +#endif diff --git a/src/video/rtt/SDL_rttvideo.c b/src/video/rtt/SDL_rttvideo.c new file mode 100755 -index 000000000..a2c5cc780 +index 0000000..17001f1 --- /dev/null +++ b/src/video/rtt/SDL_rttvideo.c -@@ -0,0 +1,125 @@ +@@ -0,0 +1,126 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -1011,6 +1066,7 @@ index 000000000..a2c5cc780 + * 2021-1-14 eason The first version + * 2021-9-6 songchao modify for art-pi-smart + * 2023-02-12 xqyjlj adapt rt-smart ++ * 2023-09-21 zbtrs upgrade version + */ + +#include "../../SDL_internal.h" @@ -1128,10 +1184,10 @@ index 000000000..a2c5cc780 +#endif diff --git a/src/video/rtt/SDL_rttvideo.h b/src/video/rtt/SDL_rttvideo.h new file mode 100755 -index 000000000..a648c4a2e +index 0000000..55e2ae3 --- /dev/null +++ b/src/video/rtt/SDL_rttvideo.h -@@ -0,0 +1,17 @@ +@@ -0,0 +1,18 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * @@ -1141,6 +1197,7 @@ index 000000000..a648c4a2e + * Date Author Notes + * 2021-1-14 eason The first version + * 2023-02-12 xqyjlj adapt rt-smart ++ * 2023-09-21 zbtrs upgrade version + */ + +#include "../../SDL_internal.h" @@ -1149,234 +1206,3 @@ index 000000000..a648c4a2e +#define __SDL_RTTVIDEO_H__ + +#endif -diff --git a/test/Makefile.in b/test/Makefile.in -index 8c3bbf2a1..f3c65cb68 100644 ---- a/test/Makefile.in -+++ b/test/Makefile.in -@@ -68,6 +68,7 @@ TARGETS = \ - testwm2$(EXE) \ - testyuv$(EXE) \ - torturethread$(EXE) \ -+ testrtt$(EXE) \ - - - @OPENGL_TARGETS@ += testgl2$(EXE) testshader$(EXE) -@@ -315,6 +316,8 @@ testvulkan$(EXE): $(srcdir)/testvulkan.c - testlocale$(EXE): $(srcdir)/testlocale.c - $(CC) -o $@ $? $(CFLAGS) $(LIBS) - -+testrtt$(EXE): $(srcdir)/testrtt.c -+ $(CC) -o $@ $^ $(CFLAGS) $(LIBS) - - - clean: -diff --git a/test/testrtt.c b/test/testrtt.c -new file mode 100755 -index 000000000..259464b58 ---- /dev/null -+++ b/test/testrtt.c -@@ -0,0 +1,204 @@ -+/* -+ * Copyright (c) 2006-2020, RT-Thread Development Team -+ * -+ * SPDX-License-Identifier: GPL-2.0 -+ * -+ * Change Logs: -+ * Date Author Notes -+ * 2020-1-6 eason The first version -+ */ -+#include -+#include -+#include -+ -+#define POINTS_COUNT 4 -+#define SCREEN_WIDTH 800 -+#define SCREEN_HEIGTH 600 -+ -+static SDL_Point points[POINTS_COUNT] = { -+ {320, 200}, -+ {300, 240}, -+ {340, 240}, -+ {320, 200} -+}; -+ -+void usage(char *proc_name) -+{ -+ printf("\nUsage: %s option\n", proc_name); -+ printf("\toption:\n" -+ "\t-l draw line \n" -+ "\t-r draw a rectangle \n" -+ "\t-t draw a rectangle with texture \n" -+ "\t-p [path] draw a bmp picture with texture\n" -+ "\t-d draw dot \n" -+ "\t-w draw different color in different window\n" -+ "\t-f test touch finger\n"); -+} -+ -+int main(int argc, char *argv[]) -+{ -+ // The window we'll be rendering to -+ SDL_Window *window = NULL; -+ -+ // The surface contained by the window -+ SDL_Surface *screenSurface = NULL; -+ SDL_Renderer *renderer; -+ SDL_Texture *texture; -+ -+ if((argc != 2) && (argc != 3)) -+ { -+ usage(argv[0]); -+ return (1); -+ } -+ // use dummy video driver -+ SDL_setenv("SDL_VIDEODRIVER", "rtt", 1); -+ // Initialize SDL -+ if(SDL_Init(SDL_INIT_VIDEO) < 0) -+ { -+ printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); -+ return -1; -+ } -+ -+ window = -+ SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 340, 340, SDL_WINDOW_SHOWN); -+ if(window == NULL) -+ { -+ printf("Window could not be created! SDL_Error: %s\n", SDL_GetError()); -+ return -1; -+ } -+ -+ renderer = SDL_CreateRenderer(window, -1, 0); -+ SDL_SetRenderDrawColor(renderer, 255, 255, 255, SDL_ALPHA_OPAQUE); -+ SDL_RenderClear(renderer); -+ -+ if(0 == strcmp("-l", argv[1])) -+ { -+ SDL_SetRenderDrawColor(renderer, 255, 0, 0, SDL_ALPHA_OPAQUE); -+ SDL_RenderDrawLine(renderer, 0, 0, 320, 200); -+ -+ // SDL_RenderDrawLine(renderer, 320, 0, 320, 480); -+ SDL_RenderDrawLines(renderer, points, POINTS_COUNT); -+ } -+ else if(0 == strcmp("-r", argv[1])) -+ { -+ SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE); -+ SDL_Rect rect = {10, 30, 320, 240}; -+ SDL_RenderDrawRect(renderer, &rect); -+ // SDL_RenderFillRect(renderer, &rect); -+ } -+ else if(0 == strcmp("-t", argv[1])) -+ { -+ texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, 340, 340); -+ SDL_Rect rect = {10, 30, 200, 200}; -+ SDL_SetRenderTarget(renderer, texture); -+ SDL_SetRenderDrawColor(renderer, 255, 0, 0, SDL_ALPHA_OPAQUE); -+ SDL_RenderClear(renderer); -+ SDL_RenderDrawRect(renderer, &rect); -+ -+ SDL_SetRenderDrawColor(renderer, 0, 0, 255, SDL_ALPHA_OPAQUE); -+ SDL_RenderFillRect(renderer, &rect); -+ -+ SDL_SetRenderTarget(renderer, NULL); -+ SDL_RenderCopy(renderer, texture, NULL, NULL); -+ } -+ else if(0 == strcmp("-p", argv[1])) -+ { -+ if(!argv[2]) -+ { -+ printf("use -p [path]\n"); -+ goto end; -+ } -+ if(access(argv[2], 0)) -+ { -+ printf("the file %s is not exits\n", argv[2]); -+ goto end; -+ } -+ screenSurface = SDL_LoadBMP(argv[2]); -+ if(!screenSurface) -+ { -+ printf("SDL_LoadBMP failed\n"); -+ goto end; -+ } -+ texture = SDL_CreateTextureFromSurface(renderer, screenSurface); -+ SDL_SetRenderTarget(renderer, texture); -+ SDL_RenderCopy(renderer, texture, NULL, NULL); -+ } -+ else if(0 == strcmp("-f", argv[1])) -+ { -+ while(1) -+ { -+ SDL_Event event; -+ while(SDL_PollEvent(&event)) -+ { -+ switch(event.type) -+ { -+ case SDL_FINGERDOWN: -+ case SDL_FINGERUP: -+ case SDL_FINGERMOTION: -+ { -+ printf("type: %d (%f %f)(%f %f), (%f %f)\n", event.tfinger.type, event.tfinger.x, -+ event.tfinger.y, event.tfinger.x * 800, event.tfinger.y * 600, event.tfinger.dx, -+ event.tfinger.dx); -+ break; -+ } -+ } -+ } -+ } -+ } -+ else if(0 == strcmp("-d", argv[1])) -+ { -+ SDL_SetRenderDrawColor(renderer, 255, 0, 0, SDL_ALPHA_OPAQUE); -+ for(int i = 0; i < 100; i += 5) -+ { -+ for(int j = 0; j < i; j += 5) -+ { -+ SDL_RenderDrawPoint(renderer, i, j); -+ } -+ } -+ } -+ else if(0 == strcmp("-w", argv[1])) -+ { -+ SDL_Window *win2 = SDL_CreateWindow("MultiWindow2", 100, 100, 400, 240, SDL_WINDOW_SHOWN); -+ SDL_Renderer *renderer2 = SDL_CreateRenderer(win2, -1, 0); -+ SDL_Window *win3 = SDL_CreateWindow("MultiWindow3", 500, 100, 400, 240, SDL_WINDOW_SHOWN); -+ SDL_Renderer *renderer3 = SDL_CreateRenderer(win3, -1, 0); -+ SDL_Window *win4 = SDL_CreateWindow("MultiWindow4", 900, 100, 400, 240, SDL_WINDOW_SHOWN); -+ SDL_Renderer *renderer4 = SDL_CreateRenderer(win4, -1, 0); -+ SDL_SetRenderDrawColor(renderer2, 255, 0, 0, SDL_ALPHA_OPAQUE); -+ SDL_RenderClear(renderer2); -+ SDL_SetRenderDrawColor(renderer3, 0, 255, 0, SDL_ALPHA_OPAQUE); -+ SDL_RenderClear(renderer3); -+ SDL_SetRenderDrawColor(renderer4, 0, 0, 255, SDL_ALPHA_OPAQUE); -+ SDL_RenderClear(renderer4); -+ -+ SDL_RenderPresent(renderer2); -+ SDL_DestroyRenderer(renderer2); -+ SDL_DestroyWindow(win2); -+ SDL_RenderPresent(renderer3); -+ SDL_DestroyRenderer(renderer3); -+ SDL_DestroyWindow(win3); -+ SDL_RenderPresent(renderer4); -+ SDL_DestroyRenderer(renderer4); -+ SDL_DestroyWindow(win4); -+ } -+ else -+ { -+ usage(argv[0]); -+ } -+ -+ SDL_RenderPresent(renderer); -+ SDL_Delay(2000); -+end: -+ // destory renderer -+ if(renderer) -+ { -+ SDL_DestroyRenderer(renderer); -+ } -+ // Destroy window -+ SDL_DestroyWindow(window); -+ -+ // Quit SDL subsystems -+ SDL_Quit(); -+ -+ return 0; -+} diff --git a/repo/packages/s/sdl2/xmake.lua b/repo/packages/s/sdl2/xmake.lua index 685966f..6e9791d 100644 --- a/repo/packages/s/sdl2/xmake.lua +++ b/repo/packages/s/sdl2/xmake.lua @@ -19,6 +19,7 @@ -- Date Author Notes -- ------------ ---------- ----------------------------------------------- -- 2023-05-22 xqyjlj initial version +-- 2023-09-19 zbtrs upgrade version to support d1s -- package("sdl2") do @@ -27,10 +28,10 @@ do add_urls("https://github.com/libsdl-org/SDL/archive/refs/tags/release-$(version).tar.gz") - add_versions("2.0.14", "f85233bc8d4f30a7caa5aea7de0f95b8f4b1f7272473aea4b3ec4ede0a27357f") + add_versions("2.0.16", "bfb53c5395ff2862d07617b23939fca9a752c2f4d2424e617cedd083390b0143") - add_patches("2.0.14", path.join(os.scriptdir(), "patches", "2.0.14", "01_adapt_smart.diff"), - "b23de0d3b13dd7d3a12a07a94ec84d51c78c9960058730d920e321871418e12b") + add_patches("2.0.16",path.join(os.scriptdir(), "patches", "2.0.16", "01_adapt_smart.diff"), + "a09ea8ac7c61d04fd568accd7f565f627808e33fe1698c3a9ee95e00d6b3c270") add_configs("shared", { description = "Build shared library.", @@ -57,7 +58,6 @@ do end table.insert(configs, "--build=i686-pc-linux-gnu") - table.insert(configs, "--enable-joystick-virtual=no") table.insert(configs, "--enable-render-d3d=no") table.insert(configs, "--enable-sdl-dlopen=no") table.insert(configs, "--enable-joystick=no") @@ -65,13 +65,14 @@ do table.insert(configs, "--enable-hidapi=no") table.insert(configs, "--enable-hidapi-libusb=no") table.insert(configs, "--enable-threads=no") + table.insert(configs, "--enable-joystick-virtual=no") table.insert(configs, "--enable-3dnow=no") table.insert(configs, "--enable-jack-shared=no") table.insert(configs, "--enable-pulseaudio-shared=no") - table.insert(configs, "--enable-pulseaudio=no") table.insert(configs, "--enable-cpuinfo=no") table.insert(configs, "--enable-video-directfb") table.insert(configs, "--enable-directfb-shared=no") + table.insert(configs, "--enable-pulseaudio=no") table.insert(configs, "--enable-video-rtt-virtio-gpu=no") table.insert(configs, "--enable-video-rtt-touch=no") table.insert(configs, "--enable-video-rtt-fbdev=yes") @@ -80,6 +81,7 @@ do os.vrun("./autogen.sh", {envs = buildenvs}) import("package.tools.autoconf").configure(package, configs, {envs = buildenvs}) import("package.tools.make").install(package, {}, {envs = buildenvs}) + end) on_test(function(package) diff --git a/repo/packages/s/sftp_server/scripts/deploy.lua b/repo/packages/s/sftp_server/scripts/deploy.lua new file mode 100644 index 0000000..5f5524d --- /dev/null +++ b/repo/packages/s/sftp_server/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 zbtrs +-- @file deploy.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-09-08 zbtrs 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, "lib") .. "/lib*.so*")) do + local filename = path.filename(filepath) + rt_utils.cp_with_symlink(filepath, path.join(rootfs, "lib", filename)) + end +end diff --git a/repo/packages/s/sftp_server/scripts/export.lua b/repo/packages/s/sftp_server/scripts/export.lua new file mode 100644 index 0000000..4e96cab --- /dev/null +++ b/repo/packages/s/sftp_server/scripts/export.lua @@ -0,0 +1,42 @@ +-- 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 zbtrs +-- @file export.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-09-08 zbtrs initial version +-- +import("rt.rt_utils") + +function main(rootfs, installdir) + for _, filedir in ipairs(os.filedirs(path.join(installdir, "include") .. "/*")) do + local inc = path.join(installdir, "include") + local name = path.relative(filedir, inc) + rt_utils.cp_with_symlink(path.join(inc, name), path.join(rootfs, "include", name), + {rootdir = inc, symlink = true}) + end + + for _, filepath in ipairs(os.files(path.join(installdir, "lib") .. "/lib*.a")) do + local filename = path.filename(filepath) + rt_utils.cp_with_symlink(filepath, path.join(rootfs, "lib", filename)) + end + + for _, filepath in ipairs(os.files(path.join(installdir, "lib") .. "/lib*.so*")) do + local filename = path.filename(filepath) + rt_utils.cp_with_symlink(filepath, path.join(rootfs, "lib", filename)) + end +end diff --git a/repo/packages/s/sftp_server/xmake.lua b/repo/packages/s/sftp_server/xmake.lua new file mode 100644 index 0000000..24ba997 --- /dev/null +++ b/repo/packages/s/sftp_server/xmake.lua @@ -0,0 +1,70 @@ +-- 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 zbtrs +-- @file xmake.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-09-08 zbtrs initial version +-- +package("sftp_server") +do + set_homepage("https://github.com/zbtrs/sftpserver") + set_description("This is an SFTP server supporting up to protocol version 6. It is possible to use it as a drop-in replacement for the OpenSSH server.") + + add_urls("https://github.com/zbtrs/sftpserver/archive/refs/tags/V$(version).tar.gz") + + add_versions("1.0","2ee448f196ed1132ca60fc6bb7d49285419058433f892380d8aee75059be4c87") + + on_install("cross@linux", function(package) + import("rt.private.build.rtflags") + local info = rtflags.get_package_info(package) + local version = info.version + local host = info.host + local cc = info.cc + local configs = {host = host} + local ldflags = {} + local cxflags = {} + os.setenv("PATH", path.directory(cc) .. ":" .. os.getenv("PATH")) + print(path.directory(cc)) + + local ldscript = rtflags.get_ldscripts(false) + table.join2(ldflags, ldscript.ldflags) + + local sdk = rtflags.get_sdk() + table.join2(ldflags, sdk.ldflags) + table.join2(cxflags, sdk.cxflags) + + local buildenvs = import("package.tools.autoconf").buildenvs(package, { + cxflags = cxflags, + ldflags = ldflags + }) + + buildenvs["CROSS_COMPILE"] = host .. "-" + buildenvs.LDFLAGS = table.concat(ldflags, " ") + table.insert(configs,"--disable-largefile") + table.insert(configs,"--with-threads=1") + os.vrun("./autogen.sh", {envs = buildenvs}) + import("package.tools.autoconf").configure(package,configs,{envs = buildenvs}) + import("package.tools.make").build(package, {}, {envs = buildenvs}) + import("package.tools.make").build(package, {"install"}, {envs = buildenvs}) + end) + + on_test(function(package) + assert(os.isfile(path.join(package:installdir("libexec"), "gesftpserver"))) + end) + +end \ No newline at end of file diff --git a/repo/packages/w/wolfssl/scripts/deploy.lua b/repo/packages/w/wolfssl/scripts/deploy.lua new file mode 100644 index 0000000..3b67a6b --- /dev/null +++ b/repo/packages/w/wolfssl/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 zbtrs +-- @file deploy.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-08-13 zbtrs 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, "lib") .. "/lib*.so*")) do + local filename = path.filename(filepath) + rt_utils.cp_with_symlink(filepath, path.join(rootfs, "lib", filename)) + end +end diff --git a/repo/packages/w/wolfssl/scripts/export.lua b/repo/packages/w/wolfssl/scripts/export.lua new file mode 100644 index 0000000..e443a8c --- /dev/null +++ b/repo/packages/w/wolfssl/scripts/export.lua @@ -0,0 +1,42 @@ +-- 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 zbtrs +-- @file export.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-08-13 zbtrs initial version +-- +import("rt.rt_utils") + +function main(rootfs, installdir) + for _, filedir in ipairs(os.filedirs(path.join(installdir, "include") .. "/*")) do + local inc = path.join(installdir, "include") + local name = path.relative(filedir, inc) + rt_utils.cp_with_symlink(path.join(inc, name), path.join(rootfs, "include", name), + {rootdir = inc, symlink = true}) + end + + for _, filepath in ipairs(os.files(path.join(installdir, "lib") .. "/lib*.a")) do + local filename = path.filename(filepath) + rt_utils.cp_with_symlink(filepath, path.join(rootfs, "lib", filename)) + end + + for _, filepath in ipairs(os.files(path.join(installdir, "lib") .. "/lib*.so*")) do + local filename = path.filename(filepath) + rt_utils.cp_with_symlink(filepath, path.join(rootfs, "lib", filename)) + end +end diff --git a/repo/packages/w/wolfssl/xmake.lua b/repo/packages/w/wolfssl/xmake.lua new file mode 100644 index 0000000..4f5ef36 --- /dev/null +++ b/repo/packages/w/wolfssl/xmake.lua @@ -0,0 +1,66 @@ +-- 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 zbtrs +-- @file xmake.lua +-- +-- Change Logs: +-- Date Author Notes +-- ------------ ---------- ----------------------------------------------- +-- 2023-08-13 zbtrs initial version +-- +package("wolfssl") +do + set_homepage("https://www.wolfssl.com/") + set_description("Providing secure communication for IoT, smart grid, connected home, automobiles, routers, applications, games, IP, mobile phones, the cloud, and more.") + + add_urls("https://github.com/wolfSSL/wolfssl/archive/refs/tags/$(version)-stable.tar.gz") + add_versions("v5.6.3","2e74a397fa797c2902d7467d500de904907666afb4ff80f6464f6efd5afb114a") + + add_configs("shared", { + description = "Build shared library.", + default = os.getenv("RT_XMAKE_LINK_TYPE") ~= "static", + 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 configs = {host = host} + local cc = info.cc + local ldflags = {} + os.setenv("PATH", path.directory(cc) .. ":" .. os.getenv("PATH")) + + table.insert(configs, "--enable-static=yes") + if package:config("shared") then + table.insert(configs, "--enable-shared=yes") + else + table.insert(configs, "--enable-shared=no") + end + table.insert(configs,"--enable-sslv3=yes") + table.insert(configs,"--enable-ecc=yes") + table.insert(configs,"--enable-tlsx=yes") + table.insert(configs,"--enable-stunnel=yes") + table.insert(configs,"--enable-opensslextra=yes") + table.insert(configs,"--enable-openssh=yes") + table.insert(configs,"--enable-tlsv10=yes") + + local buildenvs = import("package.tools.autoconf").buildenvs(package, {ldflags = ldflags}) + import("package.tools.autoconf").configure(package, configs, {envs = buildenvs}) + import("package.tools.make").install(package, {}, {envs = buildenvs}) + end) + + +end \ No newline at end of file diff --git a/tools/scripts/modules/rt/private/build/rtflags.lua b/tools/scripts/modules/rt/private/build/rtflags.lua index 6bf67a0..2067acf 100644 --- a/tools/scripts/modules/rt/private/build/rtflags.lua +++ b/tools/scripts/modules/rt/private/build/rtflags.lua @@ -129,6 +129,10 @@ function get_package_info(package) if rtn.arch == "aarch64" then rtn.cpu = "armv8-a" + elseif rtn.arch == "arm" then + rtn.cpu = "armv7-a" + elseif rtn.arch == "x86_64" then + rtn.cpu = "generic64" else rtn.cpu = "" end