<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><h1 style="box-sizing: border-box; margin: 0px 0px 0.21999rem; font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-feature-settings: 'dlig' 1, 'liga' 1, 'lnum' 1, 'kern' 1; line-height: 3rem; font-size: 2.0571429rem; padding-top: 0.78001rem; color: rgb(55, 61, 73);" class="">SwiftPM System Module Search Paths</h1><ul style="box-sizing: border-box; margin-bottom: 0.83999rem; padding-top: 0.16001rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class=""><li style="box-sizing: border-box; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-left: 1rem;" class="">Proposal:&nbsp;<a href="https://github.com/apple/swift-evolution/blob/master/proposals/NNNN-swiftpm-system-module-search-paths.md" style="box-sizing: border-box; cursor: pointer; color: rgb(160, 170, 191); background-position: 0px 0px;" class="">SE-NNNN</a></li><li style="box-sizing: border-box; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-left: 1rem;" class="">Author:&nbsp;<a href="https://github.com/mxcl" style="box-sizing: border-box; cursor: pointer; color: rgb(160, 170, 191); background-position: 0px 0px;" class="">Max Howell</a></li><li style="box-sizing: border-box; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-left: 1rem;" class="">Status:&nbsp;<span style="box-sizing: border-box; font-weight: 700;" class="">Awaiting review</span></li><li style="box-sizing: border-box; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-left: 1rem;" class="">Review manager: Anders Bertelrud</li></ul><h2 style="box-sizing: border-box; font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-feature-settings: 'dlig' 1, 'liga' 1, 'lnum' 1, 'kern' 1; margin-top: 0px; font-size: 1.953125rem; margin-bottom: 0.1835837rem; padding-top: 0.8164163rem; line-height: 3rem; color: rgb(55, 61, 73);" class=""><a id="Introduction_8" style="box-sizing: border-box; cursor: pointer; color: rgb(160, 170, 191); text-decoration: underline; background-position: 0px 0px; background-repeat: initial initial;" class=""></a>Introduction</h2><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">Swift is able to&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">import</code>&nbsp;C libraries in the same manner as Swift libraries.</p><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">For this to occur the library must be represented by a clang module-map file.</p><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">The current system for using these module-map files with SwiftPM works, but with a number of caveats that must be addressed.</p><h2 style="box-sizing: border-box; font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-feature-settings: 'dlig' 1, 'liga' 1, 'lnum' 1, 'kern' 1; margin-top: 0px; font-size: 1.953125rem; margin-bottom: 0.1835837rem; padding-top: 0.8164163rem; line-height: 3rem; color: rgb(55, 61, 73);" class=""><a id="Motivation_18" style="box-sizing: border-box; cursor: pointer; color: rgb(160, 170, 191); text-decoration: underline; background-position: 0px 0px; background-repeat: initial initial;" class=""></a>Motivation</h2><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">The current implementation of system module packages have a number of problems:</p><ol style="box-sizing: border-box; margin-bottom: 0.83999rem; padding-top: 0.16001rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class=""><li style="box-sizing: border-box; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-left: 1rem;" class="">Install locations vary across platforms and modulemap files require absolute paths</li><li style="box-sizing: border-box; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-left: 1rem;" class=""><code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">/usr/lib:/usr/local/lib</code>&nbsp;is not always a sufficient&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">-L</code>&nbsp;search path</li><li style="box-sizing: border-box; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-left: 1rem;" class=""><code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">/usr/include:/usr/local/include</code>&nbsp;is not always a sufficient&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">-I</code>&nbsp;C compiler search path</li><li style="box-sizing: border-box; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-left: 1rem;" class="">Installing the system library is left up to the end-user to figure out</li></ol><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">For example to import a module map representing the GTK library, the include search path must be supplemented with&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">-I/usr/include/gtk</code>&nbsp;so that a number of includes in the&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">gtk.h</code>&nbsp;header can be sourced for the complete modular definition of GTK.</p><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">For example to import a module map representing the GTK library a user must first have a copy of GTK and its headers installed. On Debian based systems the install name for this system package is&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">libgtk-3-0-dev</code>&nbsp;which is not entirely intuitive.</p><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">For example, Homebrew and MacPorts on OS X install to prefixes other than&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">/usr</code>.<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">.modulemap</code>&nbsp;files must specify headers with absolute paths. The standard we encourage with modulemaps is for the headers to be specified with an assumed prefix of&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">/usr</code>, but you will not find eg.&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">jpeglib.h</code>&nbsp;at&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">/usr/include/jpeglib.h</code>&nbsp;if it is installed with Homebrew or MacPorts.</p><h2 style="box-sizing: border-box; font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-feature-settings: 'dlig' 1, 'liga' 1, 'lnum' 1, 'kern' 1; margin-top: 0px; font-size: 1.953125rem; margin-bottom: 0.1835837rem; padding-top: 0.8164163rem; line-height: 3rem; color: rgb(55, 61, 73);" class=""><a id="Proposed_Solution_42" style="box-sizing: border-box; cursor: pointer; color: rgb(160, 170, 191); text-decoration: underline; background-position: 0px 0px; background-repeat: initial initial;" class=""></a>Proposed Solution</h2><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">We propose that SwiftPM gains the ability to use the cross-platform&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">pkg-config</code>&nbsp;tool so that it can query&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">pkg-config</code>&nbsp;for the missing path and flag arguments.</p><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">We propose that SwiftPM gains the ability to use the cross-platform&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">pkg-config</code>&nbsp;tool to identify when the system package is not installed to a&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">/usr</code>&nbsp;and in such a case preprocess the modulemap changing the prefix it uses.</p><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">We propose that&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">Package.swift</code>&nbsp;is supplemented with metadata that provides the package-install-name for specific platforms.</p><h2 style="box-sizing: border-box; font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-feature-settings: 'dlig' 1, 'liga' 1, 'lnum' 1, 'kern' 1; margin-top: 0px; font-size: 1.953125rem; margin-bottom: 0.1835837rem; padding-top: 0.8164163rem; line-height: 3rem; color: rgb(55, 61, 73);" class=""><a id="Detailed_Design_55" style="box-sizing: border-box; cursor: pointer; color: rgb(160, 170, 191); text-decoration: underline; background-position: 0px 0px; background-repeat: initial initial;" class=""></a>Detailed Design</h2><h3 style="box-sizing: border-box; font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-feature-settings: 'dlig' 1, 'liga' 1, 'lnum' 1, 'kern' 1; margin-top: 0px; line-height: 3rem; font-size: 1.6457143rem; margin-bottom: 0.07599rem; padding-top: 0.92401rem; color: rgb(55, 61, 73);" class=""><a id="Solving_PathFlags_Issues_57" style="box-sizing: border-box; cursor: pointer; color: rgb(160, 170, 191); text-decoration: underline; background-position: 0px 0px; background-repeat: initial initial;" class=""></a>Solving Path/Flags Issues</h3><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">Some of our problems can be solved by using the cross platform tool:&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">pkg-config</code>.</p><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">A C package can provide a pkg-config file (<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">.pc</code>) which describes:</p><ol style="box-sizing: border-box; margin-bottom: 0.83999rem; padding-top: 0.16001rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class=""><li style="box-sizing: border-box; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-left: 1rem;" class="">Its install location</li><li style="box-sizing: border-box; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-left: 1rem;" class="">Supplementary C-flags that should be used when building against this library</li></ol><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">If SwiftPM used the&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">.pc</code>&nbsp;file that comes with packages, this solves problems 1 through 3.</p><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">Of the tickets we currently have open describing issues using Swift-system-module-packages, reading the&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">.pc</code>&nbsp;file would fix all of them.</p><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">It is a convention to name the&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">.pc</code>&nbsp;file after the library link-name, so we can determine which&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">.pc</code>&nbsp;file to ask&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">pkg-config</code>&nbsp;for by parsing the&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">.modulemap</code>&nbsp;file in the Swift package.</p><h3 style="box-sizing: border-box; font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-feature-settings: 'dlig' 1, 'liga' 1, 'lnum' 1, 'kern' 1; margin-top: 0px; line-height: 3rem; font-size: 1.6457143rem; margin-bottom: 0.07599rem; padding-top: 0.92401rem; color: rgb(55, 61, 73);" class=""><a id="Providing_Package_Install_Names_75" style="box-sizing: border-box; cursor: pointer; color: rgb(160, 170, 191); text-decoration: underline; background-position: 0px 0px; background-repeat: initial initial;" class=""></a>Providing Package Install Names</h3><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class=""><code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">Package.swift</code>&nbsp;would be supplemented like so:</p><pre style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1.33999rem; word-break: break-all; word-wrap: break-word; color: rgb(51, 51, 51); border: 1px solid rgb(211, 218, 234); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; overflow: auto; font-family: monospace, monospace; font-size: 14px; padding: 0.66001rem 9.5px 9.5px; line-height: 2rem; background-image: linear-gradient(rgb(255, 255, 255) 0px, rgb(255, 255, 255) 0.75rem, rgb(245, 247, 250) 0.75rem, rgb(245, 247, 250) 2.75rem, rgb(255, 255, 255) 2.75rem, rgb(255, 255, 255) 4rem); background-size: 100% 4rem;" class=""><code class="language-swift" style="box-sizing: border-box; color: inherit; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; padding: 0px; font-size: inherit; font-family: monospace, monospace; white-space: pre-wrap;"><span class="hljs-keyword" style="box-sizing: border-box; color: rgb(133, 153, 0);">let</span> package = <span class="hljs-type" style="box-sizing: border-box; color: rgb(181, 137, 0);">Package</span>(
    name: <span class="hljs-string" style="box-sizing: border-box; color: rgb(42, 161, 152);">"CFoo"</span>,
    providers: .<span class="hljs-type" style="box-sizing: border-box; color: rgb(181, 137, 0);">Brew</span>(installName: <span class="hljs-string" style="box-sizing: border-box; color: rgb(42, 161, 152);">"foo"</span>),
                .<span class="hljs-type" style="box-sizing: border-box; color: rgb(181, 137, 0);">Apt</span>(installName: <span class="hljs-string" style="box-sizing: border-box; color: rgb(42, 161, 152);">"libfoo-dev"</span>),
)
</code></pre><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">Thus, in the event of build failure for modules that depend on this package we provide additional help to the user:</p><pre style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1.33999rem; word-break: break-all; word-wrap: break-word; color: rgb(51, 51, 51); border: 1px solid rgb(211, 218, 234); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; overflow: auto; font-family: monospace, monospace; font-size: 14px; padding: 0.66001rem 9.5px 9.5px; line-height: 2rem; background-image: linear-gradient(rgb(255, 255, 255) 0px, rgb(255, 255, 255) 0.75rem, rgb(245, 247, 250) 0.75rem, rgb(245, 247, 250) 2.75rem, rgb(255, 255, 255) 2.75rem, rgb(255, 255, 255) 4rem); background-size: 100% 4rem;" class=""><code style="box-sizing: border-box; color: inherit; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; padding: 0px; font-size: inherit; font-family: monospace, monospace; white-space: pre-wrap;" class="">error: failed to build module `ba<span class="hljs-string" style="box-sizing: border-box; color: rgb(42, 161, 152);">r'
note: you may need to install `foo'</span> using your system-packager:

    apt-get install libfoo-dev
