diff options
author | 2016-01-25 10:50:04 -0800 | |
---|---|---|
committer | 2016-01-25 10:50:04 -0800 | |
commit | 8cc3f4e38ff241547a2e1f2a4160491dc8579e7c (patch) | |
tree | 792ddf2ec96f4e34b3fed013181b1fc8394c29a6 | |
parent | 89061ed2e74d826fa5d018f117020eb7b1a1032d (diff) |
Build and link microhttpd from gyp
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1628363002
Review URL: https://codereview.chromium.org/1628363002
-rw-r--r-- | gyp/microhttpd.gyp | 43 | ||||
-rw-r--r-- | gyp/skiaserve.gyp | 15 | ||||
-rw-r--r-- | third_party/libmicrohttpd/build.py | 34 |
3 files changed, 78 insertions, 14 deletions
diff --git a/gyp/microhttpd.gyp b/gyp/microhttpd.gyp new file mode 100644 index 0000000000..58ea0baa74 --- /dev/null +++ b/gyp/microhttpd.gyp @@ -0,0 +1,43 @@ +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# A simple gyp file to generate microhttpd for internal purposes +# most of the work(configure and make) is performed in a python script +{ + 'targets': [ + { + 'target_name': 'microhttpd', + 'type': 'static_library', + 'variables': { + 'base_dir%': '../third_party/libmicrohttpd', + 'src_dir%': '../third_party/externals/microhttpd', + }, + 'direct_dependent_settings': { + 'include_dirs': [ + '<(src_dir)/src/include', + ], + # for reasons I can't quite fathom, we need the below line to trigger + # a link + 'libraries': [ + 'libmicrohttpd.a', + ], + }, + 'actions': [ + { + 'action_name': 'configure_and_build', + 'inputs': [ + '<(PRODUCT_DIR)/', + ], + 'outputs': [ '<(PRODUCT_DIR)/libmicrohttpd.a' ], + 'action': [ + 'python', + '<(base_dir)/build.py', + '--src', '<(src_dir)', + '--dst', '<(PRODUCT_DIR)', + ], + }, + ], + }, + ], +} diff --git a/gyp/skiaserve.gyp b/gyp/skiaserve.gyp index 806d72f9b8..e5d125c154 100644 --- a/gyp/skiaserve.gyp +++ b/gyp/skiaserve.gyp @@ -12,11 +12,6 @@ { 'target_name': 'skiaserve', 'type': 'executable', - 'include_dirs': [ - '../src/core', - #TODO make this a real project - '../third_party/externals/microhttpd/src/include', - ], 'sources': [ '<!@(python find.py ../tools/skiaserve "*.cpp")', ], @@ -24,20 +19,12 @@ 'flags.gyp:flags', 'gputest.gyp:skgputest', 'jsoncpp.gyp:jsoncpp', + 'microhttpd.gyp:microhttpd', 'skia_lib.gyp:skia_lib', 'tools.gyp:crash_handler', 'tools.gyp:proc_stats', 'tools.gyp:resources', ], - #TODO real libmicrohttpd gyp - 'link_settings': { - 'ldflags': [ - '-L../../third_party/externals/microhttpd/src/microhttpd/.libs', - ], - 'libraries': [ - '-lmicrohttpd', - ], - }, }, ], } diff --git a/third_party/libmicrohttpd/build.py b/third_party/libmicrohttpd/build.py new file mode 100644 index 0000000000..cafcbeac88 --- /dev/null +++ b/third_party/libmicrohttpd/build.py @@ -0,0 +1,34 @@ +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# this script will configure and build microhttpd in a temp directory and then +# copy the static library generated to a destination folder +import argparse +import os +from subprocess import call +import shutil +import tempfile + +parser = argparse.ArgumentParser() +parser.add_argument("--src", help="microhttpd src directory") +parser.add_argument("--dst", help="output for build files") +args = parser.parse_args() + +temp_dir = tempfile.mkdtemp() +cwd = os.getcwd() +os.chdir(temp_dir) +call([cwd + "/" + args.src + "/configure", + "--disable-doc", + "--disable-examples", + "--enable-https=no", + "--disable-curl", + "--enable-spdy=no", + "--enable-shared=no"]) +call(["make", "--silent"]) +call(["cp", + temp_dir + "/src/microhttpd/.libs/libmicrohttpd.a", + cwd + "/" + args.dst]) +shutil.rmtree(temp_dir) + |