[haiku-commits] haiku: hrev51657 - /

  • From: waddlesplash@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 6 Dec 2017 00:19:15 +0100 (CET)

hrev51657 adds 2 changesets to branch 'master'
old head: 825700d34a486eb381bc4e80262ff38a2deaeac0
new head: fc2c93fbecde745145f17f5f475541189632092c
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=fc2c93fbecde+%5E825700d34a48

----------------------------------------------------------------------------

a5c952db0d06: configure: Actually check the host's support for extended 
attributes.
  
  Previously the helptext just displayed a warning to "make sure your
  file system supports sufficient attribute sizes", and left the
  actual checks to libroot_build at runtime.
  
  Now we use the native command-line tools of each platform to make sure
  that we can actually set attributes large enough for --use-xattr and
  --use-xattr-ref respectively.

fc2c93fbecde: configure: Enable use-xattr or use-xattr-ref automatically.
  
  The previous commit only checked that they worked if the user
  enabled them, but now they will be enabled automatically if the
  underlying filesystem supports them.
  
  The ReadMe.Compiling has been updated accordingly.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 114 insertions(+), 34 deletions(-)
ReadMe.Compiling.md |  43 +++++++++++---------
configure           | 105 +++++++++++++++++++++++++++++++++++++++++-------

############################################################################

Commit:      a5c952db0d0617d0bb5846d4c38de297c0a356b6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a5c952db0d06
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Tue Dec  5 21:18:57 2017 UTC

configure: Actually check the host's support for extended attributes.

Previously the helptext just displayed a warning to "make sure your
file system supports sufficient attribute sizes", and left the
actual checks to libroot_build at runtime.

Now we use the native command-line tools of each platform to make sure
that we can actually set attributes large enough for --use-xattr and
--use-xattr-ref respectively.

----------------------------------------------------------------------------

diff --git a/configure b/configure
index ce9d380..a06d210 100755
--- a/configure
+++ b/configure
@@ -88,17 +88,14 @@ options:
   --use-gcc-pipe              Build with GCC option -pipe. Speeds up the build
                               process, but uses more memory.
   --use-gcc-graphite          Build with GCC Graphite engine for loop
-                              optimizations. Only for gcc 4.
+                              optimizations. (Only for GCC 4+.)
   --use-32bit                 Use -m32 flag on 64bit host gcc compiler.
