parted 1.8.7: Make buildable with latest linux-headers.
authorPaul Sokolovsky <pmiscml@gmail.com>
Tue, 10 Jul 2007 17:08:25 +0000 (17:08 +0000)
committerPaul Sokolovsky <pmiscml@gmail.com>
Tue, 10 Jul 2007 17:08:25 +0000 (17:08 +0000)
* Add an adhoc syscall macros include, and they are gone.
* Also add a hacky patch to make sure that libparted build properly
with autoconf 2.59, but it really requires 2.61.

packages/parted/files/.mtn2git_empty [new file with mode: 0644]
packages/parted/files/cross-gross-hack.patch [new file with mode: 0644]
packages/parted/files/syscalls.h [new file with mode: 0644]
packages/parted/files/syscalls.patch [new file with mode: 0644]
packages/parted/parted_1.8.7.bb

diff --git a/packages/parted/files/.mtn2git_empty b/packages/parted/files/.mtn2git_empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packages/parted/files/cross-gross-hack.patch b/packages/parted/files/cross-gross-hack.patch
new file mode 100644 (file)
index 0000000..8d2db63
--- /dev/null
@@ -0,0 +1,33 @@
+diff -ur parted-1.8.7.org/configure parted-1.8.7/configure
+--- parted-1.8.7.org/configure 2007-05-10 00:01:27.000000000 +0300
++++ parted-1.8.7/configure     2007-07-10 15:46:42.000000000 +0300
+@@ -12556,7 +12556,7 @@
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   if test "$cross_compiling" = yes; then
+-  ac_cv_func_malloc_0_nonnull=no
++  ac_cv_func_malloc_0_nonnull=yes
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+diff -ur parted-1.8.7.org/configure parted-1.8.7/configure
+--- parted-1.8.7.org/configure 2007-07-10 15:48:07.000000000 +0300
++++ parted-1.8.7/configure     2007-07-10 15:57:26.000000000 +0300
+@@ -12889,7 +12889,7 @@
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   if test "$cross_compiling" = yes; then
+-  ac_cv_func_memcmp_working=no
++  ac_cv_func_memcmp_working=yes
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
+@@ -13574,7 +13574,7 @@
+   echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
+   if test "$cross_compiling" = yes; then
+-  ac_cv_func_realloc_0_nonnull=no
++  ac_cv_func_realloc_0_nonnull=yes
+ else
+   cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h.  */
diff --git a/packages/parted/files/syscalls.h b/packages/parted/files/syscalls.h
new file mode 100644 (file)
index 0000000..9278704
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ *  linux/include/asm-arm/unistd.h
+ *
+ *  Copyright (C) 2001-2005 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Please forward _all_ changes to this file to rmk@arm.linux.org.uk,
+ * no matter what the change is.  Thanks!
+ */
+#ifndef __ASM_ARM_UNISTD_H2
+#define __ASM_ARM_UNISTD_H2
+
+
+#define __sys2(x) #x
+#define __sys1(x) __sys2(x)
+
+#ifndef __syscall
+#if defined(__thumb__) || defined(__ARM_EABI__)
+#define __SYS_REG(name) register long __sysreg __asm__("r7") = __NR_##name;
+#define __SYS_REG_LIST(regs...) "r" (__sysreg) , ##regs
+#define __syscall(name) "swi\t0"
+#else
+#define __SYS_REG(name)
+#define __SYS_REG_LIST(regs...) regs
+#define __syscall(name) "swi\t" __sys1(__NR_##name) ""
+#endif
+#endif
+
+#define __syscall_return(type, res)                                    \
+do {                                                                   \
+       if ((unsigned long)(res) >= (unsigned long)(-129)) {            \
+               errno = -(res);                                         \
+               res = -1;                                               \
+       }                                                               \
+       return (type) (res);                                            \
+} while (0)
+
+#define _syscall0(type,name)                                           \
+type name(void) {                                                      \
+  __SYS_REG(name)                                                      \
+  register long __res_r0 __asm__("r0");                                        \
+  long __res;                                                          \
+  __asm__ __volatile__ (                                               \
+  __syscall(name)                                                      \
+       : "=r" (__res_r0)                                               \
+       : __SYS_REG_LIST() );                                           \
+  __res = __res_r0;                                                    \
+  __syscall_return(type,__res);                                                \
+}
+
+#define _syscall1(type,name,type1,arg1)                                \
+type name(type1 arg1) {                                                \
+  __SYS_REG(name)                                                      \
+  register long __r0 __asm__("r0") = (long)arg1;                       \
+  register long __res_r0 __asm__("r0");                                        \
+  long __res;                                                          \
+  __asm__ __volatile__ (                                               \
+  __syscall(name)                                                      \
+       : "=r" (__res_r0)                                               \
+       : __SYS_REG_LIST( "0" (__r0) ) );                               \
+  __res = __res_r0;                                                    \
+  __syscall_return(type,__res);                                                \
+}
+
+#define _syscall2(type,name,type1,arg1,type2,arg2)                     \
+type name(type1 arg1,type2 arg2) {                                     \
+  __SYS_REG(name)                                                      \
+  register long __r0 __asm__("r0") = (long)arg1;                       \
+  register long __r1 __asm__("r1") = (long)arg2;                       \
+  register long __res_r0 __asm__("r0");                                        \
+  long __res;                                                          \
+  __asm__ __volatile__ (                                               \
+  __syscall(name)                                                      \
+       : "=r" (__res_r0)                                               \
+       : __SYS_REG_LIST( "0" (__r0), "r" (__r1) ) );                   \
+  __res = __res_r0;                                                    \
+  __syscall_return(type,__res);                                                \
+}
+
+
+#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)          \
+type name(type1 arg1,type2 arg2,type3 arg3) {                          \
+  __SYS_REG(name)                                                      \
+  register long __r0 __asm__("r0") = (long)arg1;                       \
+  register long __r1 __asm__("r1") = (long)arg2;                       \
+  register long __r2 __asm__("r2") = (long)arg3;                       \
+  register long __res_r0 __asm__("r0");                                        \
+  long __res;                                                          \
+  __asm__ __volatile__ (                                               \
+  __syscall(name)                                                      \
+       : "=r" (__res_r0)                                               \
+       : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2) ) );       \
+  __res = __res_r0;                                                    \
+  __syscall_return(type,__res);                                                \
+}
+
+
+#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\
+type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) {            \
+  __SYS_REG(name)                                                      \
+  register long __r0 __asm__("r0") = (long)arg1;                       \
+  register long __r1 __asm__("r1") = (long)arg2;                       \
+  register long __r2 __asm__("r2") = (long)arg3;                       \
+  register long __r3 __asm__("r3") = (long)arg4;                       \
+  register long __res_r0 __asm__("r0");                                        \
+  long __res;                                                          \
+  __asm__ __volatile__ (                                               \
+  __syscall(name)                                                      \
+       : "=r" (__res_r0)                                               \
+       : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), "r" (__r3) ) ); \
+  __res = __res_r0;                                                    \
+  __syscall_return(type,__res);                                                \
+}
+  
+
+#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5)    \
+type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) {        \
+  __SYS_REG(name)                                                      \
+  register long __r0 __asm__("r0") = (long)arg1;                       \
+  register long __r1 __asm__("r1") = (long)arg2;                       \
+  register long __r2 __asm__("r2") = (long)arg3;                       \
+  register long __r3 __asm__("r3") = (long)arg4;                       \
+  register long __r4 __asm__("r4") = (long)arg5;                       \
+  register long __res_r0 __asm__("r0");                                        \
+  long __res;                                                          \
+  __asm__ __volatile__ (                                               \
+  __syscall(name)                                                      \
+       : "=r" (__res_r0)                                               \
+       : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2),           \
+                         "r" (__r3), "r" (__r4) ) );                   \
+  __res = __res_r0;                                                    \
+  __syscall_return(type,__res);                                                \
+}
+
+#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
+type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) {    \
+  __SYS_REG(name)                                                      \
+  register long __r0 __asm__("r0") = (long)arg1;                       \
+  register long __r1 __asm__("r1") = (long)arg2;                       \
+  register long __r2 __asm__("r2") = (long)arg3;                       \
+  register long __r3 __asm__("r3") = (long)arg4;                       \
+  register long __r4 __asm__("r4") = (long)arg5;                       \
+  register long __r5 __asm__("r5") = (long)arg6;                       \
+  register long __res_r0 __asm__("r0");                                        \
+  long __res;                                                          \
+  __asm__ __volatile__ (                                               \
+  __syscall(name)                                                      \
+       : "=r" (__res_r0)                                               \
+       : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2),           \
+                         "r" (__r3), "r" (__r4), "r" (__r5) ) );       \
+  __res = __res_r0;                                                    \
+  __syscall_return(type,__res);                                                \
+}
+
+/*
+ * "Conditional" syscalls
+ *
+ * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
+ * but it doesn't work on all toolchains, so we just do it by hand
+ */
+#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
+
+#endif /* __ASM_ARM_UNISTD_H2 */
diff --git a/packages/parted/files/syscalls.patch b/packages/parted/files/syscalls.patch
new file mode 100644 (file)
index 0000000..be9b91c
--- /dev/null
@@ -0,0 +1,10 @@
+--- parted-1.8.7/libparted/arch/linux.c.org    2007-05-09 23:40:13.000000000 +0300
++++ parted-1.8.7/libparted/arch/linux.c        2007-07-10 18:20:27.000000000 +0300
+@@ -32,6 +32,7 @@
+ #include <stdio.h>
+ #include <syscall.h>
+ #include <unistd.h>
++#include "syscalls.h"
+ #include <dirent.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
index dcb3ad7..59e3aea 100644 (file)
@@ -3,25 +3,28 @@ HOMEPAGE = "http://www.gnu.org/software/parted/parted.html"
 LICENSE = "GPLv2"
 SECTION = "console/tools"
 DEPENDS = "readline e2fsprogs-libs"
-PR = "r1"
+PR = "r2"
 
-SRC_URI = "${GNU_MIRROR}/parted/parted-${PV}.tar.gz"
+SRC_URI = "${GNU_MIRROR}/parted/parted-${PV}.tar.gz \
+           file://syscalls.h \
+           file://syscalls.patch;patch=1 \
+           file://cross-gross-hack.patch;patch=1"
            
 EXTRA_OECONF = "--disable-Werror"
 
 inherit autotools pkgconfig
 
+do_configure_prepend() {
+       cp ${WORKDIR}/syscalls.h ${S}/libparted/arch/
+}
+
 do_configure() {
-        libtoolize --force
         gnu-configize
+        libtoolize --force
+        autoconf
         oe_runconf
 }
 
 do_stage() {
        autotools_stage_all
 }
-
-# Requires autoconf 2.61. Without it, will build, but there
-# will be link errors when some other package will link against
-# libparted.
-DEFAULT_PREFERENCE = "-1"