parent
487d20653e
commit
d83ba96297
4 changed files with 364 additions and 0 deletions
@ -0,0 +1,194 @@ |
||||
/* config.h. Generated from config.h.in by configure. */ |
||||
/* config.h.in. Generated from configure.ac by autoheader. */ |
||||
|
||||
/* Debug messages. */ |
||||
/* #undef ENABLE_DEBUG */ |
||||
|
||||
/* Experimental features. */ |
||||
/* #undef ENABLE_EXPERIMENTAL */ |
||||
|
||||
/* System logging. */ |
||||
#define ENABLE_LOGGING 1 |
||||
|
||||
/* Enable openssl for modinfo. */ |
||||
/* #undef ENABLE_OPENSSL */ |
||||
|
||||
/* Enable Xz for modules. */ |
||||
/* #undef ENABLE_XZ */ |
||||
|
||||
/* Enable zlib for modules. */ |
||||
/* #undef ENABLE_ZLIB */ |
||||
|
||||
/* Define to 1 if you have the declaration of `be32toh', and to 0 if you
|
||||
don't. */ |
||||
#define HAVE_DECL_BE32TOH 1 |
||||
|
||||
/* Define to 1 if you have the declaration of `strndupa', and to 0 if you
|
||||
don't. */ |
||||
/* #define HAVE_DECL_STRNDUPA */ |
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
||||
#define HAVE_DLFCN_H 1 |
||||
|
||||
/* Define to 1 if you have the `finit_module' function. */ |
||||
/* #undef HAVE_FINIT_MODULE */ |
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
||||
#define HAVE_INTTYPES_H 1 |
||||
|
||||
/* Define to 1 if you have the <linux/module.h> header file. */ |
||||
/* #undef HAVE_LINUX_MODULE_H */ |
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */ |
||||
#define HAVE_MEMORY_H 1 |
||||
|
||||
/* Define if _Noreturn is available */ |
||||
#define HAVE_NORETURN 1 |
||||
|
||||
/* Define to 1 if you have the `secure_getenv' function. */ |
||||
#define HAVE_SECURE_GETENV 1 |
||||
|
||||
/* Define if _Static_assert() is available */ |
||||
#define HAVE_STATIC_ASSERT 1 |
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */ |
||||
#define HAVE_STDINT_H 1 |
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
||||
#define HAVE_STDLIB_H 1 |
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */ |
||||
#define HAVE_STRINGS_H 1 |
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */ |
||||
#define HAVE_STRING_H 1 |
||||
|
||||
/* Define to 1 if `st_mtim' is a member of `struct stat'. */ |
||||
/*#define HAVE_STRUCT_STAT_ST_MTIM 1*/ |
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
||||
#define HAVE_SYS_STAT_H 1 |
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
||||
#define HAVE_SYS_TYPES_H 1 |
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */ |
||||
#define HAVE_UNISTD_H 1 |
||||
|
||||
/* Define to 1 if compiler has __builtin_clz() builtin function */ |
||||
#define HAVE___BUILTIN_CLZ 1 |
||||
|
||||
/* Define to 1 if compiler has __builtin_types_compatible_p() builtin function
|
||||
*/ |
||||
#define HAVE___BUILTIN_TYPES_COMPATIBLE_P 1 |
||||
|
||||
/* Define to 1 if compiler has __builtin_uaddll_overflow() builtin function */ |
||||
#define HAVE___BUILTIN_UADDLL_OVERFLOW 0 |
||||
|
||||
/* Define to 1 if compiler has __builtin_uaddl_overflow() builtin function */ |
||||
#define HAVE___BUILTIN_UADDL_OVERFLOW 0 |
||||
|
||||
/* Define to 1 if you have the `__secure_getenv' function. */ |
||||
/* #undef HAVE___SECURE_GETENV */ |
||||
|
||||
/* Define to 1 if you have the `__xstat' function. */ |
||||
#define HAVE___XSTAT 1 |
||||
|
||||
/* Features in this build */ |
||||
#define KMOD_FEATURES "-XZ -ZLIB -OPENSSL -EXPERIMENTAL" |
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */ |
||||
#define LT_OBJDIR ".libs/" |
||||
|
||||
/* Name of package */ |
||||
#define PACKAGE "kmod" |
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */ |
||||
#define PACKAGE_BUGREPORT "linux-modules@vger.kernel.org" |
||||
|
||||
/* Define to the full name of this package. */ |
||||
#define PACKAGE_NAME "kmod" |
||||
|
||||
/* Define to the full name and version of this package. */ |
||||
#define PACKAGE_STRING "kmod 26" |
||||
|
||||
/* Define to the one symbol short name of this package. */ |
||||
#define PACKAGE_TARNAME "kmod" |
||||
|
||||
/* Define to the home page for this package. */ |
||||
#define PACKAGE_URL "http://git.kernel.org/?p=utils/kernel/kmod/kmod.git"
|
||||
|
||||
/* Define to the version of this package. */ |
||||
#define PACKAGE_VERSION "26" |
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */ |
||||
#define STDC_HEADERS 1 |
||||
|
||||
/* Enable extensions on AIX 3, Interix. */ |
||||
#ifndef _ALL_SOURCE |
||||
# define _ALL_SOURCE 1 |
||||
#endif |
||||
/* Enable GNU extensions on systems that have them. */ |
||||
#ifndef _GNU_SOURCE |
||||
# define _GNU_SOURCE 1 |
||||
#endif |
||||
/* Enable threading extensions on Solaris. */ |
||||
#ifndef _POSIX_PTHREAD_SEMANTICS |
||||
# define _POSIX_PTHREAD_SEMANTICS 1 |
||||
#endif |
||||
/* Enable extensions on HP NonStop. */ |
||||
#ifndef _TANDEM_SOURCE |
||||
# define _TANDEM_SOURCE 1 |
||||
#endif |
||||
/* Enable general extensions on Solaris. */ |
||||
#ifndef __EXTENSIONS__ |
||||
# define __EXTENSIONS__ 1 |
||||
#endif |
||||
|
||||
|
||||
/* Version number of package */ |
||||
#define VERSION "26" |
||||
|
||||
/* Enable large inode numbers on Mac OS X 10.5. */ |
||||
#ifndef _DARWIN_USE_64_BIT_INODE |
||||
# define _DARWIN_USE_64_BIT_INODE 1 |
||||
#endif |
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */ |
||||
/* #undef _FILE_OFFSET_BITS */ |
||||
|
||||
/* Define for large files, on AIX-style hosts. */ |
||||
/* #undef _LARGE_FILES */ |
||||
|
||||
/* Define to 1 if on MINIX. */ |
||||
/* #undef _MINIX */ |
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */ |
||||
/* #undef _POSIX_1_SOURCE */ |
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */ |
||||
/* #undef _POSIX_SOURCE */ |
||||
|
||||
#if defined(__APPLE__) |
||||
|
||||
#define get_current_dir_name() getwd(malloc(128)) |
||||
#define strndupa(_s,_l) strdup(_s) |
||||
char* basename(const char*); |
||||
#define init_module darwin_init_module |
||||
#define delete_module darwin_delete_module |
||||
#define program_invocation_short_name "depmod" |
||||
#include <endian-darwin.h> |
||||
#else |
||||
#include <endian.h> |
||||
|
||||
#endif |
||||
|
||||
#if defined(__ANDROID__) |
||||
#include <stdlib.h> |
||||
#include <unistd.h> |
||||
static inline char *get_current_dir_name(void) |
||||
{ |
||||
return getcwd(malloc(PATH_MAX), PATH_MAX); |
||||
} |
||||
#endif |
@ -0,0 +1,118 @@ |
||||
// "License": Public Domain
|
||||
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
|
||||
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
|
||||
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
|
||||
// an example on how to get the endian conversion functions on different platforms.
|
||||
|
||||
#ifndef PORTABLE_ENDIAN_H__ |
||||
#define PORTABLE_ENDIAN_H__ |
||||
|
||||
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__) |
||||
|
||||
# define __WINDOWS__ |
||||
|
||||
#endif |
||||
|
||||
#if defined(__linux__) || defined(__CYGWIN__) |
||||
|
||||
# include <endian.h> |
||||
|
||||
#elif defined(__APPLE__) |
||||
|
||||
# include <libkern/OSByteOrder.h> |
||||
|
||||
# define htobe16(x) OSSwapHostToBigInt16(x) |
||||
# define htole16(x) OSSwapHostToLittleInt16(x) |
||||
# define be16toh(x) OSSwapBigToHostInt16(x) |
||||
# define le16toh(x) OSSwapLittleToHostInt16(x) |
||||
|
||||
# define htobe32(x) OSSwapHostToBigInt32(x) |
||||
# define htole32(x) OSSwapHostToLittleInt32(x) |
||||
# define be32toh(x) OSSwapBigToHostInt32(x) |
||||
# define le32toh(x) OSSwapLittleToHostInt32(x) |
||||
|
||||
# define htobe64(x) OSSwapHostToBigInt64(x) |
||||
# define htole64(x) OSSwapHostToLittleInt64(x) |
||||
# define be64toh(x) OSSwapBigToHostInt64(x) |
||||
# define le64toh(x) OSSwapLittleToHostInt64(x) |
||||
|
||||
# define __BYTE_ORDER BYTE_ORDER |
||||
# define __BIG_ENDIAN BIG_ENDIAN |
||||
# define __LITTLE_ENDIAN LITTLE_ENDIAN |
||||
# define __PDP_ENDIAN PDP_ENDIAN |
||||
|
||||
#elif defined(__OpenBSD__) |
||||
|
||||
# include <sys/endian.h> |
||||
|
||||
#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) |
||||
|
||||
# include <sys/endian.h> |
||||
|
||||
# define be16toh(x) betoh16(x) |
||||
# define le16toh(x) letoh16(x) |
||||
|
||||
# define be32toh(x) betoh32(x) |
||||
# define le32toh(x) letoh32(x) |
||||
|
||||
# define be64toh(x) betoh64(x) |
||||
# define le64toh(x) letoh64(x) |
||||
|
||||
#elif defined(__WINDOWS__) |
||||
|
||||
# include <winsock2.h> |
||||
# include <sys/param.h> |
||||
|
||||
# if BYTE_ORDER == LITTLE_ENDIAN |
||||
|
||||
# define htobe16(x) htons(x) |
||||
# define htole16(x) (x) |
||||
# define be16toh(x) ntohs(x) |
||||
# define le16toh(x) (x) |
||||
|
||||
# define htobe32(x) htonl(x) |
||||
# define htole32(x) (x) |
||||
# define be32toh(x) ntohl(x) |
||||
# define le32toh(x) (x) |
||||
|
||||
# define htobe64(x) htonll(x) |
||||
# define htole64(x) (x) |
||||
# define be64toh(x) ntohll(x) |
||||
# define le64toh(x) (x) |
||||
|
||||
# elif BYTE_ORDER == BIG_ENDIAN |
||||
|
||||
/* that would be xbox 360 */ |
||||
# define htobe16(x) (x) |
||||
# define htole16(x) __builtin_bswap16(x) |
||||
# define be16toh(x) (x) |
||||
# define le16toh(x) __builtin_bswap16(x) |
||||
|
||||
# define htobe32(x) (x) |
||||
# define htole32(x) __builtin_bswap32(x) |
||||
# define be32toh(x) (x) |
||||
# define le32toh(x) __builtin_bswap32(x) |
||||
|
||||
# define htobe64(x) (x) |
||||
# define htole64(x) __builtin_bswap64(x) |
||||
# define be64toh(x) (x) |
||||
# define le64toh(x) __builtin_bswap64(x) |
||||
|
||||
# else |
||||
|
||||
# error byte order not supported |
||||
|
||||
# endif |
||||
|
||||
# define __BYTE_ORDER BYTE_ORDER |
||||
# define __BIG_ENDIAN BIG_ENDIAN |
||||
# define __LITTLE_ENDIAN LITTLE_ENDIAN |
||||
# define __PDP_ENDIAN PDP_ENDIAN |
||||
|
||||
#else |
||||
|
||||
# error platform not supported |
||||
|
||||
#endif |
||||
|
||||
#endif |
@ -0,0 +1,28 @@ |
||||
add_rules("mode.debug", "mode.release") |
||||
|
||||
target("kmod") |
||||
set_kind("$(kind)") |
||||
set_languages("gnu99") |
||||
add_headerfiles("(libkmod/libkmod.h)") |
||||
add_headerfiles("(libkmod/libkmod-index.h)") |
||||
add_includedirs(".") |
||||
add_defines("PATH_MAX=4096") |
||||
add_defines("ANOTHER_BRICK_IN_THE") |
||||
add_defines("SYSCONFDIR=\"/tmp\"") |
||||
add_defines("secure_getenv=getenv") |
||||
add_cflags("-include config.h") |
||||
add_files( |
||||
"libkmod/libkmod.c", |
||||
"libkmod/libkmod-builtin.c", |
||||
"libkmod/libkmod-file.c", |
||||
"libkmod/libkmod-module.c", |
||||
"libkmod/libkmod-config.c", |
||||
"libkmod/libkmod-index.c", |
||||
"libkmod/libkmod-elf.c", |
||||
"libkmod/libkmod-list.c", |
||||
"libkmod/libkmod-signature.c", |
||||
"shared/array.c", |
||||
"shared/scratchbuf.c", |
||||
"shared/util.c", |
||||
"shared/hash.c", |
||||
"shared/strbuf.c") |
@ -0,0 +1,24 @@ |
||||
package("libkmod") |
||||
set_homepage("https://github.com/kmod-project/kmod") |
||||
set_description("libkmod - Linux kernel module handling") |
||||
set_license("LGPL-2.1") |
||||
|
||||
add_urls("https://github.com/kmod-project/kmod/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/kmod-project/kmod.git") |
||||
add_versions("v30", "1fa3974abd80b992d61324bcc04fa65ea96cfe2e9e1150f48394833030c4b583") |
||||
|
||||
on_install("linux", "android", function (package) |
||||
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") |
||||
os.cp(path.join(package:scriptdir(), "port", "config.h"), "config.h") |
||||
os.cp(path.join(package:scriptdir(), "port", "endian-darwin.h"), "endian-darwin.h") |
||||
|
||||
local configs = {} |
||||
if package:config("shared") then |
||||
configs.kind = "shared" |
||||
end |
||||
import("package.tools.xmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:has_cfuncs("kmod_new", {includes = "libkmod/libkmod.h"})) |
||||
end) |
Loading…
Reference in new issue