Title: [286934] trunk/Source/bmalloc
Revision
286934
Author
commit-qu...@webkit.org
Date
2021-12-12 23:16:02 -0800 (Sun, 12 Dec 2021)

Log Message

[libpas] make build.sh, test.sh, build_and_test.sh, and clean.sh work on Linux
https://bugs.webkit.org/show_bug.cgi?id=233821

Patch by Zan Dobersek <zdober...@igalia.com> on 2021-12-12
Reviewed by Yusuke Suzuki.

Adjust and enhance the shell scripts for building and testing CMake
builds of libpas. In build.sh, the 'cmake' SDK option handling is added,
invoking CMake to produce a libpas build of the desired variant and
configuration. The Debug and Release configuration possibilities map
exactly to the CMAKE_BUILD_TYPE option. The ENABLE_PAS_TESTING option
used for the testing variant is converted into a macro definition that's
passed to both CMAKE_C_FLAGS and CMAKE_CXX_FLAGS.

The function declarations are adjusted to use the "fname()" form, making
things runnable on shells that don't support the "function" keyword.

* libpas/build.sh:
* libpas/common.sh:
* libpas/test.sh:

Modified Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (286933 => 286934)


--- trunk/Source/bmalloc/ChangeLog	2021-12-13 03:23:12 UTC (rev 286933)
+++ trunk/Source/bmalloc/ChangeLog	2021-12-13 07:16:02 UTC (rev 286934)
@@ -1,3 +1,25 @@
+2021-12-12  Zan Dobersek  <zdober...@igalia.com>
+
+        [libpas] make build.sh, test.sh, build_and_test.sh, and clean.sh work on Linux
+        https://bugs.webkit.org/show_bug.cgi?id=233821
+
+        Reviewed by Yusuke Suzuki.
+
+        Adjust and enhance the shell scripts for building and testing CMake
+        builds of libpas. In build.sh, the 'cmake' SDK option handling is added,
+        invoking CMake to produce a libpas build of the desired variant and
+        configuration. The Debug and Release configuration possibilities map
+        exactly to the CMAKE_BUILD_TYPE option. The ENABLE_PAS_TESTING option
+        used for the testing variant is converted into a macro definition that's
+        passed to both CMAKE_C_FLAGS and CMAKE_CXX_FLAGS.
+
+        The function declarations are adjusted to use the "fname()" form, making
+        things runnable on shells that don't support the "function" keyword.
+
+        * libpas/build.sh:
+        * libpas/common.sh:
+        * libpas/test.sh:
+
 2021-12-09  Alex Christensen  <achristen...@webkit.org>
 
         Prepare for transition to C++20

Modified: trunk/Source/bmalloc/libpas/build.sh (286933 => 286934)


--- trunk/Source/bmalloc/libpas/build.sh	2021-12-13 03:23:12 UTC (rev 286933)
+++ trunk/Source/bmalloc/libpas/build.sh	2021-12-13 07:16:02 UTC (rev 286934)
@@ -24,10 +24,10 @@
 
 . common.sh
 
-function build_variant {
+build_variant_xcodebuild() {
     variant=$1
-    extra_xcodebuild_options="$2"
-    target=$3
+    target=$2
+    extra_xcodebuild_options="EXTRA_DEFINES=$3"
     
     build_dir=build-$sdk-$variant
     mkdir -p $build_dir
@@ -43,7 +43,7 @@
             
     case $target in
         mbmalloc|all)
-            function link_mbmalloc_personality {
+            link_mbmalloc_personality() {
                 personality=$1
                 
                 mkdir -p $build_dir/$configdir/mbmalloc_$personality
@@ -60,17 +60,58 @@
     esac
 }
 
-function build_variants {
+build_variant_cmake() {
+    variant=$1
+    target=$2
+    extra_options=$3
+
+    case $config in
+        Release)
+            ;;
+        Debug)
+            ;;
+        *)
+            echo "Bad value of config"
+            exit 1
+    esac
+
+    build_dir=build-$sdk-$variant/$configdir
+    mkdir -p $build_dir
+
+    extra_cmake_options=""
+    for option in $extra_options; do
+        extra_cmake_options="${extra_cmake_options} -D${option}"
+    done
+    extra_cmake_options=\"${extra_cmake_options#* }\"
+
+    echo $extra_cmake_options
+
+    cmake -DCMAKE_BUILD_TYPE=$config -DCMAKE_C_FLAGS=$extra_cmake_options -DCMAKE_CXX_FLAGS=$extra_cmake_options -B $build_dir
+    cmake --build $build_dir --parallel
+}
+
+build_variant() {
+    case $sdk in
+        cmake)
+            build_variant_cmake $@
+            ;;
+        *)
+            build_variant_xcodebuild
+            ;;
+    esac
+}
+
+build_variants() {
     target=$1
     
     case $variants in
         all|testing)
-            build_variant testing "EXTRA_DEFINES=ENABLE_PAS_TESTING" $target
+            build_variant testing $target "ENABLE_PAS_TESTING"
             ;;
     esac
     case $variants in
         all|default)
-            build_variant default "EXTRA_DEFINES=" $target
+            build_variant default $target ""
             ;;
     esac
 }

Modified: trunk/Source/bmalloc/libpas/common.sh (286933 => 286934)


--- trunk/Source/bmalloc/libpas/common.sh	2021-12-13 03:23:12 UTC (rev 286933)
+++ trunk/Source/bmalloc/libpas/common.sh	2021-12-13 07:16:02 UTC (rev 286934)
@@ -31,7 +31,7 @@
 target=all
 port=10022
 
-function show_help {
+show_help() {
     set +x
     echo "$0 [-hcsavtpb]"
     echo

Modified: trunk/Source/bmalloc/libpas/test.sh (286933 => 286934)


--- trunk/Source/bmalloc/libpas/test.sh	2021-12-13 03:23:12 UTC (rev 286933)
+++ trunk/Source/bmalloc/libpas/test.sh	2021-12-13 07:16:02 UTC (rev 286934)
@@ -24,7 +24,7 @@
 
 . common.sh
 
-function copy_variant {
+copy_variant() {
     variant=$1
     
     tar -czvf /dev/stdout build-$sdk-$variant/$configdir test-impl.sh common.sh | \
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to