From 302aa9de71ff71d2c85ad7a10a188b2812e50bd5 Mon Sep 17 00:00:00 2001 From: Samuel Audet Date: Tue, 19 Nov 2024 10:08:57 +0900 Subject: [PATCH] Fix builds for systems presets --- .../org/bytedeco/systems/global/macosx.java | 12 ---- .../org/bytedeco/systems/macosx/stat64.java | 57 ------------------- .../org/bytedeco/systems/presets/macosx.java | 22 ++++--- 3 files changed, 15 insertions(+), 76 deletions(-) delete mode 100644 systems/src/gen/java/org/bytedeco/systems/macosx/stat64.java diff --git a/systems/src/gen/java/org/bytedeco/systems/global/macosx.java b/systems/src/gen/java/org/bytedeco/systems/global/macosx.java index e40dd08ab7..c6f5fe70a1 100644 --- a/systems/src/gen/java/org/bytedeco/systems/global/macosx.java +++ b/systems/src/gen/java/org/bytedeco/systems/global/macosx.java @@ -3483,7 +3483,6 @@ public static native int setitimer(int arg0, @Const itimerval arg1, // #else /* !__DARWIN_64_BIT_INO_T */ -// Targeting ../macosx/stat64.java @@ -3703,17 +3702,6 @@ public static native int utimensat(int __fd, String __path, @Const timespec __ti public static native int umaskx_np(_filesec arg0); // #if !__DARWIN_ONLY_64_BIT_INO_T -/* The following deprecated routines are simillar to stat and friends except provide struct stat64 instead of struct stat */ -public static native int fstatx64_np(int arg0, stat64 arg1, _filesec arg2); -public static native int lstatx64_np(@Cast("const char*") BytePointer arg0, stat64 arg1, _filesec arg2); -public static native int lstatx64_np(String arg0, stat64 arg1, _filesec arg2); -public static native int statx64_np(@Cast("const char*") BytePointer arg0, stat64 arg1, _filesec arg2); -public static native int statx64_np(String arg0, stat64 arg1, _filesec arg2); -public static native int fstat64(int arg0, stat64 arg1); -public static native int lstat64(@Cast("const char*") BytePointer arg0, stat64 arg1); -public static native int lstat64(String arg0, stat64 arg1); -public static native int stat64(@Cast("const char*") BytePointer arg0, stat64 arg1); -public static native int stat64(String arg0, stat64 arg1); // #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ // #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ diff --git a/systems/src/gen/java/org/bytedeco/systems/macosx/stat64.java b/systems/src/gen/java/org/bytedeco/systems/macosx/stat64.java deleted file mode 100644 index 445d6350cd..0000000000 --- a/systems/src/gen/java/org/bytedeco/systems/macosx/stat64.java +++ /dev/null @@ -1,57 +0,0 @@ -// Targeted by JavaCPP version 1.5.11: DO NOT EDIT THIS FILE - -package org.bytedeco.systems.macosx; - -import java.nio.*; -import org.bytedeco.javacpp.*; -import org.bytedeco.javacpp.annotation.*; - -import static org.bytedeco.javacpp.presets.javacpp.*; - -import static org.bytedeco.systems.global.macosx.*; - - -// #endif /* __DARWIN_64_BIT_INO_T */ - -// #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) - -// #if !__DARWIN_ONLY_64_BIT_INO_T - -@Name("struct stat64") @Properties(inherit = org.bytedeco.systems.presets.macosx.class) -public class stat64 extends Pointer { - static { Loader.load(); } - /** Default native constructor. */ - public stat64() { super((Pointer)null); allocate(); } - /** Native array allocator. Access with {@link Pointer#position(long)}. */ - public stat64(long size) { super((Pointer)null); allocateArray(size); } - /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */ - public stat64(Pointer p) { super(p); } - private native void allocate(); - private native void allocateArray(long size); - @Override public stat64 position(long position) { - return (stat64)super.position(position); - } - @Override public stat64 getPointer(long i) { - return new stat64((Pointer)this).offsetAddress(i); - } - - public native @Cast("dev_t") int st_dev(); public native stat64 st_dev(int setter); /* [XSI] ID of device containing file */ - public native @Cast("mode_t") short st_mode(); public native stat64 st_mode(short setter); /* [XSI] Mode of file (see below) */ - public native @Cast("nlink_t") short st_nlink(); public native stat64 st_nlink(short setter); /* [XSI] Number of hard links */ - public native @Cast("__darwin_ino64_t") long st_ino(); public native stat64 st_ino(long setter); /* [XSI] File serial number */ - public native @Cast("uid_t") int st_uid(); public native stat64 st_uid(int setter); /* [XSI] User ID of the file */ - public native @Cast("gid_t") int st_gid(); public native stat64 st_gid(int setter); /* [XSI] Group ID of the file */ - public native @Cast("dev_t") int st_rdev(); public native stat64 st_rdev(int setter); /* [XSI] Device ID */ - public native @ByRef timespec st_atimespec(); public native stat64 st_atimespec(timespec setter); /* time of last access */ - public native @ByRef timespec st_mtimespec(); public native stat64 st_mtimespec(timespec setter); /* time of last data modification */ - public native @ByRef timespec st_ctimespec(); public native stat64 st_ctimespec(timespec setter); /* time of last status change */ - public native @ByRef timespec st_birthtimespec(); public native stat64 st_birthtimespec(timespec setter); /* time of file creation(birth) */ - public native @Cast("off_t") long st_size(); public native stat64 st_size(long setter); /* [XSI] file size, in bytes */ - public native @Cast("blkcnt_t") long st_blocks(); public native stat64 st_blocks(long setter); /* [XSI] blocks allocated for file */ - public native @Cast("blksize_t") int st_blksize(); public native stat64 st_blksize(int setter); /* [XSI] optimal blocksize for I/O */ - public native @Cast("__uint32_t") int st_flags(); public native stat64 st_flags(int setter); /* user defined flags for file */ - public native @Cast("__uint32_t") int st_gen(); public native stat64 st_gen(int setter); /* file generation number */ - public native @Cast("__int32_t") int st_lspare(); public native stat64 st_lspare(int setter); /* RESERVED: DO NOT USE! */ - public native @Cast("__int64_t") long st_qspare(int i); public native stat64 st_qspare(int i, long setter); - @MemberGetter public native @Cast("__int64_t*") LongPointer st_qspare(); /* RESERVED: DO NOT USE! */ -} diff --git a/systems/src/main/java/org/bytedeco/systems/presets/macosx.java b/systems/src/main/java/org/bytedeco/systems/presets/macosx.java index c2f7971609..4c92b385be 100644 --- a/systems/src/main/java/org/bytedeco/systems/presets/macosx.java +++ b/systems/src/main/java/org/bytedeco/systems/presets/macosx.java @@ -41,7 +41,7 @@ * @author Samuel Audet */ @Properties(inherit = javacpp.class, value = {@Platform(value = "macosx", define = "__STDC_WANT_LIB_EXT1__ 1", - include = {"cpuid.h", "dlfcn.h", "nl_types.h", "_xlocale.h", "xlocale.h", "_locale.h", "langinfo.h", "locale.h", + include = {"dlfcn.h", "nl_types.h", "__xlocale.h", "_xlocale.h", "xlocale.h", "_locale.h", "langinfo.h", "locale.h", "sys/uio.h", "sys/_types/_iovec_t.h", "sys/socket.h", "sys/errno.h", "string.h", "stdlib.h", /*"sys/types.h",*/ "sys/_types/_timespec.h", "sys/_types/_timeval.h", "sys/time.h", "time.h", "utime.h", "sys/_types/_s_ifmt.h", "sys/_types/_filesec_t.h", "sys/stat.h", "fcntl.h", "sys/file.h", "grp.h", "pwd.h", @@ -49,7 +49,8 @@ "sched.h", "mach/machine.h", "spawn.h", "sys/_types/_seek_set.h", "sys/unistd.h", "unistd.h", "sys/poll.h", "sys/reboot.h", "sys/resource.h", "sys/sysctl.h", "sys/wait.h", "sys/_types/_uid_t.h", "sys/_types/_gid_t.h", "sys/_types/_mode_t.h", "sys/_types/_key_t.h", "sys/ipc.h", - "sys/_types/_pid_t.h", "sys/_types/_time_t.h", "sys/_types/_size_t.h", "sys/shm.h"})}, + "sys/_types/_pid_t.h", "sys/_types/_time_t.h", "sys/_types/_size_t.h", "sys/shm.h"}, + exclude = {"__xlocale.h"})}, target = "org.bytedeco.systems.macosx", global = "org.bytedeco.systems.global.macosx") @NoException public class macosx implements LoadEnabled, BuildEnabled, InfoMapper { @@ -70,11 +71,17 @@ public void init(Logger logger, java.util.Properties properties, String encoding @Override public void init(ClassProperties properties) { + String platform = properties.getProperty("platform"); + List includePaths = properties.get("platform.includepath"); + List includes = properties.get("platform.include"); + if (platform.startsWith("macosx-x86")) { + includes.add(0, "cpuid.h"); + } if (Loader.getCallerClass(4).getName().equals("org.bytedeco.javacpp.tools.Parser")) { List includepath = properties.get("platform.includepath"); - includepath.add("/usr/include/"); - includepath.add("/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/"); - includepath.add("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/"); + includePaths.add("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/"); + includePaths.add("/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/"); + includePaths.add("/usr/include/"); } } @@ -85,13 +92,14 @@ public void map(InfoMap infoMap) { .put(new Info("__BEGIN_DECLS").cppText("#define __BEGIN_DECLS")) .put(new Info("__END_DECLS").cppText("#define __END_DECLS")) + .put(new Info("__sized_by").cppText("#define __sized_by(N)")) .put(new Info("__LP64__", "__x86_64__").define(is64bits)) .put(new Info("!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)", "__APPLE__", "__DARWIN_UNIX03").define(true)) - .put(new Info("__BLOCKS__", "!__DARWIN_UNIX03", + .put(new Info("__BLOCKS__", "!__DARWIN_UNIX03", "!__DARWIN_ONLY_64_BIT_INO_T", "__DARWIN_C_LEVEL < __DARWIN_C_FULL").define(false)) .put(new Info("__deprecated").annotations("@Deprecated").cppTypes()) @@ -137,7 +145,7 @@ public void map(InfoMap infoMap) { .put(new Info("locale_t").valueTypes("_xlocale")) .put(new Info("filesec_t").valueTypes("_filesec")) .put(new Info("struct stat").pointerTypes("stat")) - .put(new Info("struct stat64").pointerTypes("stat64")) + .put(new Info("struct stat64").pointerTypes("stat64").skip()) .put(new Info("struct timezone").pointerTypes("timezone")) .put(new Info("struct sigaction").pointerTypes("sigaction")) .put(new Info("struct sigvec").pointerTypes("sigvec"))