Skip Conan and JBB deps
This commit is contained in:
parent
d95deffb6a
commit
74c9506529
5 changed files with 55 additions and 20 deletions
|
|
@ -53,6 +53,8 @@ https://github.com/nimterop/nimterop/compare/v0.5.9...v0.6.5
|
||||||
|
|
||||||
- Added `renderPragma()` to create pragmas inline in case `cImport()` is not being used. (since v0.6.5)
|
- Added `renderPragma()` to create pragmas inline in case `cImport()` is not being used. (since v0.6.5)
|
||||||
|
|
||||||
|
- `xxxConan` and `xxxJBB` now allow skipping required dependencies by specifying `skip=pkg1,pkg2` to the `conanFlags` and `jbbFlags` params to `getHeader()`. (since v0.6.6)
|
||||||
|
|
||||||
### Other improvements
|
### Other improvements
|
||||||
|
|
||||||
- Generated wrappers no longer depend on nimterop being present - no more `import nimterop/types`. Supporting code is directly included in the wrapper output and only when required. E.g. enum macro is only included if wrapper contains enums. [#125][i125] (since v0.6.1)
|
- Generated wrappers no longer depend on nimterop being present - no more `import nimterop/types`. Supporting code is directly included in the wrapper output and only when required. E.g. enum macro is only included if wrapper contains enums. [#125][i125] (since v0.6.1)
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ Flags can be specified to these tools via `getHeader()` or directly via the unde
|
||||||
|
|
||||||
If `-d:headerStatic` is specified, `getHeader()` will return the static library path in `headerLPath`. The wrapper writer can check for this and call `cImport()` accordingly as in the example above. If `-d:headerStatic` is omitted, the dynamic library is returned in `headerLPath`.
|
If `-d:headerStatic` is specified, `getHeader()` will return the static library path in `headerLPath`. The wrapper writer can check for this and call `cImport()` accordingly as in the example above. If `-d:headerStatic` is omitted, the dynamic library is returned in `headerLPath`.
|
||||||
|
|
||||||
All dependency libraries (supported by Conan and JBB) will be returned in `headerLDeps`. Static libraries and dependencies are automatically linked using `cPassL()`. Conan shared libs include all dependencies whereas JBB shared libs expect the required dependencies to be in the same location or in `LD_LIBRARY_PATH`.
|
All dependency libraries (supported by Conan and JBB) will be returned in `headerLDeps`. Static libraries and dependencies are automatically linked using `cPassL()`. Conan shared libs typically include dependencies compiled in whereas JBB shared libs expect the required dependencies to be in the same location or in `LD_LIBRARY_PATH`. `conanFlags` and `jbbFlags` can be used to skip required dependencies from being downloaded in case another source is preferred. This can be done with `skip=pkg1,pkg2` to these flags.
|
||||||
|
|
||||||
`getHeader()` searches for libraries based on the header name by default:
|
`getHeader()` searches for libraries based on the header name by default:
|
||||||
- `libheader.so` or `libheader.a` on Linux
|
- `libheader.so` or `libheader.a` on Linux
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ type
|
||||||
staticLibs*: seq[string]
|
staticLibs*: seq[string]
|
||||||
requires*: seq[ConanPackage]
|
requires*: seq[ConanPackage]
|
||||||
|
|
||||||
|
skipRequires*: seq[string]
|
||||||
|
|
||||||
ConanBuild* = ref object
|
ConanBuild* = ref object
|
||||||
## Build type that stores build specific info and revisions
|
## Build type that stores build specific info and revisions
|
||||||
bhash*: string
|
bhash*: string
|
||||||
|
|
@ -245,7 +247,10 @@ proc getConanBuilds*(pkg: ConanPackage, filter = "") =
|
||||||
bld.options = newTable[string, string](8)
|
bld.options = newTable[string, string](8)
|
||||||
for key, value in options.getFields():
|
for key, value in options.getFields():
|
||||||
bld.options[key] = value.getStr()
|
bld.options[key] = value.getStr()
|
||||||
bld.requires = requires.to(seq[string])
|
for req in requires.to(seq[string]):
|
||||||
|
# Filter skipped dependencies
|
||||||
|
if req.toLowerAscii() notin pkg.skipRequires:
|
||||||
|
bld.requires.add req
|
||||||
bld.recipe_hash = bdata.getOrDefault("recipe_hash").getStr()
|
bld.recipe_hash = bdata.getOrDefault("recipe_hash").getStr()
|
||||||
|
|
||||||
if pkg.recipes.hasKey(bld.recipe_hash):
|
if pkg.recipes.hasKey(bld.recipe_hash):
|
||||||
|
|
@ -422,6 +427,7 @@ proc dlConanRequires*(pkg: ConanPackage, bld: ConanBuild, outdir: string) =
|
||||||
else:
|
else:
|
||||||
let
|
let
|
||||||
rpkg = newConanPackageFromUri(req, shared = false)
|
rpkg = newConanPackageFromUri(req, shared = false)
|
||||||
|
rpkg.skipRequires = pkg.skipRequires
|
||||||
|
|
||||||
downloadConan(rpkg, outdir, main = false)
|
downloadConan(rpkg, outdir, main = false)
|
||||||
pkg.requires.add rpkg
|
pkg.requires.add rpkg
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ proc getDlPath(header, url, outdir, version: string): string =
|
||||||
|
|
||||||
result = findFile(header, outdir)
|
result = findFile(header, outdir)
|
||||||
|
|
||||||
proc getConanPath(header, uri, outdir, version: string, shared: bool): string =
|
proc getConanPath(header, uri, flags, outdir, version: string, shared: bool): string =
|
||||||
var
|
var
|
||||||
uri = uri
|
uri = uri
|
||||||
|
|
||||||
|
|
@ -131,6 +131,15 @@ proc getConanPath(header, uri, outdir, version: string, shared: bool): string =
|
||||||
|
|
||||||
let
|
let
|
||||||
pkg = newConanPackageFromUri(uri, shared)
|
pkg = newConanPackageFromUri(uri, shared)
|
||||||
|
|
||||||
|
# Handle `conanFlags`
|
||||||
|
if flags.nBl:
|
||||||
|
for flag in flags.split(" "):
|
||||||
|
if flag.startsWith("skip="):
|
||||||
|
for req in flag["skip=".len .. ^1].split(","):
|
||||||
|
if req.nBl:
|
||||||
|
pkg.skipRequires.add req.toLowerAscii()
|
||||||
|
|
||||||
downloadConan(pkg, outdir)
|
downloadConan(pkg, outdir)
|
||||||
|
|
||||||
result = findFile(header, outdir)
|
result = findFile(header, outdir)
|
||||||
|
|
@ -165,16 +174,21 @@ proc getJBBPath(header, uri, flags, outdir, version: string): string =
|
||||||
|
|
||||||
# Handle `jbbFlags`
|
# Handle `jbbFlags`
|
||||||
if flags.nBl:
|
if flags.nBl:
|
||||||
if flags.startsWith("giturl="):
|
for flag in flags.split(" "):
|
||||||
let
|
if flag.startsWith("giturl="):
|
||||||
val = flags["giturl=".len .. ^1]
|
let
|
||||||
if val.contains("://"):
|
val = flag["giturl=".len .. ^1]
|
||||||
pkg.baseUrl = val
|
if val.contains("://"):
|
||||||
else:
|
pkg.baseUrl = val
|
||||||
pkg.baseUrl = "https://github.com/" & val
|
else:
|
||||||
elif flags.startsWith("url="):
|
pkg.baseUrl = "https://github.com/" & val
|
||||||
pkg.baseUrl = flags["url=".len .. ^1]
|
elif flag.startsWith("url="):
|
||||||
pkg.isGit = false
|
pkg.baseUrl = flag["url=".len .. ^1]
|
||||||
|
pkg.isGit = false
|
||||||
|
elif flag.startsWith("skip="):
|
||||||
|
for req in flag["skip=".len .. ^1].split(","):
|
||||||
|
if req.nBl:
|
||||||
|
pkg.skipRequires.add req.toLowerAscii()
|
||||||
|
|
||||||
downloadJBB(pkg, outdir)
|
downloadJBB(pkg, outdir)
|
||||||
|
|
||||||
|
|
@ -227,7 +241,7 @@ macro getHeader*(
|
||||||
conanuri: static[string] = "", jbburi: static[string] = "",
|
conanuri: static[string] = "", jbburi: static[string] = "",
|
||||||
outdir: static[string] = "", libdir: static[string] = "",
|
outdir: static[string] = "", libdir: static[string] = "",
|
||||||
conFlags: static[string] = "", cmakeFlags: static[string] = "", makeFlags: static[string] = "",
|
conFlags: static[string] = "", cmakeFlags: static[string] = "", makeFlags: static[string] = "",
|
||||||
jbbFlags: static[string] = "", altNames: static[string] = "",
|
conanFlags: static[string] = "", jbbFlags: static[string] = "", altNames: static[string] = "",
|
||||||
buildTypes: static[openArray[BuildType]] = [btCmake, btAutoconf]): untyped =
|
buildTypes: static[openArray[BuildType]] = [btCmake, btAutoconf]): untyped =
|
||||||
## Get the path to a header file for wrapping with
|
## Get the path to a header file for wrapping with
|
||||||
## `cImport() <cimport.html#cImport.m%2C%2Cstring%2Cstring%2Cstring>`_ or
|
## `cImport() <cimport.html#cImport.m%2C%2Cstring%2Cstring%2Cstring>`_ or
|
||||||
|
|
@ -300,7 +314,12 @@ macro getHeader*(
|
||||||
## `cmake` and `make` in case additional configuration is required as part of the build
|
## `cmake` and `make` in case additional configuration is required as part of the build
|
||||||
## process.
|
## process.
|
||||||
##
|
##
|
||||||
## `jbbFlags` allows changing the BinaryBuilder.org defaults:
|
## `conanFlags` and `jbbFlags` allow changing the Conan.io and BinaryBuilder.org defaults:
|
||||||
|
## - `skip=pkg1,pkg2` skips the specified packages which are required dependencies of the
|
||||||
|
## package in question. This enables downloading those dependencies from other sources
|
||||||
|
## if required.
|
||||||
|
##
|
||||||
|
## `jbbFlags` allows two additional customizations:
|
||||||
## - `giturl=customUrl` changes the default `https://github.com/JuliaBinaryWrappers` to
|
## - `giturl=customUrl` changes the default `https://github.com/JuliaBinaryWrappers` to
|
||||||
## another Git URL. If no hostname is specified, `https://github.com` is assumed.
|
## another Git URL. If no hostname is specified, `https://github.com` is assumed.
|
||||||
## - `url=customUrl` uses regular HTTP instead of Git and looks for `Artifacts.toml` and
|
## - `url=customUrl` uses regular HTTP instead of Git and looks for `Artifacts.toml` and
|
||||||
|
|
@ -402,13 +421,14 @@ macro getHeader*(
|
||||||
`nameStatic`* = when defined(`nameStatic`): true else: `staticVal` == 1
|
`nameStatic`* = when defined(`nameStatic`): true else: `staticVal` == 1
|
||||||
|
|
||||||
# Search for header in outdir (after retrieving code) depending on -d:xxx mode
|
# Search for header in outdir (after retrieving code) depending on -d:xxx mode
|
||||||
proc getPath(header, giturl, dlurl, conanuri, jbburi, jbbFlags, outdir, version: string, shared: bool): string =
|
proc getPath(header, giturl, dlurl, conanuri, conanFlags, jbburi, jbbFlags,
|
||||||
|
outdir, version: string, shared: bool): string =
|
||||||
when `nameGit`:
|
when `nameGit`:
|
||||||
getGitPath(header, giturl, outdir, version)
|
getGitPath(header, giturl, outdir, version)
|
||||||
elif `nameDL`:
|
elif `nameDL`:
|
||||||
getDlPath(header, dlurl, outdir, version)
|
getDlPath(header, dlurl, outdir, version)
|
||||||
elif `nameConan`:
|
elif `nameConan`:
|
||||||
getConanPath(header, conanuri, outdir, version, shared)
|
getConanPath(header, conanuri, conanFlags, outdir, version, shared)
|
||||||
elif `nameJBB`:
|
elif `nameJBB`:
|
||||||
getJBBPath(header, jbburi, jbbFlags, outdir, version)
|
getJBBPath(header, jbburi, jbbFlags, outdir, version)
|
||||||
else:
|
else:
|
||||||
|
|
@ -441,7 +461,7 @@ macro getHeader*(
|
||||||
when useStd:
|
when useStd:
|
||||||
stdPath
|
stdPath
|
||||||
else:
|
else:
|
||||||
getPath(`header`, `giturl`, `dlurl`, `conanuri`, `jbburi`, `jbbFlags`,
|
getPath(`header`, `giturl`, `dlurl`, `conanuri`, `conanFlags`, `jbburi`, `jbbFlags`,
|
||||||
`outdir`, `version`, not `nameStatic`)
|
`outdir`, `version`, not `nameStatic`)
|
||||||
|
|
||||||
# Run preBuild hook before building library if not Std, Conan or JBB
|
# Run preBuild hook before building library if not Std, Conan or JBB
|
||||||
|
|
@ -477,7 +497,7 @@ macro getHeader*(
|
||||||
if prePath.len != 0:
|
if prePath.len != 0:
|
||||||
prePath
|
prePath
|
||||||
else:
|
else:
|
||||||
getPath(`header`, `giturl`, `dlurl`, `conanuri`, `jbburi`, `jbbFlags`,
|
getPath(`header`, `giturl`, `dlurl`, `conanuri`, `conanFlags`, `jbburi`, `jbbFlags`,
|
||||||
`outdir`, `version`, not `nameStatic`)
|
`outdir`, `version`, not `nameStatic`)
|
||||||
|
|
||||||
static:
|
static:
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ type
|
||||||
staticLibs*: seq[string]
|
staticLibs*: seq[string]
|
||||||
requires*: seq[JBBPackage]
|
requires*: seq[JBBPackage]
|
||||||
|
|
||||||
|
skipRequires*: seq[string]
|
||||||
|
|
||||||
const
|
const
|
||||||
# JBB URLs
|
# JBB URLs
|
||||||
jbbBaseUrl = "https://github.com/JuliaBinaryWrappers"
|
jbbBaseUrl = "https://github.com/JuliaBinaryWrappers"
|
||||||
|
|
@ -73,7 +75,12 @@ proc parseJBBProject(pkg: JBBPackage, outdir: string) =
|
||||||
let
|
let
|
||||||
name = line.split()[0]
|
name = line.split()[0]
|
||||||
if name.endsWith("_jll"):
|
if name.endsWith("_jll"):
|
||||||
pkg.requires.add newJBBPackage(name[0 .. ^5], "")
|
# Filter skipped dependencies
|
||||||
|
let
|
||||||
|
pname = name[0 .. ^5]
|
||||||
|
if pname.toLowerAscii() notin pkg.skipRequires:
|
||||||
|
pkg.requires.add newJBBPackage(pname, "")
|
||||||
|
pkg.requires[^1].skipRequires = pkg.skipRequires
|
||||||
|
|
||||||
proc parseJBBArtifacts(pkg: JBBPackage, outdir: string) =
|
proc parseJBBArtifacts(pkg: JBBPackage, outdir: string) =
|
||||||
# Get build information from Artifacts.toml
|
# Get build information from Artifacts.toml
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue