autoreconf, don't find tools
This commit is contained in:
parent
6bc0c4aa3b
commit
5bf5c7445d
1 changed files with 45 additions and 42 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue