webkitgtk-cmake-buildapi.patch 3.26 KB
Newer Older
Emmanuele Bassi's avatar
Emmanuele Bassi committed
1
From 807c94e0a70b61e6ada0c50ba518fe9c0a2d5825 Mon Sep 17 00:00:00 2001
2
From: Emmanuele Bassi <ebassi@gnome.org>
3 4 5 6
Date: Fri, 21 Nov 2014 11:12:07 +0100
Subject: [PATCH] build: Add a "configure" script implementing the GNOME Build
 API

7 8 9 10 11 12
Original patch from: Debarshi Ray <debarshir@gnome.org>

v2:
  - Fix whitespace issues
  - Add -GNinja switch

13 14 15
v3:
  - Generate a Makefile wrapper for Ninja

16 17
See https://github.com/cgwalters/build-api
---
18 19
 configure | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)
20 21 22 23
 create mode 100755 configure

diff --git a/configure b/configure
new file mode 100755
Emmanuele Bassi's avatar
Emmanuele Bassi committed
24
index 0000000..b2816c0
25 26
--- /dev/null
+++ b/configure
27
@@ -0,0 +1,93 @@
28 29 30 31
+#!/bin/bash
+# configure script adapter for cmake
+# Copyright 2010, 2011, 2013 Colin Walters <walters@verbum.org>
+# Copyright 2014 Debarshi Ray <debarshir@gnome.org>
32
+# Copyright 2017 Emmanuele Bassi <ebassi@gnome.org>
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
+# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
+
+prefix=/usr
+
+# Little helper function for reading args from the commandline.
+# it automatically handles -a b and -a=b variants, and returns 1 if
+# we need to shift $3.
+read_arg() {
+    # $1 = arg name
+    # $2 = arg value
+    # $3 = arg parameter
+    local rematch='^[^=]*=(.*)$'
+    if [[ $2 =~ $rematch ]]; then
+        read "$1" <<< "${BASH_REMATCH[1]}"
+    else
+        read "$1" <<< "$3"
+        # There is no way to shift our callers args, so
+        # return 1 to indicate they should do it instead.
+        return 1
+    fi
+}
+
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
+sanitycheck() {
+    # $1 = arg name
+    # $1 = arg command
+    # $2 = arg alternates
+    local cmd=$( which $2 2>/dev/null )
+    if [ -x "$cmd" ]; then
+        read "$1" <<< "$cmd"
+        return 0
+    fi
+    test -z $3 || {
+        for alt in $3; do
+            cmd=$( which $alt 2>/dev/null )
+            if [ -x "$cmd" ]; then
+                read "$1" <<< "$cmd"
+                return 0
+            fi
+        done
+    }
+    echo -e "\e[1;31mERROR\e[0m: Command '$2' not found"
+    exit 1
+}
+
+sanitycheck NINJA 'ninja' 'ninja-build'
+
79 80
+while (($# > 0)); do
+    case "${1%%=*}" in
81 82 83 84 85 86 87 88 89 90
+        --prefix) read_arg prefix "$@" || shift;;
+        --bindir) read_arg bindir "$@" || shift;;
+        --sbindir) read_arg sbindir "$@" || shift;;
+        --libexecdir) read_arg libexecdir "$@" || shift;;
+        --datarootdir) read_arg datarootdir "$@" || shift;;
+        --datadir) read_arg datadir "$@" || shift;;
+        --sysconfdir) read_arg sysconfdir "$@" || shift;;
+        --libdir) read_arg libdir "$@" || shift;;
+        --mandir) read_arg mandir "$@" || shift;;
+        *) echo "Ignoring unknown option '$1'";;
91 92 93 94 95 96
+    esac
+    shift
+done
+
+srcdir=$(dirname $0)
+
97 98 99
+unset CFLAGS
+unset CXXFLAGS
+
100 101 102 103
+cat > Makefile <<END
+# Generated by configure; do not edit
+
+all:
Emmanuele Bassi's avatar
Emmanuele Bassi committed
104
+	${NINJA}
105 106
+
+install:
Emmanuele Bassi's avatar
Emmanuele Bassi committed
107
+	DESTDIR="\$(DESTDIR)" ${NINJA} install
108 109
+END
+
110
+exec cmake \
111 112 113
+     -DPORT=GTK \
+     -DCMAKE_BUILD_TYPE=Release \
+     -DENABLE_GTKDOC=OFF \
114
+     -DUSE_LIBHYPHEN=OFF \
115 116
+     -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
+     -DLIB_INSTALL_DIR:PATH=${libdir} \
117 118
+     -DCMAKE_C_FLAGS="-m64 -mtune=generic -Wl,--no-keep-memory" \
+     -DCMAKE_CXX_FLAGS="-m64 -mtune=generic -Wl,--no-keep-memory" \
119
+     -GNinja \
120
+     ${srcdir}
121
-- 
122
2.9.3
123