Subject: Re: Linux crosscompile problem
To: None <current-users@netbsd.org>
From: Christian Biere <christianbiere@gmx.de>
List: current-users
Date: 01/29/2007 21:22:06
--mYCpIKhGyMATD0i+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Juraj Hercek wrote:
> I'm having troubles compiling netbsd-current on linux host.
> ...
> It seems that le16dec is not defined on linux host (if that matters):
> Any idea how to solve this problem?
Does the attached patch work for you? I'm not sure whether to check
for __NetBSD__ or rather something else.
--
Christian
--mYCpIKhGyMATD0i+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="iso.h.udif"
Index: sys/fs/cd9660/iso.h
===================================================================
RCS file: /cvsroot/src/sys/fs/cd9660/iso.h,v
retrieving revision 1.9
diff -u -p -r1.9 iso.h
--- sys/fs/cd9660/iso.h 27 Jan 2007 07:20:31 -0000 1.9
+++ sys/fs/cd9660/iso.h 29 Jan 2007 20:17:18 -0000
@@ -171,6 +171,36 @@ struct iso_extended_attributes {
u_char len_au [ISODCL (247, 250)]; /* 723 */
};
+#ifndef __NetBSD__
+/*
+ * This duplication is necessary for cross-compilation of the tools
+ * as sys/endian.h cannot be included in this case.
+ */
+static __inline __unused uint16_t
+le16dec(const u_char *p)
+{
+ return (p[0] & 0xff) | ((p[1] & 0xff) << 8);
+}
+
+static __inline __unused uint16_t
+be16dec(const u_char *p)
+{
+ return ((p[0] & 0xff) << 8) | (p[1] & 0xff);
+}
+
+static __inline __unused uint32_t
+le32dec(const u_char *p)
+{
+ return le16dec(p) | ((uint32_t)le16dec(p + 2) << 16);
+}
+
+static __inline __unused uint32_t
+be32dec(const u_char *p)
+{
+ return ((uint32_t)be16dec(p) << 16) | be16dec(p + 2);
+}
+#endif /* !__NetBSD__ */
+
/* 7.1.1: unsigned char */
static __inline __unused int
isonum_711(const u_char *p)
--mYCpIKhGyMATD0i+--