</code></pre><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">Since the syntax to provide this information uses an explicit enum we can add code for each enum to detect which system packagers should be recommended. The community will need to write the code for their own platforms. It also means that if a specific packager requires additional parameters, they can be added on a per enum basis.</p><h2 style="box-sizing: border-box; font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-feature-settings: 'dlig' 1, 'liga' 1, 'lnum' 1, 'kern' 1; margin-top: 0px; font-size: 1.953125rem; margin-bottom: 0.1835837rem; padding-top: 0.8164163rem; line-height: 3rem; color: rgb(55, 61, 73);" class=""><a id="Impact_on_Existing_Code_103" style="box-sizing: border-box; cursor: pointer; color: rgb(160, 170, 191); text-decoration: underline; background-position: 0px 0px; background-repeat: initial initial;" class=""></a>Impact on Existing Code</h2><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">There will be no impact on existing code as this feature simply improves an existing feature making new code possible.</p><h2 style="box-sizing: border-box; font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-feature-settings: 'dlig' 1, 'liga' 1, 'lnum' 1, 'kern' 1; margin-top: 0px; font-size: 1.953125rem; margin-bottom: 0.1835837rem; padding-top: 0.8164163rem; line-height: 3rem; color: rgb(55, 61, 73);" class=""><a id="Alternatives_Considered_109" style="box-sizing: border-box; cursor: pointer; color: rgb(160, 170, 191); text-decoration: underline; background-position: 0px 0px; background-repeat: initial initial;" class=""></a>Alternatives Considered</h2><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">A clear alternative is allowing additional flags to be specified in a system-module package’s&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">Package.swift</code>.</p><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">However since these paths and flags will vary by platform this would because a large matrix that is quite a maintenance burden. Really this information is recorded already, in the system package itself, and in fact almost all packages nowadays provide it in a&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">.pc</code>&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">pkg-config</code>&nbsp;file.</p><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">Also we do not want to allow arbitrary flags to be specified in&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">Package.swift</code>, this allows packages too much power to break a large dependency graph with bad compiles. The only entity that understands the whole graph and can manage the build without breakage is SwiftPM, and allowing packages themselves to add arbitrary flags prevents SwiftPM from being able to understand and control the build ensuring reliability and preventing “Dependency Hell”.</p><h2 style="box-sizing: border-box; font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-feature-settings: 'dlig' 1, 'liga' 1, 'lnum' 1, 'kern' 1; margin-top: 0px; font-size: 1.953125rem; margin-bottom: 0.1835837rem; padding-top: 0.8164163rem; line-height: 3rem; color: rgb(55, 61, 73);" class=""><a id="Future_Directions_121" style="box-sizing: border-box; cursor: pointer; color: rgb(160, 170, 191); text-decoration: underline; background-position: 0px 0px; background-repeat: initial initial;" class=""></a>Future Directions</h2><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">The build system could be made more reliable by having the specific packager provide the information that this proposal garners from&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">pkg-config</code>. For example, Homebrew installs everything into independent directories, using these directories instead of more general POSIX search paths means there is no danger of edge-case search path collisions and the wrong libraries being picked up.</p><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">If this was done&nbsp;<code style="box-sizing: border-box; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; padding: 2px 4px; font-size: 1em; font-family: monospace, monospace;" class="">pkg-config</code>&nbsp;could become just one option for providing this data, and be used only as a fallback.</p><hr style="box-sizing: content-box; height: 0px; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class=""><p style="box-sizing: border-box; padding-top: 0.66001rem; font-feature-settings: 'kern' 1, 'onum' 1, 'liga' 1; margin-top: 0px; margin-bottom: 1.33999rem; color: rgb(55, 61, 73); font-family: Georgia, Cambria, serif; font-size: 14px;" class="">We could add an additional flag so that deployment of Swift Packages could be made simpler and system dependencies be installed automatically.</p></body></html>