joshualitt | 8cc3f4e | 2016-01-25 10:50:04 -0800 | [diff] [blame] | 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 |
| 8 | import argparse |
| 9 | import os |
| 10 | from subprocess import call |
| 11 | import shutil |
| 12 | import tempfile |
| 13 | |
| 14 | parser = argparse.ArgumentParser() |
| 15 | parser.add_argument("--src", help="microhttpd src directory") |
bungeman | 51190df | 2016-03-09 07:42:54 -0800 | [diff] [blame] | 16 | parser.add_argument("--out", help="build directory") |
| 17 | parser.add_argument("--dst", help="output for final build products") |
joshualitt | 8cc3f4e | 2016-01-25 10:50:04 -0800 | [diff] [blame] | 18 | args = parser.parse_args() |
| 19 | |
bungeman | 51190df | 2016-03-09 07:42:54 -0800 | [diff] [blame] | 20 | out_dir = args.out |
joshualitt | 8cc3f4e | 2016-01-25 10:50:04 -0800 | [diff] [blame] | 21 | cwd = os.getcwd() |
bungeman | 51190df | 2016-03-09 07:42:54 -0800 | [diff] [blame] | 22 | try: |
| 23 | os.makedirs(out_dir) |
| 24 | except OSError as e: |
| 25 | pass |
| 26 | |
| 27 | os.chdir(out_dir) |
| 28 | call([os.path.join(cwd, args.src, "configure"), |
joshualitt | 8cc3f4e | 2016-01-25 10:50:04 -0800 | [diff] [blame] | 29 | "--disable-doc", |
| 30 | "--disable-examples", |
| 31 | "--enable-https=no", |
| 32 | "--disable-curl", |
| 33 | "--enable-spdy=no", |
| 34 | "--enable-shared=no"]) |
| 35 | call(["make", "--silent"]) |
| 36 | call(["cp", |
bungeman | 51190df | 2016-03-09 07:42:54 -0800 | [diff] [blame] | 37 | "src/microhttpd/.libs/libmicrohttpd.a", |
| 38 | os.path.join(cwd, args.dst)]) |