-  --use-xattr                 Use Linux xattr respectively *BSD extattr support
-                              for BeOS attribute emulation. Warning: Make sure
-                              your file system supports sufficient attribute
-                              sizes (4 KB per file for all attributes won't
-                              suffice).
-  --use-xattr-ref             Use the generic BeOS attribute emulation, but use
-                              Linux xattr respectively *BSD extattr support to
-                              make it more robust (i.e. attribute mix-ups 
become
-                              less likely).
+  --use-xattr                 Use Linux/*BSD's native extended file attributes
+                              for Haiku extended attributes.
+  --use-xattr-ref             Use the generic Haiku attribute emulation, but 
use
+                              Linux/*BSD's native extended attributes to make 
it
+                              more robust (i.e. attribute mix-ups become
+                              less likely.)
   --with-gdb <gdb sources dir>
                               specify the path to a GDB source dir, to build
                               GDB for each arch we build the cross-tools for.
@@ -385,6 +382,68 @@ get_build_tool_path()
        eval "$var=\"$path $cmd\""
 }
 
+# check_native_xattrs
+#
+# Checks the host platform's support for extended attributes.
+# 0: no support, 1: only enough for xattr-ref, 2: full support
+#
+check_native_xattrs()
+{
+       local xattr_set=
+       local xattr_set_args=
+       local xattr_get=
+       local xattr_get_args=
+       case $HOST_PLATFORM in
+               darwin)
+                       xattr_set="xattr"; xattr_set_args="-w \$NAME 
\"\$VALUE\""
+                       xattr_get="xattr"; xattr_get_args="-p \$NAME"
+                       ;;
+               freebsd)
+                       xattr_set="setextattr"; xattr_set_args="user \$NAME 
\"\$VALUE\""
+                       xattr_get="getextattr"; xattr_get_args="user \$NAME"
+                       ;;
+               linux)
+                       xattr_set="setfattr"; xattr_set_args="-n user.\$NAME -v 
\"\$VALUE\""
+                       xattr_get="getfattr"; xattr_get_args="-n user.\$NAME"
+                       ;;
+               *)
+                       return 0
+                       ;;
+       esac
+       if ! type $xattr_set >/dev/null 2>&1; then
+               echo "$0: could not find $xattr_set, assuming host has no 
extended attributes"
+               return 0
+       elif ! type $xattr_get >/dev/null 2>&1; then
+               echo "$0: could not find $xattr_get, assuming host has no 
extended attributes"
+               return 0
+       fi
+
+       echo "xattr test file" >"$outputDir/xattrtest"
+       local i=0
+       # on round 0, we test if we can set 3 attrs of 1K each (enough for 
xattr-ref)
+       # on round 1, we test if we can set 3 attrs of 45K each (enough for 
full xattr)
+       while [ $i -lt 2 ]; do
+               local j=0
+               while [ $j -lt 3 ]; do
+                       NAME=attr$j
+                       VALUE=`printf '%*s' $((1024 + $i * 45056)) "" | tr ' ' 
x`
+                       if [ `echo -n $VALUE | wc -c` -lt $((1024 + $i * 
45056)) ]; then
+                               echo "$0: warning: could not generate test data 
for extended attributes"
+                               rm "$outputDir/xattrtest"
+                               return $i
+                       elif ! $xattr_set `eval echo \"$xattr_set_args\"` \
+                                       "$outputDir/xattrtest" >/dev/null 2>&1 
; then
+                               rm "$outputDir/xattrtest"
+                               return $i
+                       fi
+                       j=$((j+1))
+               done
+               i=$((i+1))
+       done
+       rm "$outputDir/xattrtest"
+       return 2
+}
+
 is_in_list()
 {
        local element
@@ -684,6 +743,29 @@ if [ $caseInsensitive != 0 ]; then
        exit 1
 fi
 
+# check xattr support
+if [ $HOST_PLATFORM != "haiku_host" ] && [ $HAIKU_HOST_USE_XATTR != 0 ] \
+               || [ $HAIKU_HOST_USE_XATTR_REF != 0 ]; then
+       if [ $HAIKU_HOST_USE_XATTR != 0 ] && [ $HAIKU_HOST_USE_XATTR_REF != 0 
]; then
+               echo "$0: error: both --use-xattr and --use-xattr-ref cannot be 
specified."
+               exit 1
+       fi
+       check_native_xattrs
+       attrSupport=$?
+       if [ $attrSupport = 2 ]; then
+               0; # all is well, we don't need to do anything
+       elif [ $attrSupport = 1 ]; then
+               if [ $HAIKU_HOST_USE_XATTR != 0 ]; then
+                       echo "$0: error: full extended attributes requested but 
host" \
+                               "only has support for xattr-ref."
+                       exit 1
+               fi
+       else
+               echo "$0: error: host platform has no support for extended 
attributes."
+               exit 1
+       fi
+fi
+
 # determine how to invoke sed with extended regexp support for non-GNU sed
 if [ $HOST_PLATFORM = "darwin" ]; then
        HOST_EXTENDED_REGEX_SED="sed -E"

############################################################################

Revision:    hrev51657
Commit:      fc2c93fbecde745145f17f5f475541189632092c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=fc2c93fbecde
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Tue Dec  5 21:58:11 2017 UTC

configure: Enable use-xattr or use-xattr-ref automatically.

The previous commit only checked that they worked if the user
enabled them, but now they will be enabled automatically if the
underlying filesystem supports them.

The ReadMe.Compiling has been updated accordingly.

----------------------------------------------------------------------------

diff --git a/ReadMe.Compiling.md b/ReadMe.Compiling.md
index c28e8a3..e59a718 100644
--- a/ReadMe.Compiling.md
+++ b/ReadMe.Compiling.md
@@ -1,16 +1,16 @@
 Building Haiku
 ==========================
 This is a overview into the process of building HAIKU from source.
-An online version is available at <https://haiku-os.org/guides/building/>.
+An online version is available at <https://www.haiku-os.org/guides/building/>.
 
-Official releases of Haiku are at <https://haiku-os.org/get-haiku>.
+Official releases of Haiku are at <https://www.haiku-os.org/get-haiku>.
 The (unstable) nightly builds are available at 
<https://download.haiku-os.org/>.
 
 We currently support the following platforms:
  * Haiku
  * Linux
  * FreeBSD
- * Mac OS X
+ * macOS
 
 Required Software
 ----------------------------
@@ -20,18 +20,17 @@ Tools provided within Haiku's repositories:
 
 The tools to compile Haiku will vary, depending on the platform that you are
 using to build Haiku. When building from Haiku, all of the necessary
-development tools are included in official releases (e.g. R1 alpha4) and in the
+development tools are included in official releases (e.g. R1/alpha4) and in the
 nightly builds.
 
  * `git`
- * `ssh` (for developers with commit access)
  * `gcc`/`g++` and binutils (`as`, `ld`, etc., required by GCC)
  * (GNU) `make`
  * `bison` (2.4 or better)
  * `flex` and `lex` (usually a mini shell script invoking `flex`)
  * `makeinfo` (part of `texinfo`, only needed for building GCC 4)
  * `autoheader` (part of `autoconf`, needed for building GCC)
- * `automake`
+ * `automake` (needed for building GCC)
  * `gawk`
  * `nasm`
  * `wget`
@@ -52,7 +51,7 @@ If you want to compile Haiku for ARM, you will also need:
  * `mkimage` (<http://www.denx.de/wiki/U-Boot/WebHome>)
  * Mtools (<https://gnu.org/software/mtools/intro.html>)
 
-### On Mac OS X
+### On macOS
 
 Disk Utility can create a case-sensitive disk image of at least 3 GiB in size.
 The following ports need to be installed:
@@ -119,32 +118,38 @@ update the source tree very frequently, you may want to 
execute `configure`
 after each update just to be on the safe side.
 
 Depending on your goal, there are several different ways to configure Haiku.
-You can either call configure from within your Haiku trunk folder. That will
-prepare a folder named 'generated', which will contain the compiled objects.
+The first way is to call configure from within your Haiku checkout's root. That
+will prepare a folder named 'generated', which will contain the compiled 
objects.
 Another option is to manually created one or more `generated.*` folders and run
 configure from within them. For example, imagine the following directory setup:
 ```
-buildtools-trunk/
-haiku-trunk/
-haiku-trunk/generated.x86gcc2
+buildtools/
+haiku/
+haiku/generated.x86gcc2
 ```
 
-### Configure a GCC 2.95 Hybrid, from a non-Haiku platform
+### Configure a GCC 2.95/GCC 5 Hybrid, from a non-Haiku platform
 ```bash
-cd haiku-trunk/generated.x86gcc2
-../configure --use-xattr-ref \
+cd haiku/generated.x86gcc2
+../configure \
        --build-cross-tools x86_gcc2 ../../buildtools/ \
        --build-cross-tools x86
 ```
 
-### Configure a GCC 2.95 Hybrid, from Haiku
+### Configure an x86_64 (GCC 5) build, from a non-Haiku platform
 ```
-cd haiku-trunk/generated.x86gcc2
+cd haiku/generated.x86_64
+../configure --build-cross-tools x86_64 ../../buildtools/
+```
+
+### Configure a GCC 2.95/GCC 5 Hybrid, from Haiku
+```
+cd haiku/generated.x86gcc2
 ../configure --target-arch x86_gcc2 --target-arch x86
 ```
 
 Additional information about GCC Hybrids can be found on the website,
-<https://haiku-os.org/guides/building/gcc-hybrid>.
+<https://www.haiku-os.org/guides/building/gcc-hybrid>.
 
 ### Configure options
 The various runtime options for configure are documented in its onscreen help
@@ -231,7 +236,7 @@ BootManager
 ```
 
 ### On Emulated Hardware
-For emulated hardware you should build disk image (see above). How to set up
+For emulated hardware you should build a disk image (see above). How to set up
 this image depends on your emulator. If you use QEMU, you can usually just
 provide the path to the image as command line argument to the `qemu`
 executable.
diff --git a/configure b/configure
index a06d210..5368bf9 100755
--- a/configure
+++ b/configure
@@ -90,12 +90,13 @@ options:
   --use-gcc-graphite          Build with GCC Graphite engine for loop
                               optimizations. (Only for GCC 4+.)
   --use-32bit                 Use -m32 flag on 64bit host gcc compiler.
-  --use-xattr                 Use Linux/*BSD's native extended file attributes
-                              for Haiku extended attributes.
-  --use-xattr-ref             Use the generic Haiku attribute emulation, but 
use
-                              Linux/*BSD's native extended attributes to make 
it
-                              more robust (i.e. attribute mix-ups become
-                              less likely.)
+  --no-full-xattr             Do not use Linux/*BSD/Darwin's native extended 
file
+                              attributes as Haiku attributes. If they are still
+                              available, they will be used to store hashes for
+                              the attribute emulation layer.
+  --no-xattr                  Do not use Linux/*BSD/Darwin's native extended 
file
+                              attributes for Haiku extended attributes at all,
+                              even if they are available.
   --with-gdb <gdb sources dir>
                               specify the path to a GDB source dir, to build
                               GDB for each arch we build the cross-tools for.
@@ -515,8 +516,8 @@ HAIKU_DISTRO_COMPATIBILITY=default
 TARGET_PLATFORM=haiku
 HAIKU_USE_GCC_PIPE=0
 HAIKU_HOST_USE_32BIT=0
-HAIKU_HOST_USE_XATTR=0
-HAIKU_HOST_USE_XATTR_REF=0
+HAIKU_HOST_USE_XATTR=
+HAIKU_HOST_USE_XATTR_REF=
 HAIKU_HOST_BUILD_ONLY=0
 HOST_EXTENDED_REGEX_SED="sed -r"
 HOST_GCC_LD=`$CC -print-prog-name=ld`
@@ -583,7 +584,9 @@ if [ "$1" = "--update" ]; then
                exit 1
        fi
        cd $lastPwd
-       export $lastEnv
+       if [ -n "$lastEnv" ]; then
+               export $lastEnv
+       fi
        $lastConfig $lastArgs
        exit $?
 fi
@@ -706,8 +709,8 @@ while [ $# -gt 0 ] ; do
                --use-gcc-pipe) HAIKU_USE_GCC_PIPE=1; shift 1;;
                --use-gcc-graphite)     useGccGraphiteDefault=1; shift 1;;
                --use-32bit)    HAIKU_HOST_USE_32BIT=1; shift 1;;
-               --use-xattr)    HAIKU_HOST_USE_XATTR=1; shift 1;;
-               --use-xattr-ref)        HAIKU_HOST_USE_XATTR_REF=1; shift 1;;
+               --no-full-xattr)HAIKU_HOST_USE_XATTR=0; shift 1;;
+               --no-xattr)             HAIKU_HOST_USE_XATTR_REF=0; shift 1;;
                --with-gdb)     gdbSources=$2; shift 2;;
                *)                              echo Invalid argument: \`$1\'; 
exit 1;;
        esac
@@ -744,27 +747,17 @@ if [ $caseInsensitive != 0 ]; then
 fi
 
 # check xattr support
-if [ $HOST_PLATFORM != "haiku_host" ] && [ $HAIKU_HOST_USE_XATTR != 0 ] \
-               || [ $HAIKU_HOST_USE_XATTR_REF != 0 ]; then
-       if [ $HAIKU_HOST_USE_XATTR != 0 ] && [ $HAIKU_HOST_USE_XATTR_REF != 0 
]; then
-               echo "$0: error: both --use-xattr and --use-xattr-ref cannot be 
specified."
-               exit 1
-       fi
+if [ $HOST_PLATFORM != "haiku_host" ] && [ -z $HAIKU_HOST_USE_XATTR_REF ]; then
        check_native_xattrs
        attrSupport=$?
-       if [ $attrSupport = 2 ]; then
-               0; # all is well, we don't need to do anything
+       if [ $attrSupport = 2 ] && [ -z $HAIKU_HOST_USE_XATTR ]; then
+               HAIKU_HOST_USE_XATTR=1
        elif [ $attrSupport = 1 ]; then
-               if [ $HAIKU_HOST_USE_XATTR != 0 ]; then
-                       echo "$0: error: full extended attributes requested but 
host" \
-                               "only has support for xattr-ref."
-                       exit 1
-               fi
-       else
-               echo "$0: error: host platform has no support for extended 
attributes."
-               exit 1
+               HAIKU_HOST_USE_XATTR_REF=1
        fi
 fi
+if [ -z $HAIKU_HOST_USE_XATTR ]; then HAIKU_HOST_USE_XATTR=0; fi
+if [ -z $HAIKU_HOST_USE_XATTR_REF ]; then HAIKU_HOST_USE_XATTR_REF=0; fi
 
 # determine how to invoke sed with extended regexp support for non-GNU sed
 if [ $HOST_PLATFORM = "darwin" ]; then


Other related posts:

  • » [haiku-commits] haiku: hrev51657 - / - waddlesplash