Re: [PATCH] add a build.sh helper to allow for a one-stop build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 10, 2016 at 09:17:11AM -0700, Bart Van Assche wrote:
> On 10/10/16 08:59, Christoph Hellwig wrote:
> >On Mon, Oct 10, 2016 at 08:56:33AM -0700, Bart Van Assche wrote:
> >>Have you considered to make this script stop immediately if one of the
> >>steps fails, e.g. as follows?
> >
> >How about just ading a
> >
> >set -e
> >
> >to the beginning to get this automatically?
> 
> That would also work. But if there is a space anywhere in the path in which
> the rdma-core repository exists, mkdir $BUILDDIR will have to be changed
> into mkdir "$BUILDDIR".

Is this OK?

>From 6362ec4c1ddec0f6b2a1bf052cdfde63cbf73d90 Mon Sep 17 00:00:00 2001
From: Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 10 Oct 2016 10:46:47 -0600
Subject: [PATCH] Add a build.sh helper to allow for a one-stop build

This allows for a quick build instead of typing the whole mkdir, cd,
cmake and ninja sequence.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Signed-off-by: Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx>
---
 README.md | 17 +----------------
 build.sh  | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 16 deletions(-)
 create mode 100755 build.sh

diff --git a/README.md b/README.md
index 98ec5a7d695f..66aee3f49f00 100644
--- a/README.md
+++ b/README.md
@@ -36,10 +36,7 @@ Additional service daemons are provided for:
 This project uses a cmake based build system. Quick start:
 
 ```sh
-$ mkdir build
-$ cd build
-$ cmake -GNinja ..
-$ ninja
+$ bash build.sh
 ```
 
 *build/bin* will contain the sample programs and *build/lib* will contain the
@@ -76,16 +73,6 @@ Install required packages:
 $ yum install cmake gcc libnl3-devel make pkgconfig valgrind-devel
 ```
 
-For end users, the package can be built using GNU Make and the old cmake
-included with the distro:
-
-```sh
-$ mkdir build
-$ cd build
-$ cmake  ..
-$ make
-```
-
 Developers are suggested to install more modern tooling for the best experience.
 
 ```sh
@@ -96,8 +83,6 @@ $ unzip ninja-linux.zip
 $ install -m755 ninja /usr/local/bin/ninja
 ```
 
-Use the 'cmake3' program in place of `cmake` in the above instructions.
-
 # Reporting bugs
 
 Bugs should be reported to the <linux-rdma@xxxxxxxxxxxxxxx> mailing list
diff --git a/build.sh b/build.sh
new file mode 100755
index 000000000000..76205e6af921
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+set -e
+
+SRCDIR=`dirname $0`
+BUILDDIR="$SRCDIR/build"
+
+if [ ! -d "$BUILDDIR" ]; then
+    mkdir "$BUILDDIR"
+fi
+
+if hash cmake3 2>/dev/null; then
+    # CentOS users are encouraged to install cmake3 from EPEL
+    CMAKE=cmake3
+else
+    CMAKE=cmake
+fi
+
+if hash ninja-build 2>/dev/null; then
+    # Fedora uses this name
+    NINJA=ninja-build
+elif hash ninja 2>/dev/null; then
+    NINJA=ninja
+fi
+
+cd "$BUILDDIR"
+
+if [ "x$NINJA" == "x" ]; then
+    cmake ..
+    make
+else
+    cmake -GNinja ..
+    $NINJA
+fi
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux