[swift-build-dev] [Discussion Starter] Package post-clone script
Honza Dvorsky
jan.dvorsky at me.com
Sat Mar 19 12:55:19 CDT 2016
Hi All,
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.
With the great initial work
<https://github.com/apple/swift-package-manager/pull/183> 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.
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.
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.
What do you think?
Honza Dvorsky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20160319/8b1ce8f7/attachment.html>
More information about the swift-build-dev
mailing list