aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2019-09-05 16:04:37 -0500
committerGanesh Viswanathan <dev@genotrance.com>2019-10-02 15:31:12 -0500
commit5bf5c7445da4849dc7bf01086ed2b7117a79ed41 (patch)
tree433ca3d7fe24b225b597e602044c5344207a3c8d
parent6bc0c4aa3b82a0ccd3144530b81a5cd922dc1bb3 (diff)
downloadnimterop-5bf5c7445da4849dc7bf01086ed2b7117a79ed41.tar.gz
nimterop-5bf5c7445da4849dc7bf01086ed2b7117a79ed41.zip
autoreconf, don't find tools
-rw-r--r--nimterop/build.nim87
1 files changed, 45 insertions, 42 deletions
diff --git a/nimterop/build.nim b/nimterop/build.nim
index 0585d36..15581eb 100644
--- a/nimterop/build.nim
+++ b/nimterop/build.nim
@@ -225,6 +225,9 @@ proc configure*(path, check: string, flags = "") =
## If a `configure` script is not present and an `autogen.sh` script
## is present, it will be run before attempting `configure`.
##
+ ## Next, if `configure.ac` or `configure.in` exist, `autoreconf` will
+ ## be executed.
+ ##
## `check` is a file that will be generated by the `configure` command.
## This is required to prevent configure from running on every build. It
## is relative to the `path` and should not be an absolute path.
@@ -236,11 +239,20 @@ proc configure*(path, check: string, flags = "") =
echo "# Configuring " & path
if not fileExists(path / "configure"):
- for i in @[path / "autogen.sh", path / "build" / "autogen.sh"]:
- if fileExists(i):
+ for i in @["autogen.sh", "build" / "autogen.sh"]:
+ if fileExists(path / i):
echo "# Running autogen.sh"
- discard execAction(&"cd {i.parentDir().quoteShell} && bash autogen.sh")
+ echo execAction(&"cd {(path / i).parentDir().quoteShell} && bash autogen.sh")
+
+ break
+
+ if not fileExists(path / "configure"):
+ for i in @["configure.ac", "configure.in"]:
+ if fileExists(path / i):
+ echo "# Running autoreconf"
+
+ echo execAction(&"cd {path.quoteShell} && autoreconf -fi")
break
@@ -438,54 +450,45 @@ proc buildLibrary(lname, outdir, conFlags, cmakeFlags, makeFlags: string): strin
cmakeDepStr = ""
lpath = findFile(re(lname), outdir)
makeFlagsProc = &"-j {getNumProcs()} {makeFlags}"
+ made = false
+ makePath = outdir
if lpath.len != 0:
return lpath
- if fileExists(outdir / "CMakeLists.txt"):
- if findExe("cmake").len != 0:
- var
- gen = ""
- when defined(windows):
- if findExe("sh").len != 0:
- gen = "MSYS Makefiles"
- else:
- gen = "MinGW Makefiles"
- else:
- gen = "Unix Makefiles"
- cmake(outdir / "build", "Makefile", &".. -G {gen.quoteShell} {cmakeFlags}")
- cmakeDeps = true
- make(outdir / "build", re(lname), makeFlagsProc)
- else:
- cmakeDepStr &= "cmake executable missing"
-
- template cfgCommon() {.dirty.} =
- configure(outdir, "Makefile", conFlags)
- conDeps = true
- make(outdir, re(lname), makeFlagsProc)
-
- if not cmakeDeps:
- if not fileExists(outdir / "configure"):
- if fileExists(outdir / "autogen.sh") or fileExists(outdir / "build" / "autogen.sh"):
- if findExe("aclocal").len != 0:
- if findExe("autoconf").len != 0:
- if findExe("libtoolize").len != 0 or findExe("glibtoolize").len != 0:
- if findExe("autopoint").len != 0:
- cfgCommon()
- else:
- conDepStr &= "autopoint executable missing"
- else:
- conDepStr &= "libtoolize executable missing"
+ if not fileExists(outdir / "Makefile"):
+ if fileExists(outdir / "CMakeLists.txt"):
+ if findExe("cmake").len != 0:
+ var
+ gen = ""
+ when defined(windows):
+ if findExe("sh").len != 0:
+ gen = "MSYS Makefiles"
else:
- conDepStr &= "autoconf executable missing"
+ gen = "MinGW Makefiles"
else:
- conDepStr &= "aclocal executable missing"
- else:
+ gen = "Unix Makefiles"
+ cmake(outdir / "build", "Makefile", &".. -G {gen.quoteShell} {cmakeFlags}")
+ cmakeDeps = true
+ makePath = outdir / "build"
+ else:
+ cmakeDepStr &= "cmake executable missing"
+
+ if not cmakeDeps:
if findExe("bash").len != 0:
- cfgCommon()
+ for file in @["configure", "configure.ac", "configure.in", "autogen.sh", "build/autogen.sh"]:
+ if fileExists(outdir / file):
+ configure(outdir, "Makefile", conFlags)
+ conDeps = true
+
+ break
else:
conDepStr &= "bash executable missing"
+ if fileExists(makePath / "Makefile"):
+ make(makePath, re(lname), makeFlagsProc)
+ made = true
+
var
error = ""
if not cmakeDeps and cmakeDepStr.len != 0:
@@ -494,7 +497,7 @@ proc buildLibrary(lname, outdir, conFlags, cmakeFlags, makeFlags: string): strin
error &= &"configure capable but {conDepStr}\n"
if error.len == 0:
error = "No build files found in " & outdir
- doAssert cmakeDeps or conDeps, &"\n# Build configuration failed - {error}\n"
+ doAssert cmakeDeps or conDeps or made, &"\n# Build configuration failed - {error}\n"
result = findFile(re(lname), outdir)