diff --git a/compiler/compiler-build-settings.stanza b/compiler/compiler-build-settings.stanza index bbec9ce46..84f4a29a6 100644 --- a/compiler/compiler-build-settings.stanza +++ b/compiler/compiler-build-settings.stanza @@ -21,6 +21,7 @@ public defstruct BuildSettings : ccflags: Tuple> flags: Tuple macro-plugins: Tuple + link-type: Symbol|False with: printer => true diff --git a/compiler/compiler-linking.stanza b/compiler/compiler-linking.stanza index f94e8c9de..bdfa33727 100644 --- a/compiler/compiler-linking.stanza +++ b/compiler/compiler-linking.stanza @@ -70,7 +70,8 @@ public defmulti issue-error (e:LinkerEnv, err:LinkingError) -> False ;will induce. Note that foreign-packages are not allowed here, only ccfiles and ccflags. public defmulti foreign-package-manager-dependencies (e:LinkerEnv, params:ForeignPackageParamsStmt, - platform:Symbol) + platform:Symbol, + link-type:Symbol) -> ProjDependencies ;Report to the caller that the external dependencies have been computed. @@ -88,7 +89,8 @@ public defmulti computed-build-commands (e:LinkerEnv, stmts:Tuple) public defmulti satisfy-foreign-packages (e:LinkerEnv, files:ForeignPackageFiles, params:ForeignPackageParamsStmt, - platform:Symbol) -> True|False + platform:Symbol, + link-type:Symbol) -> True|False ;Called to report to the caller that an external dependency has already been built. public defmulti notify-external-dependency-up-to-date (e:LinkerEnv, @@ -146,11 +148,13 @@ public defn link (input:LinkerInput, env:LinkerEnv) -> False : ;Satisfy the foreign package dependencies. val build-platform = platform(build-settings(input)) as Symbol + val link-type = link-type(build-settings(input)) as Symbol for package in foreign-packages(dependencies(deps)) do : satisfy-foreign-packages(env, package, package-manager-params(proj(input), package-manager(package)), - build-platform) + build-platform, + link-type) ;Execute the given build commands if they are not ;already up-to-date. @@ -308,7 +312,8 @@ defn compute-dependencies (result:CompilationResult, match(get?(package-params, package-manager(package))) : (params:ForeignPackageParamsStmt) : val platform = platform(settings) as Symbol - add(new-deps, foreign-package-manager-dependencies(env, params, platform)) + val link-type = link-type(settings) as Symbol + add(new-deps, foreign-package-manager-dependencies(env, params, platform, link-type)) (f:False) : encountered-error(NoConfigurationForPackageManager(package-manager(package), files(package))) diff --git a/compiler/compiler.stanza b/compiler/compiler.stanza index dc2ad89e3..4ec5d49ab 100644 --- a/compiler/compiler.stanza +++ b/compiler/compiler.stanza @@ -51,7 +51,7 @@ defn compute-build-settings (projenv:StandardProjEnv, match(inputs(settings)) : (inputs:BuildTarget) : val proj-files = default-proj-files() - val proj = read-proj-files(proj-files, platform, projenv) + val proj = read-proj-files(proj-files, platform, default-link-type(link-type(settings)), projenv) ;Retrieve build target statement val s = build-target!(proj, target(inputs)) ;Compute build flags @@ -101,7 +101,8 @@ defn compute-build-settings (projenv:StandardProjEnv, build-ccfiles, build-ccflags, to-tuple(build-flags), - macro-plugins(settings)) + macro-plugins(settings), + link-type(settings)) ;Return new settings. [proj, settings*] @@ -109,7 +110,7 @@ defn compute-build-settings (projenv:StandardProjEnv, (inputs:BuildPackages) : val proj-files = default-proj-files() add-all(proj-files, /proj-files(names(inputs))) - val proj = read-proj-files(proj-files, platform, projenv) + val proj = read-proj-files(proj-files, platform, default-link-type(link-type(settings)), projenv) val inputs* = BuildPackages $ to-tuple $ non-files-to-symbols $ non-proj-files $ names $ inputs val vm-packages* = to-tuple $ non-files-to-symbols $ vm-packages $ settings val build-out = add-exe-suffix?(output(settings), platform) @@ -277,15 +278,17 @@ public defn compile (settings:BuildSettings, system:System, verbose?:True|False) add(errors, err) defmethod foreign-package-manager-dependencies (this, params:ForeignPackageParamsStmt, - platform:Symbol) : + platform:Symbol, + link-type:Symbol) : val pm = package-manager(projenv, package-manager(params)) - system-dependencies(pm, to-params(params, platform)) + system-dependencies(pm, to-params(params, platform, link-type)) defmethod satisfy-foreign-packages (this, files:ForeignPackageFiles, params:ForeignPackageParamsStmt, - platform:Symbol) : + platform:Symbol, + link-type:Symbol) : val pm = package-manager(projenv, package-manager(files)) - satisfy-dependencies(pm, /files(files), to-params(params, platform), package-manager-system()) + satisfy-dependencies(pm, /files(files), to-params(params, platform, link-type), package-manager-system()) defmethod computed-dependencies (this, deps:ProjDependencies) : if external-dependencies(settings) is String : val filename = external-dependencies(settings) as String diff --git a/compiler/conan-package-manager.stanza b/compiler/conan-package-manager.stanza index 8b0608915..7c4e3c188 100644 --- a/compiler/conan-package-manager.stanza +++ b/compiler/conan-package-manager.stanza @@ -185,9 +185,17 @@ public defn ConanPackageManager () -> ForeignPackageManager : ; Now call 'conan install' in the conan root directory. val conanlog = to-string("%_/conanlog.txt" % [conan-build-dir]) val additional-flags = lookup(entries(params), `conan-install-extra-args) + val shared-flags = + if link-type(params) == `dynamic : + to-tuple $ for package in packages seq : + val name = next(split(package, "/")) + [ "-o" string-join([name ":shared=True"])] + else : + [] val install-args = flatten-tuple $ [ "install" conan-build-dir "--install-folder" conan-build-dir + shared-flags additional-flags] call-conan(install-args, conanlog) diff --git a/compiler/defs-db.stanza b/compiler/defs-db.stanza index 48237f91a..f11bdbd86 100644 --- a/compiler/defs-db.stanza +++ b/compiler/defs-db.stanza @@ -79,7 +79,7 @@ public defn defs-db (input:DefsDbInput, filename:String) : protected-when(TESTING) defn analyze-input (input:DefsDbInput) -> DependencyResult : ;Read all listed packages from given project files - val proj-file = read-proj-files(proj-files(input), platform(input), StandardProjEnv()) + val proj-file = read-proj-files(proj-files(input), platform(input), default-link-type(false), StandardProjEnv()) val stanza-files = all-package-files(proj-file) val proj-and-stanza-files = to-tuple $ cat(proj-files(input), stanza-files) @@ -97,7 +97,8 @@ protected-when(TESTING) defn analyze-input (input:DefsDbInput) -> DependencyResu [], ;ccfiles [], ;ccflags flags(input) ;flags - macro-plugins(input)) ;macro-plugin + macro-plugins(input) ;macro-plugin + false) ;Compute dependencies (compiles to IL-IR) dependencies(build-settings, true) diff --git a/compiler/foreign-package-manager.stanza b/compiler/foreign-package-manager.stanza index c72fde75a..39ea5d4a6 100644 --- a/compiler/foreign-package-manager.stanza +++ b/compiler/foreign-package-manager.stanza @@ -27,6 +27,7 @@ public defn registered-foreign-package-managers () -> Tuple> ;This represents the capability of a foreign package manager. diff --git a/compiler/main.stanza b/compiler/main.stanza index d70fe694b..1a3c96eff 100644 --- a/compiler/main.stanza +++ b/compiler/main.stanza @@ -223,6 +223,8 @@ val COMMON-STANZA-FLAGS = [ "Requests the compiler to output the .pkg files. The name of the folder to store the output .pkg files can be optionally provided.") Flag("optimize", ZeroFlag, OptionalFlag, "Requests the compiler to compile in optimized mode.") + Flag("link", OneFlag, OptionalFlag, + "Provide the type of linking to use.") Flag("ccfiles", ZeroOrMoreFlag, OptionalFlag, "The set of C language files to link the final generated assembly against to produce the final executable.") Flag("ccflags", GreedyFlag, OptionalFlag, @@ -301,7 +303,8 @@ defn compile-command () : get?(cmd-args, "ccfiles", []) ccflags map(to-symbol, get?(cmd-args, "flags", [])) - get?(cmd-args, "macros", [])) + get?(cmd-args, "macros", []) + false) ;Launch! within run-with-timing-log(cmd-args) : @@ -345,7 +348,8 @@ defn build-command () : [] ccflags map(to-symbol, get?(cmd-args, "flags", [])) - get?(cmd-args, "macros", [])) + get?(cmd-args, "macros", []), + link?(get?(cmd-args, "link", false))) ;Launch! within run-with-timing-log(cmd-args) : @@ -355,7 +359,7 @@ defn build-command () : ;Command definition Command("build", ZeroOrOneArg, "the name of the build target. If not supplied, the default build target is 'main'.", - common-stanza-flags(["s" "o" "external-dependencies" "pkg" "flags" "optimize" "verbose" "ccflags" "macros" "timing-log"]), + common-stanza-flags(["s" "o" "external-dependencies" "pkg" "flags" "optimize" "verbose" "ccflags" "macros" "link" "timing-log"]), build-msg, intercept-no-match-exceptions(build)) ;============================================================ @@ -412,7 +416,8 @@ defn extend-command () : get?(cmd-args, "ccfiles", []) ccflags map(to-symbol, get?(cmd-args, "flags", [])) - get?(cmd-args, "macros", [])) + get?(cmd-args, "macros", []) + false) ;Launch! run-with-timing-log(main, cmd-args) @@ -481,7 +486,8 @@ defn compile-test-command () : get?(cmd-args, "ccfiles", []) ccflags new-flags - get?(cmd-args, "macros", [])) + get?(cmd-args, "macros", []) + false) ;Launch! run-with-timing-log(main, cmd-args) @@ -547,7 +553,8 @@ defn compile-macros-command () : get?(cmd-args, "ccfiles", []) ccflags get?(cmd-args, "flags", []) - get?(cmd-args, "macros", [])) + get?(cmd-args, "macros", []), + false) ;Launch! run-with-timing-log(main, cmd-args) @@ -930,7 +937,8 @@ defn analyze-dependencies-command () : [] [] map(to-symbol, get?(cmd-args, "flags", [])) - get?(cmd-args, "macros", [])) + get?(cmd-args, "macros", []), + false) ;Launch! run-with-timing-log(main, cmd-args) @@ -1000,7 +1008,8 @@ defn auto-doc-command () : [] [] map(to-symbol, get?(cmd-args, "flags", [])) - get?(cmd-args, "macros", [])) + get?(cmd-args, "macros", []) + false) ;Launch! run-with-timing-log(main, cmd-args) @@ -1113,6 +1122,9 @@ defn AsmFile? (filename:String|False) -> AsmFile|False : match(filename:String) : AsmFile(filename,false) +defn link? (arg:String|False) -> Symbol|False : + match(arg:String) : to-symbol(arg) + ;============================================================ ;==================== Main Commands ========================= ;============================================================ diff --git a/compiler/params.stanza b/compiler/params.stanza index 843852049..d5bd77815 100644 --- a/compiler/params.stanza +++ b/compiler/params.stanza @@ -50,6 +50,24 @@ public defn platform-flag (platform:Symbol) -> Symbol : `linux : `PLATFORM-LINUX `windows : `PLATFORM-WINDOWS +;======== Link Types ========= +public defn supported-link-type? (l:Symbol) : + contains?([`dynamic, `static], l) + +public defn ensure-supported-link-types (l:Symbol) : + if not supported-link-type?(l) : + throw $ Exception("%_ is not a supported link-type." % [l]) + +public defn link-flag (link-type:Symbol) -> Symbol : + switch(link-type) : + `static : `LINK-STATIC + `dynamic : `LINK-DYNAMIC + +public defn default-link-type (link:Symbol|False) -> Symbol : + match(link) : + (l:Symbol) : l + (l:False) : `static + ;======= Versions ======== public defn valid-stanza-version-format? (xs:Tuple) -> True|False : if length(xs) == 3 : diff --git a/compiler/proj-env.stanza b/compiler/proj-env.stanza index cb64d31b2..cea6f62bb 100644 --- a/compiler/proj-env.stanza +++ b/compiler/proj-env.stanza @@ -24,7 +24,8 @@ public defmulti foreign-package-managers (env:ProjEnv) -> Tuple Tuple> : [] diff --git a/compiler/proj-normalization.stanza b/compiler/proj-normalization.stanza index a34fe0488..cc3821d47 100644 --- a/compiler/proj-normalization.stanza +++ b/compiler/proj-normalization.stanza @@ -13,14 +13,16 @@ defpackage stz/proj-normalization : ;This pass normalizes all ProjValue within the proj file. ;- Collapses all CondPlatform values into a single value. +;- Collapses all CondLink values into a single value. ;- Collapses all SplicedString values into an AtomValue containing a String. ;- Guarantees that ProjValues do not recursively contain ProjValues. public defn normalize (f:ProjFileS0, current-platform:Symbol, + current-link-type:Symbol, dirtable:SpecialDirTable) -> ProjFileS0 : defn norm (item:ProjItem) -> ProjItem : - match(item:ProjValue) : normalize(item, current-platform, dirtable) + match(item:ProjValue) : normalize(item, current-platform, current-link-type, dirtable) else : map(norm, item) val new-stmts = map({norm(_) as ProjStmt}, stmts(f)) sub-stmts(f, new-stmts) @@ -33,10 +35,11 @@ public defn normalize (f:ProjFileS0, ;- proj-path: The full path of the ProjFile containing this value. public defn normalize (v:ProjValue, current-platform:Symbol, + current-link-type:Symbol, workdir:String, proj-path:String) -> ProjValue : val dirtable = SpecialDirTable(workdir, proj-path) - normalize(v, current-platform, dirtable) + normalize(v, current-platform, current-link-type, dirtable) ;============================================================ ;=================== Value Normalization ==================== @@ -44,13 +47,16 @@ public defn normalize (v:ProjValue, ;Normalize the given value under the given platform. ;- Collapses all CondPlatform values into a single value. +;- Collapses all CondLink values into a single value. ;- Separates SplicedString values that contain ProjValues. ;- Guarantees that ProjValues do not recursively contain ProjValues. defn normalize (v:ProjValue, platform:Symbol, + link-type:Symbol, dirtable:SpecialDirTable) -> ProjValue : v $> eval-condplatform{_, platform} + $> eval-condlink{_, link-type} $> substitute-special-dirs{_, dirtable} $> collapse-spliced-strings $> flatten-projvalues @@ -71,6 +77,22 @@ defn eval-condplatform (v:ProjValue, platform:Symbol) -> ProjValue : val result = map(eval-condplatform{_ as ProjValue, platform}, v) result as ProjValue +;============================================================ +;++================ Evaluate CondLink ======================= +;============================================================ + +;Evaluate all CondLink in the given ProjValue. +defn eval-condlink (v:ProjValue, link-type:Symbol) -> ProjValue : + match(v:CondLink) : + for e in values(v) first! : + if key(e) == link-type or key(e) == `else : + One(eval-condlink(value(e), link-type)) + else : + None() + else : + val result = map(eval-condlink{_ as ProjValue, link-type}, v) + result as ProjValue + ;============================================================ ;================= Collapse SplicedString =================== ;============================================================ @@ -78,7 +100,8 @@ defn eval-condplatform (v:ProjValue, platform:Symbol) -> ProjValue : ;If a SplicedString contains a ProjValues, then treat the ;values as if they contain a separator, and hence splits up the ;overall string into multiple separate values. -;The input SplicedString assumes that values contain no CondPlatform. +;The input SplicedString assumes that values contain +;no CondPlatform and no CondLink. defn collapse-spliced-strings (v:ProjValue) -> ProjValue : val result = map(collapse-spliced-strings{_ as ProjValue}, v) diff --git a/compiler/proj-reader.stanza b/compiler/proj-reader.stanza index 8e3c12ddb..7672d2e9e 100644 --- a/compiler/proj-reader.stanza +++ b/compiler/proj-reader.stanza @@ -72,11 +72,11 @@ defsyntax stanza-projfile : DylibDirectoryStmtS0(closest-info(), dirs) defrule projstmt = (package ?package:#symbol! requires #:! (?rs:#require! ...)) : - val dylib = entry?(rs, `dylib) + val dylibs = entry?(rs, `dylibs) val ccfiles = entry?(rs, `ccfiles) val ccflags = entry?(rs, `ccflags) val fpackages = entries(rs, `foreign-packages) - RequiresStmtS0(closest-info(), package, dylib, ccfiles, ccflags, fpackages) + RequiresStmtS0(closest-info(), package, dylibs, ccfiles, ccflags, fpackages) defrule projstmt = (import ?package:#symbol! when-imported ?deps:#projvalue!) : ImportWhenStmtS0(closest-info(), package, deps) @@ -143,6 +143,9 @@ defsyntax stanza-projfile : defrule projvalue = (on-platform #:! (?es:#key-projvalue! ...)) : CondPlatform(closest-info(), to-tuple(es)) + defrule projvalue = (on-link #:! (?es:#key-projvalue! ...)) : + CondLink(closest-info(), to-tuple(es)) + defproduction key-projvalue! : KeyValue defrule key-projvalue! = (?key:#symbol! #:! ?v:#projvalue!) : key => v @@ -175,7 +178,7 @@ defsyntax stanza-projfile : ;----------------- Require Statement Entries -------------- ;---------------------------------------------------------- defproduction require! : KeyValue - defrule require! = (dynamic-library #:! ?v:#projvalue!) : `dylib => v + defrule require! = (dynamic-libraries #:! ?v:#projvalue!) : `dylibs => v defrule require! = (ccfiles #:! ?v:#projvalue!) : `ccfiles => v defrule require! = (ccflags #:! ?v:#projvalue!) : `ccflags => v defrule require! = (?fps:#foreign-packages) : `foreign-packages => fps diff --git a/compiler/proj-stage0.stanza b/compiler/proj-stage0.stanza index 136a96a78..8962e100c 100644 --- a/compiler/proj-stage0.stanza +++ b/compiler/proj-stage0.stanza @@ -165,6 +165,17 @@ public defstruct CondPlatform <: ProjValue : values: Tuple> with: (printer => true) +;Represents a value that is conditional on the +;desired link. +;Example: +; on-link : +; dynamic : something +; static : something-else +public defstruct CondLink <: ProjValue : + info: FileInfo|False with: (as-method => true, updater => sub-info) + values: Tuple> +with: (printer => true) + ;Represents a reference to a defined variable. ;Example: ; {MYVAR} @@ -301,6 +312,7 @@ public defn map (f:ProjItem -> ProjItem, x:?T&ProjItem) -> T : (x:ForeignPackageParamsStmtS0) : ForeignPackageParamsStmtS0(info(x), package-manager(x), h(projdir(x)), h(entries(x))) (x:AtomValue) : x (x:CondPlatform) : CondPlatform(info(x), h(values(x))) + (x:CondLink) : CondLink(info(x), h(values(x))) (x:VarValue) : x (x:ProjValues) : ProjValues(info(x), h(values(x))) (x:ProjTuple) : ProjTuple(info(x), h(value(x))) diff --git a/compiler/proj-variable-substitution.stanza b/compiler/proj-variable-substitution.stanza index d0d172004..bd98a98d6 100644 --- a/compiler/proj-variable-substitution.stanza +++ b/compiler/proj-variable-substitution.stanza @@ -249,4 +249,5 @@ defn check-valid-substitution (v:ProjValue) -> String|False : (v:ProjTuple) : check-valid-substitution(value(v)) (v:ProjTableS0) : "table" (v:CondPlatform) : find-by(seq(check-valid-substitution{value(_)}, values(v))) + (v:CondLink) : find-by(seq(check-valid-substitution{value(_)}, values(v))) \ No newline at end of file diff --git a/compiler/proj-wellformedness.stanza b/compiler/proj-wellformedness.stanza index 72898312a..2d92ce152 100644 --- a/compiler/proj-wellformedness.stanza +++ b/compiler/proj-wellformedness.stanza @@ -23,7 +23,7 @@ public defmulti check (wf:ProjWellformedness, f:ProjFileS0) -> False ;=========== General Wellformedness Algorithm =============== ;============================================================ -public defn ProjWellformedness (platform:Symbol, +public defn ProjWellformedness (platform:Symbol, link-type:Symbol, env:ProjEnv) -> ProjWellformedness : ;Create table of package manager info. @@ -35,7 +35,7 @@ public defn ProjWellformedness (platform:Symbol, val errors = Vector() ;Check for wellformedness and duplicates. - check-wellformed(f, platform, package-manager-table, errors) + check-wellformed(f, platform, link-type, package-manager-table, errors) check-duplicates(f, errors) ;Throw errors if there is any. @@ -49,6 +49,7 @@ public defn ProjWellformedness (platform:Symbol, ;Recursing into subitems are handled by the caller. defmulti check-item-wellformed (x:ProjItem, platform:Symbol, + link-type:Symbol, pmtable:HashTable, errors:Vector) -> False : false @@ -56,6 +57,7 @@ defmulti check-item-wellformed (x:ProjItem, ;Included files must end with .proj. defmethod check-item-wellformed (x:IncludeStmtS0, platform:Symbol, + link-type:Symbol, pmtable:HashTable, errors:Vector) : if not suffix?(path(x), ".proj") : @@ -65,6 +67,7 @@ defmethod check-item-wellformed (x:IncludeStmtS0, ;Check whether the platforms are properly handled. defmethod check-item-wellformed (x:CondPlatform, platform:Symbol, + link-type:Symbol, pmtable:HashTable, errors:Vector) : ;Check whether all the platforms are either supported platforms, or @@ -91,8 +94,39 @@ defmethod check-item-wellformed (x:CondPlatform, val msg = "There is no available option for the current platform '%~'." % [platform] add(errors, ProjFileError(info(x), to-string(msg))) +;Check whether the platforms are properly handled. +defmethod check-item-wellformed (x:CondLink, + platform:Symbol, + link-type:Symbol, + pmtable:HashTable, + errors:Vector) : + ;Check whether all the platforms are either supported link types, or + ;the 'else' keyword. + val n = length(values(x)) + for (entry in values(x), i in 0 to false) do : + if key(entry) == `else : + if i != n - 1 : + val msg = "The 'else' keyword can only be used as last entry in list." + add(errors, ProjFileError(info(x), msg)) + else : + if not supported-link-type?(key(entry)) : + val msg = "'%~' does not refer to a supported link type." % [key(entry)] + add(errors, ProjFileError(info(x), to-string(msg))) + + ;Check whether the current platform is one of the supported options. + val current-link-type-supported? = + for entry in values(x) any? : + key(entry) == `else or + key(entry) == link-type + + ;Issue error if current platform is not supported. + if not current-link-type-supported? : + val msg = "There is no available option for the current link type '%~'." % [link-type] + add(errors, ProjFileError(info(x), to-string(msg))) + defmethod check-item-wellformed (x:ForeignPackageParamsStmtS0, platform:Symbol, + link-type:Symbol, pmtable:HashTable, errors:Vector) : ;Look for the corresponding info from the package manager. @@ -123,6 +157,7 @@ defmethod check-item-wellformed (x:ForeignPackageParamsStmtS0, defmethod check-item-wellformed (s:RequiresStmtS0, platform:Symbol, + link-type:Symbol, pmtable:HashTable, errors:Vector) : ;Track which package managers already have a listing. @@ -149,11 +184,12 @@ defmethod check-item-wellformed (s:RequiresStmtS0, ;Check the given item for wellformedness. defn check-wellformed (f:ProjFileS0, platform:Symbol, + link-type:Symbol, pmtable:HashTable, errors:Vector) -> False : defn check-item (x:ProjItem) : do(check-item, x) - check-item-wellformed(x, platform, pmtable, errors) + check-item-wellformed(x, platform, link-type, pmtable, errors) do(check-item, stmts(f)) ;============================================================ diff --git a/compiler/proj.stanza b/compiler/proj.stanza index b277c2a6a..e4b4cf82a 100644 --- a/compiler/proj.stanza +++ b/compiler/proj.stanza @@ -33,7 +33,9 @@ val READ-PROJ-FILES = TimerLabel("Read Proj Files") public defn read-proj-files (filenames:Seqable, platform:Symbol, + link-type:Symbol, env:ProjEnv) -> ProjFile : + ;Return a new function that performs the same thing as stage, ;except that it is timed and attributed towards 'tlabel'. defn time (tlabel:TimerLabel, stage:T -> ?S) : @@ -42,7 +44,7 @@ public defn read-proj-files (filenames:Seqable, stage(x) ;Helper: Read a projfile and ensure it is wellformed. - val wellformedness = ProjWellformedness(platform, env) + val wellformedness = ProjWellformedness(platform, link-type, env) defn read-wellformed-file (filename:String) -> ProjFileS0 : val proj-file = filename $> time(READ-PROJ-FILES, read-raw-proj-file) @@ -63,7 +65,7 @@ public defn read-proj-files (filenames:Seqable, fn (v, t:ValueType, projpath:String, errors:Vector) -> ProjValue : v $> translate-to-proj-value $> variable-substitution{_, vartable, errors} - $> normalize{_, platform, workdir(env), projpath} + $> normalize{_, platform, link-type, workdir(env), projpath} ;Stage: Finish all postprocessing stages to get files into final form. defn sub-variables-and-finish-processing (files:Tuple, @@ -71,7 +73,7 @@ public defn read-proj-files (filenames:Seqable, val dirtable = SpecialDirTable(files, workdir(env)) val new-files = for file in files map : file $> variable-substitution{_, vartable} - $> normalize{_, platform, dirtable} + $> normalize{_, platform, link-type, dirtable} $> post-normalization-checks{_, env, translate-substitute-and-normalize(vartable)} $> flatten-relative-paths{_, env} new-files $> combine @@ -81,7 +83,7 @@ public defn read-proj-files (filenames:Seqable, defn compute-package-manager-variables (f:ProjFile) -> Tuple> : to-tuple $ for file-stmt in stmts(f) seq-cat : val stmt = file-stmt as ForeignPackageParamsStmt - val entries = package-manager-variables(env, stmt, platform) + val entries = package-manager-variables(env, stmt, platform, link-type) ;Sanity check. for e in entries do : if not wellformed-proj-value?(value(e)) : diff --git a/compiler/repl.stanza b/compiler/repl.stanza index ae25eaa42..49a9fe59c 100644 --- a/compiler/repl.stanza +++ b/compiler/repl.stanza @@ -298,7 +298,7 @@ public defn REPL (macro-plugins:Tuple) : ;============================================================ defn proj-manager () : within log-time(REPL-PROJ-MANAGER) : - val proj = read-proj-files(proj-files, OUTPUT-PLATFORM, StandardProjEnv()) + val proj = read-proj-files(proj-files, OUTPUT-PLATFORM, `dynamic, StandardProjEnv()) val params = ProjParams(compiler-flags(), false) ProjManager(proj, params, AuxFile()) diff --git a/compiler/standard-proj-env.stanza b/compiler/standard-proj-env.stanza index b62bed47e..7ec923967 100644 --- a/compiler/standard-proj-env.stanza +++ b/compiler/standard-proj-env.stanza @@ -34,9 +34,9 @@ public defn StandardProjEnv (workdir:String) -> StandardProjEnv : pm-infos ;Return the list of induced system variables provided by the package manager. - defmethod package-manager-variables (this, params:ForeignPackageParamsStmt, platform:Symbol) : + defmethod package-manager-variables (this, params:ForeignPackageParamsStmt, platform:Symbol, link-type:Symbol) : val pm = package-manager-table[package-manager(params)] - proj-variables(pm, to-params(params,platform), platform) + proj-variables(pm, to-params(params,platform,link-type), platform) ;Retrieve the package manager with the given name. defmethod package-manager (this, name:Symbol) : @@ -53,7 +53,8 @@ defn collect-info (pm:ForeignPackageManager) -> ForeignPackageManagerInfo : ;Helper: Translate ProjIR statement into PackageManagerParams public defn to-params (params:ForeignPackageParamsStmt, - platform:Symbol) -> PackageManagerParams : + platform:Symbol, link-type:Symbol) -> PackageManagerParams : PackageManagerParams(projdir(params), platform, + link-type, entries(params)) \ No newline at end of file