Great, glad we could all get on the same page!<div><br></div><div>I agree these are essentially two unrelated problems and we will end up with two features to support them. Both will have pros and cons and we should definitely shoot for both being &quot;excellent&quot;!</div><div><br></div><div>Thanks for the PR I&#39;ll take a look when I am back at a computer.</div><div><br></div><div> - Daniel<br><br>On Tuesday, January 5, 2016, Drew Crawford via swift-build-dev &lt;<a href="mailto:swift-build-dev@swift.org">swift-build-dev@swift.org</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I think I understand better what you are trying to accomplish.  It is not a bad way to go about it, and I think my comments were not as constructive as they should have been.<div><br></div><div>I sent a PR that may clarify your motivation so as to head off objections like mine.  I think my reaction to the document was largely based around a misunderstanding about the motivation.  The title is &quot;Package Manager C Language Target Support&quot;, and so that <i>sounds</i> like it is a proposal about C language support as a whole, which immediately raises questions about whether Foundation et al can be someday made to fit in its box (e.g. via extending it etc.)  Whereas if we are clearer that this is <i>merely one path to C language support, and this is the first one on the whiteboard</i> then I think it is a lot stronger.  It does solve a problem, I have a better idea of what that problem is, and the fact that it doesn&#39;t map well onto my problems is no longer troubling.</div><div><br></div><div><blockquote type="cite"><div style="font-family:HelveticaNeue"><div><div>I think your language is more polarizing than is due here, and I would encourage focusing on a technical argument rather than a judgement like &quot;the entire value is debatable&quot;.</div></div></div></blockquote><br></div><div>I apologize for that.</div><div><br></div><div>For background, when the topic of native C support vs external build systems has come up in the past, there&#39;s been an implicit value judgment that building C with swiftPM is the &quot;preferred&quot; way, and using an external build system is the &quot;compromise&quot; way, and when we set up that value hierarchy it is necessarily the case that the two ideas are in conflict.</div><div><br></div><div>I&#39;m coming around to the idea that actually these are totally unrelated problems, they only looked similar at first glance, that neither is any better or worse than the other, that we need to support both, and so we should just give both of them permission to be excellent in their own way, and that we should not try to shoehorn one of them into the problems that the other one is better at.</div><div><br></div><div>Your proposal is clearly going to be better at the &quot;few files of C code&quot; problem, it was a bad idea for me to overcomplicate it with the problems of established C projects when they can be better served by handling them with an entirely separate solution.</div><div><br></div><div><div><blockquote type="cite"><div>On Jan 4, 2016, at 6:48 PM, Daniel Dunbar &lt;<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;daniel_dunbar@apple.com&#39;);" target="_blank">daniel_dunbar@apple.com</a>&gt; wrote:</div><br><div><span style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Hi Drew,</span><div style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">First off, I believe that the right way to handle something like libsodium is to have support for building targets using an external build system. I see that as a separate and independent feature from this proposal though. If you are interested in working on that feature I would love to discuss it more on a separate thread (I already mentioned it explicitly on another thread I am unable to find right now) -- it is a feature I would really like to see us have but don&#39;t have the bandwidth to tackle at the moment.</div><div style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">This proposal is very specifically targeting the desire to be able to write and build new C code as part of Swift packages, it is not designed to support importing large existing projects. While I do hope that it will feature creep over time to allow more and more C projects to fit within the supported conventions, I also expect that to be a long incremental process.</div><div style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">At this stage of the project, I would encourage looking at new proposals and features from a perspective of &quot;does this add a useful new capability&quot; and &quot;is this in line with our goals&quot; rather than &quot;does this solve my immediate need X&quot;. </div><div style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">More comments in line...</div><div style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div><blockquote type="cite"><div>On Jan 3, 2016, at 12:17 AM, Drew Crawford via swift-build-dev &lt;<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;swift-build-dev@swift.org&#39;);" target="_blank">swift-build-dev@swift.org</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word"><blockquote type="cite"><div><div><div><div>You keep referring to &quot;&#39;real&#39; projects&quot; as a proxy for the individual project you want support for; while there&#39;s a lot to be said for real-world use cases, I don&#39;t think this proposal&#39;s direction should be dictated by just libsodium.</div></div></div></div></blockquote><div><br></div>Nothing about this is reductive or specific to libsodium.<div><br></div><div>* libdispatch has a <a href="https://github.com/apple/swift-corelibs-libdispatch/blob/master/INSTALL" target="_blank">build manual</a> that runs over 100 lines and involves checking out *7* other repos.</div><div>* Foundation (incl CoreFoundation) has a <a href="https://github.com/apple/swift-corelibs-foundation/tree/master/lib" target="_blank">python-based build</a> system that runs to 1900 lines<br><div>* libjpeg is &quot;the&quot; example of a C dependency in our documentation, and its build system includes such goodies as choosing a <a href="http://libjpeg.cvs.sourceforge.net/viewvc/libjpeg/libjpeg/configure.ac?view=markup" target="_blank">memory manager</a> or configuring libpng.</div><div><br></div><div>And these are just the projects that *we* are associated with!</div></div></div></div></blockquote><div><br></div>These are projects I would expect to be tackled with an &quot;external build system&quot; feature, not this proposal.</div><div><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div><div><div><blockquote type="cite"><div><div><div><div>There are C projects that would benefit from modularization, header auditing, and cleanups that Swift and swiftpm would bring to it. </div></div></div></div></blockquote><br></div><div>Swift and swiftpm don&#39;t do anything of the kind.  C developers do.  All we can do is try to impose new requirements on C developers.  And who is volunteering to implement those requirements?</div><div><br></div><div>It seems to me that if our new requirements are so amazing, it should be easy to convince a few projects to sign on to repackage.  libdispatch and Foundation are *our* projects; the bar is so low we&#39;re practically cheating.  Are they going to switch to this as their build system?  I don&#39;t know who makes this decision, but it seems like an important question to ask.</div></div></div></div></div></blockquote><div><br></div>While I think that &quot;support libdispatch and Foundation&quot; are good long term goals and useful reference points for what features are still needed to get there, it isn&#39;t the immediate goal here.</div><div><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div><div><div><blockquote type="cite"><div><div>No Swift project could be built with swiftpm when it was introduced without repackaging. I don&#39;t see why C support should be held to a different standard.</div></div></blockquote><br></div><div>Because we&#39;re designing a package manager for the Swift language, not the C language.  C has had build systems for decades.  We&#39;re not going to just waltz in with a new standard for a 44-year-old language and everybody switches the next day.  This is <a href="https://xkcd.com/927/" target="_blank">https://xkcd.com/927/</a>.</div></div></div></div></div></blockquote><div><br></div>We can all dream, right? :)</div><div><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div><div><div><div><blockquote type="cite"><div>On Jan 2, 2016, at 8:11 PM, Zach Waldowski via swift-build-dev &lt;<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;swift-build-dev@swift.org&#39;);" target="_blank">swift-build-dev@swift.org</a>&gt; wrote:</div><br><div><div><div><blockquote type="cite"><b>I think an important feature of any C target proposal is that there will actually exist C targets which can be built under the proposal</b>.  Until there are C people coming out of the woodwork saying &quot;sure, I will repackage my software this way&quot; I think the entire value is debatable.<br></blockquote></div><div> </div><div>I almost couldn&#39;t disagree more. No Swift project could be built with swiftpm when it was introduced without repackaging. I don&#39;t see why C support should be held to a different standard.<br></div></div></div></blockquote></div></div></div></div></div></div></blockquote><div><br></div>I agree with Zach here. The purpose of the proposal is to add support for new code written in C designed to integrate with other Swift code. The merits of the conventions should be weighed about how easy it is to write that code, and what the implications for maintenance (on both the package manager and the code itself) are.</div><div> <br><blockquote type="cite"><div style="word-wrap:break-word"><div><div><div><div><blockquote type="cite"><div><div><div><blockquote type="cite">And I do not see realistically how we are ever going to support a project like libsodium, except calling out to automake.<br></blockquote><div> </div><div>A potential solution (one of many possible) would look a lot like how people generate Xcode projects for C build systems today; hand-tuning config.h headers and such. I know many people who will go to ungodly lengths to avoid the inevitable nightmare automake causes in a source-distributed dependency.<br></div><div> </div><div><blockquote type="cite">IMO something like that is a much, much better direction in the short-term, and once we have done the first step of &quot;packaging&quot; those software via automake we will have &quot;real&quot; C projects in our package manager and we can design our C support around the concerns of real projects instead of imaginary ones.<br></blockquote><div> </div><div>There are C projects that would benefit from modularization, header auditing, and cleanups that Swift and swiftpm would bring to it. C projects are massively disorganized because build systems are a ridiculous hodgepodge; we didn&#39;t be subject to that long tail of good and bad decisions.<br></div><div> </div><div>I don&#39;t think automake support would be a silver bullet at all, and contradict with many goals of swiftpm and llbuild to boot. Even targeting a really small subset of automake projects what liberties would unnecessarily complicate the project, and then there&#39;d be the projects it doesn&#39;t support.  (Oh? Wait? What version of the tools? Oh, from trunk? Oh, does the project take any liberties with its own organization? God help us when we start talking about C++…) <br></div><div> </div><div>&quot;imaginary&quot; is a reductive way of phrasing the problem space. You keep referring to &quot;&#39;real&#39; projects&quot; as a proxy for the individual project you want support for; while there&#39;s a lot to be said for real-world use cases, I don&#39;t think this proposal&#39;s direction should be dictated by just libsodium.<br></div><div> </div><div>Zachary<br></div></div><div> </div></div><div>On Sat, Jan 2, 2016, at 04:57 PM, Drew Crawford via swift-build-dev wrote:<br></div><blockquote type="cite"><div>Thanks for directing me to this, I missed it.<br></div><div> </div><div><blockquote type="cite">Most projects will not conform to these conventions.<br></blockquote><div> </div><div>Giggle.  Kind of an understatement, no?<br></div></div><div> </div><div>Like, okay.  Here is a project I&#39;d like to package.  (Read: I do package it, with features not in mainline swiftPM.)  <a href="https://github.com/jedisct1/libsodium" target="_blank">https://github.com/jedisct1/libsodium</a><br></div><div> </div><div>Let&#39;s take a look at how this package realistically builds:</div></blockquote></div></div></blockquote></div></div></div></div></div></blockquote><div><br></div>Here is how I would expect these things to be tackled:</div><div> </div><div><blockquote type="cite"><div style="word-wrap:break-word"><div><div><div><div><blockquote type="cite"><div><div><blockquote type="cite"><div>* It has tests (&quot;make check&quot;)<br></div></blockquote></div></div></blockquote></div></div></div></div></div></blockquote><div><br></div>I don&#39;t have any particular plan for this one.</div><div><br><blockquote type="cite"><div style="word-wrap:break-word"><div><div><div><div><blockquote type="cite"><div><div><blockquote type="cite"><div>* It has various --enable-foo flags<br></div></blockquote></div></div></blockquote></div></div></div></div></div></blockquote><div><br></div>I expect that eventually the package manager will grow some level of support for this kind of thing (similar to Cargo&#39;s &quot;features&quot; --<span> </span><a href="http://doc.crates.io/manifest.html#the-[features]-section" target="_blank">http://doc.crates.io/manifest.html#the-[features]-section</a>).</div><div><br><blockquote type="cite"><div style="word-wrap:break-word"><div><div><div><div><blockquote type="cite"><div><div><blockquote type="cite"><div>* It swaps in special implementations depending on if you have <a href="https://github.com/jedisct1/libsodium/blob/master/src/libsodium/Makefile.am#L162" target="_blank">AMD64</a> or <a href="https://github.com/jedisct1/libsodium/blob/master/src/libsodium/Makefile.am#L145" target="_blank">AVX instructions</a> or <a href="https://github.com/jedisct1/libsodium/blob/master/src/libsodium/Makefile.am#L229" target="_blank">SSE2</a> etc.<br></div><div>* The optimization level is tuned on a <a href="https://github.com/jedisct1/libsodium/blob/master/dist-build/android-armv7-a.sh#L3" target="_blank">per-architecture basis</a><br></div></blockquote></div></div></blockquote></div></div></div></div></div></blockquote><div><br></div>I expect that both of these would become possible with small enhancements to allow customization via the manifest file. Again, this is just the initial feature.</div><div><br><blockquote type="cite"><div style="word-wrap:break-word"><div><div><div><div><blockquote type="cite"><div><div><blockquote type="cite"><div>* They build (also) on Windows.  They&#39;re not changing how they&#39;re packaged for &quot;SwiftPM, the Mac/Linux build system&quot;.<br></div></blockquote></div></div></blockquote></div></div></div></div></div></blockquote><div><br></div>I anticipate that we will eventually support alternative source layouts via customization in the manifest file (mostly to change where the sources are found, and the way headers are located and treated).</div><div><br><blockquote type="cite"><div style="word-wrap:break-word"><div><div><div><div><blockquote type="cite"><div><div><blockquote type="cite"><div>* Oh and this is cryptography code.  Do you *really* want to touch it?<br></div></blockquote></div></div></blockquote></div></div></div></div></div></blockquote><div><br></div>It is a non-goal of this proposal to support projects which &quot;I don&#39;t want to touch&quot;.</div><div> <br><blockquote type="cite"><div style="word-wrap:break-word"><div><div><div><div><blockquote type="cite"><div><div><blockquote type="cite"><div><b>I think an important feature of any C target proposal is that there will actually exist C targets which can be built under the proposal</b>.  Until there are C people coming out of the woodwork saying &quot;sure, I will repackage my software this way&quot; I think the entire value is debatable.<br></div></blockquote></div></div></blockquote></div></div></div></div></div></blockquote><div><br></div><div>I think your language is more polarizing than is due here, and I would encourage focusing on a technical argument rather than a judgement like &quot;the entire value is debatable&quot;. This proposal will clearly allow packages to add small bits of C code which are used by other targets. Unless you believe that is incorrect (and if so, please present a technical argument for it), then to me that is a valuable capability (and if you disagree, then please present a technical argument for it).</div><div><br></div><div> - Daniel</div></div><div><br><blockquote type="cite"><div style="word-wrap:break-word"><div><div><div><div><blockquote type="cite"><div><div><blockquote type="cite"><div> </div><div>Getting signoff from libdispatch/CoreFoundation is necessary but not sufficient to clear that hurdle.  I would think getting the other C deps in our own project family to repackage would be &quot;table stakes&quot; for any new C build system.  The real test are projects that are third-party and less friendly.<br></div><div> </div><div>And I do not see realistically how we are ever going to support a project like libsodium, except calling out to automake.  An automake solution coincidentally supports both libdispatch and CoreFoundation right now.  IMO something like that is a much, much better direction in the short-term, and once we have done the first step of &quot;packaging&quot; those software via automake we will have &quot;real&quot; C projects in our package manager and we can design our C support around the concerns of real projects instead of imaginary ones.<br></div><div> </div><div><div><blockquote type="cite"><div>On Jan 2, 2016, at 11:00 AM, Daniel Dunbar via swift-build-dev &lt;<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;swift-build-dev@swift.org&#39;);" target="_blank">swift-build-dev@swift.org</a>&gt; wrote:<br></div><div> </div><div><div><div>Happy 2016!<br></div><div> </div><div>I am working on an initial proposal for adding support for C language targets to the Swift package manager, and am interested in feedback:<br></div><div><a href="https://github.com/ddunbar/swift-evolution/blob/master/proposals/NNNN-swiftpm-c-language-targets.md" target="_blank">https://github.com/ddunbar/swift-evolution/blob/master/proposals/NNNN-swiftpm-c-language-targets.md</a><br></div><div> </div><div>Some TL;DR:<br></div><div>- The proposal defines a basic convention for pure C language targets (no Swift/C mix and match, but other Swift targets can use the C targets).<br></div><div>- This is just intended to be the minimal initial feature, there will be a lot of add on work which I expect should be tackled in follow on PRs/proposals.<br></div><div>- The proposal doesn&#39;t try and outline every single nitty detail (e.g., exactly what C++ standard we will compile with). My intention is to pick a sensible default at implementation time and refine incrementally.<br></div><div> </div><div>Unless there are serious objections, I am hoping to hope to land this proposal soon and start work on the feature shortly after.<br></div><div> </div><div>Cheers,<br></div><div>- Daniel<br></div><div> </div><div> </div><div>_______________________________________________<br></div><div>swift-build-dev mailing list<br></div><div><a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;swift-build-dev@swift.org&#39;);" target="_blank">swift-build-dev@swift.org</a><br></div><div><a href="https://lists.swift.org/mailman/listinfo/swift-build-dev" target="_blank">https://lists.swift.org/mailman/listinfo/swift-build-dev</a><br></div></div></div></blockquote></div></div><div><img border="0" height="1" width="1" alt="" src="https://www.fastmailusercontent.com/proxy/10b469d346a6a3e62407ddcb992e64c157b547e1a0a28109a8064ada41237bbb/8647470737a3f2f25723030323431303e23647e23756e64676279646e2e65647f27766f2f60756e6f35707e6d3337323741745a7267364d22324175734d4151755349316146794f444b6a7435525a5555495145744257563376483f64636648475a777476647b667157436a6349413545564932344373335b464b69705161454963577537553831513f61757c4231464a4c687852383d22364542536864514a656241377e425d64637d41683c4268316f67307173426579726834675463357b6476663339384772524630346d2232464a69505e4a5a7d677d22364569497330553f694571725071316f4673665e63315d223247473a78747033764f6942785b4f657f603e646e4434363e635135355961377b413340784b675653773364375935655d23344/open" style="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><br></div><div><u>_______________________________________________</u><br></div><div>swift-build-dev mailing list<br></div><div><a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;swift-build-dev@swift.org&#39;);" target="_blank">swift-build-dev@swift.org</a><br></div><div><a href="https://lists.swift.org/mailman/listinfo/swift-build-dev" target="_blank">https://lists.swift.org/mailman/listinfo/swift-build-dev</a><br></div></blockquote><div> </div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=OtwgWwWn2mvmck2XIGZZg64wEmoo4f4ILYe4SqMqwHpOK4lZtIvMfPQOw-2FDetbbuIQEq-2F7cT-2F9T59tIXnp-2B0CPBcOgOrCF4UR48Hn9mDShd-2BEe57UmU0fYQvSE1ARv5o7zKVLPO373r6EJmIJPONIrAZtJ5H2GdFZNzQT54XT5vPbHAwXqpri34zyiGrDQue0RCLlZdRhJfg2uGksNl8QW0djlOc-2BPZDn4Apx7mSO88-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"></div>_______________________________________________<br>swift-build-dev mailing list<br><a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;swift-build-dev@swift.org&#39;);" target="_blank">swift-build-dev@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-build-dev" target="_blank">https://lists.swift.org/mailman/listinfo/swift-build-dev</a><br></div></blockquote></div><br></div></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=AdkfTiApI80cNEyortTzHbERtY5det-2FDBvSxuhs4q2MTAacvM4gPJE45gIW8L9isB9iSC5Wvd7XS47eQanZVI6nvc7LWlKg2i18d2zn88WHSL3uTOr2vInLOeIUlXFg2E7omXBNBsvHWeGO1JP13xhwv6wbeTjJZVoPzDTVUH7PsLeuHCZLozobKO0jEkd8LW8zsnv5SuTaxtPWzRoBL6QI4IEYq8fCSQvWnOQ5HUEA-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"></div>_______________________________________________<br>swift-build-dev mailing list<br><a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;swift-build-dev@swift.org&#39;);" target="_blank">swift-build-dev@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-build-dev" target="_blank">https://lists.swift.org/mailman/listinfo/swift-build-dev</a></blockquote></div></div></div></blockquote></div><br></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=AdkfTiApI80cNEyortTzHf5fYJQktx8VIO8rRx-2B3VYaNTM5MR-2FtOHwj-2BH8ZgHO0nxRRC-2BAl-2BZqfA28qq0tzvEmYb-2FJcM5WfFTTZ5E9MXIwTAZ8IWvl2NwzVABQurFQ1EHTUyKzDsR8JLLl6rn5eP47UK3xkcN1XLr2hSxOhZp-2F3mrp6mUFjlcvRKf9eBjrCrkJHr1NNW-2FgP5zBlUxagDOH15-2FpxMamvBmiYoVjM3HpY-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>
</blockquote></div>