Thanks everyone, I agree with most things said here. Daniel, please let us know when you have time to write up your proposed solution. As I'm trying to get more serious with server-side Swift applications, the inability to use external libraries like libCurl and OpenSSL without manual installation are holding me back most at the moment. <br><br>I'll welcome any solution that gets us closer to solving that problem and honestly, I'm not a fan of the arbitrary script solution either, so I'm happy to see any realistic alternatives. <br><br>Honza <br><div class="gmail_quote"><div dir="ltr">On Wed, Mar 23, 2016 at 12:05 AM Daniel Dunbar <<a href="mailto:daniel_dunbar@apple.com">daniel_dunbar@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">My $0.02 here is that I do want to see us have some support for plugging in arbitrary build processes. However, I want it to be done in a very controlled manner, so that we are guaranteed we can evolve the package manager in sensible ways. I definitely would not want this to take the form of an arbitrary "post clone" script that we just run, with no other imposed structure.<div><div><br></div><div>I have a concept in mind, but have not had time to write it up.</div><div><br></div><div>I think Max and I agree that we don't want to support "scripts" just as a way to build things which we should have well-defined, proper ways to build in the first place. It would be nice to see how ffar we can get with our own features or adaption of existing technologies before adding this capability...</div><div><br></div><div><div> - Daniel</div><div><br><div><blockquote type="cite"></blockquote></div></div></div></div></div><div style="word-wrap:break-word"><div><div><div><div><blockquote type="cite"><div>On Mar 21, 2016, at 11:38 AM, Honza Dvorsky via swift-build-dev <<a href="mailto:swift-build-dev@swift.org" target="_blank">swift-build-dev@swift.org</a>> wrote:</div><br></blockquote></div></div></div></div></div><div style="word-wrap:break-word"><div><div><div><div><blockquote type="cite"><div><div dir="ltr">I personally don't like the idea of an arbitrary script either, it was just the first obvious solution to a problem I believe needs solving. The advantage of building from source even of these base dependencies is that the exact version of system dependencies<div>- can be ensured to be the same version across platforms</div><div>- their version is part of the explicit dependency graph</div><div><br></div><div>Currently, AFAIR, installing Redis with homebrew and apt-get each produce a different version, which IMO defeats the point of having a dependency manager in the first place. But I guess if your proposal could ensure that the same version is installed on all platforms, this particular problem would be solved.</div><div><br></div><div>> So the question becomes, is this sufficient? To have `brew install openssl` run, or do you really need to install from source?</div><div><br></div><div>I'm still not sure. Now I think your proposal will probably help with most cases (which is a very good way to approach things), but definitely not all. Imagine you yourself having a cross-platform C project which needs platform configuring before compilation. Even when you're completely in control, the fact that you still can't get this working is troubling. But maybe I'm just inflating extremely uncommon usecases.</div><div><br></div><div>One more thing - consider two Swift packages each needing a different version of OpenSSL. Does your proposal handle that case?</div><div><br></div><div>Anyway, I'd love to read your proposal and then re-evaluate whether I still feel like there's a large enough benefit in introducing such customization to SwiftPM :)</div><div><br></div><div>Honza</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Mar 21, 2016 at 6:19 PM Max Howell <<a href="mailto:max.howell@apple.com" target="_blank">max.howell@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Mar 19, 2016, at 10:55 AM, Honza Dvorsky via swift-build-dev <<a href="mailto:swift-build-dev@swift.org" target="_blank">swift-build-dev@swift.org</a>> wrote:</div><br><div><div dir="ltr">Hi All,<div><br></div><div>today I was trying to investigate how to build a proper cross-platform server-side Swift project and only use SwiftPM to do it. In particular, I was interested in getting OpenSSL/libcurl working as a dependency (built from source). The main reason is that currently the big Swift server frameworks all require manual steps during deployment (running apt-get/brew to install libcurl/openssl/others) and I am trying to get rid of these manual steps, eventually only requiring a `swift build` and run.</div><div><br></div><div>With the <a href="https://github.com/apple/swift-package-manager/pull/183" target="_blank">great initial work</a> to support building C-family packages in SwiftPM done by Ankit, I was able to have a simple C package as a dependency, as advertised. However, the reality of big cross-platform open source projects like OpenSSL and libcurl is that in order to actually build it from source, a configure (or similar) script has to be run to get the source code ready for compilation. And this is where I got stuck.</div><div><br></div><div>Thus I wanted to kick off a discussion of what approach of solving this problem with SwiftPM should be. The simple solution, which I'm tentatively proposing, is to have an optional "post-clone" script in the package's repository. Then, the Package.swift would optionally contain a field for the path to this script - and if present, it'd get run after SwiftPM clones this package. Note that this would be a "post-clone" script, not a "prebuild" script - I imagine it'd only run once when cloning and then only after each clean. </div><div><br></div><div>In order to get users to stop having to run manual script to install all dependencies, I believe that we need to allow packages to declare what work needs to be done on its source before compilation can begin.</div></div></div></blockquote><br></div></div><div style="word-wrap:break-word"><div>I have a proposal I’d like to push today that adds knowledge to SwiftPM about how to install system dependencies for System Module Packages.</div><div><br></div><div>We are not keen to add arbitrary script execution to SwiftPM, because: 1) Arbitrary scripts cannot be controlled and this leads to dependency hell and 2) arbitrary scripts mean your package graph may do anything, which nobody wants.</div><div><br></div><div>Now I’m fine with the “root package” ie. the package the user has control over doing more, but this would be a different discussion.</div><div><br></div><div>So the question becomes, is this sufficient? To have `brew install openssl` run, or do you really need to install from source?</div></div><div style="word-wrap:break-word"><div><br></div><div>Max</div><br></div></blockquote></div></div></blockquote></div></div></div></div></div><div style="word-wrap:break-word"><div><div><div><div><blockquote type="cite"><div>
_______________________________________________<br>swift-build-dev mailing list<br><a href="mailto:swift-build-dev@swift.org" 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></div></div></div></div></blockquote></div>