1# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6# this script will configure and build microhttpd in a temp directory and then
7# copy the static library generated to a destination folder
8import argparse
9import os
10from subprocess import call
11import shutil
12import tempfile
13
14parser = argparse.ArgumentParser()
15parser.add_argument("--src", help="microhttpd src directory")
16parser.add_argument("--dst", help="output for build files")
17args = parser.parse_args()
18
19temp_dir = tempfile.mkdtemp()
20cwd = os.getcwd()
21os.chdir(temp_dir)
22call([cwd + "/" + args.src + "/configure",
23      "--disable-doc",
24      "--disable-examples",
25      "--enable-https=no",
26      "--disable-curl",
27      "--enable-spdy=no",
28      "--enable-shared=no"])
29call(["make", "--silent"])
30call(["cp",
31      temp_dir + "/src/microhttpd/.libs/libmicrohttpd.a",
32      cwd + "/" + args.dst])
33shutil.rmtree(temp_dir)
34
35