1. 28 Apr, 2016 1 commit
    • Drew's avatar
      Add atbin support · 1c22e037
      Drew authored
      atbin is a proposed binary interchange format for atbuild and the
      broader AT ecosystem.
      
      atbuild has a weakly standardized input format: `build.atpkg`.  But what
      does atbuild, um, actually build?  What's the output format?
      
      There is no weak standard here, or even a convention.  It may build an
      executable, a static library, or a dynamic one, or even a framework; it
      may emit swiftmodule and swiftdoc files, or not.  A modulemap may or may
      not be part of the build products and clients may or may not need it in
      their search paths.
      
      The uncertainty here complicates interoperability.  atpm should download
      binary libraries, but what actually lives in that tarball?  Some random
      dylibs we found in `.atllbuild/products`?
      
      How do we build libraries for "fat" archs (like iOS, with 4 sub-archs)?
      How would we write an `atinstall` tool that installs/updates
      atpm/atbuild (or makes homebrew packages out of them)?
      
      atbin proposes to answer these questions, providing a simple, portable,
      hackable binary interchange format for all platforms and all AT
      projects.
      
      An `atbin` is a folder that ends in `.atbin`.  It contains, at least, a
      `built.atpkg` file.
      
      `built.atpkg` is clojure syntax identical to the more familiar
      `build.atpkg`.  You can include tasks or w/e in there, although why
      would want to, I'm not totally sure (this is Anarchy Tools though,
      knock yourself out.)  However, the important bit is this:
      
      ```clojure
      (package
          :name "foo"
          :payload "libFoo.a"
          :platforms ["ios-x86_64" "ios-i386"]
          :type "static-library"
      )
      ```
      
      (Other fields could also be present, this is not a complete enumeration)
      
      This `.atbin` folder will then contain:
      
      * `libFoo.a`, a fat library for the indicated platforms
      * (optional) a `ios-x86_64.swiftmodule` and `ios-i386.swiftmodule` file
      * (optional) a `ios-x86_64.swiftdoc` and `ios-i386.swiftdoc` file
      * (optional) a `module.modulemap` file
      
      You can, of course, build an `.atbin` by hand from existing binaries you
      found lying around your disk.  And we may eventually ship an `atbin`
      packager for Xcode or SwiftPM projects.
      
      However more practically, we introduce a new tool, `packageatbin`, which
      packages an `atbin` payload from atllbuild.
      
      ```clojure
      :package {
         :tool "packageatbin"
      
         ;; Generate a mypayload.atbin
         :name "mypayload"
      
         ;; When used with the new --platform ios, will build a fat binary for all iOS platforms.
         ;; Alternatively specific platforms can be listed here
         :platforms ["all"]
      
         ;; The atllbuild task to package.
         ;; Special logic will re-run this task for each platform and merge the resulting output.
         :atllbuild-task "myatllbuildtask"
      }
      ```
      
      The obvious application is as an interchange format for prebuilt
      `atllbuild` dependencies.  Presently, `atllbuild` can link with the
      output of any dependent atllbuild task, but if a library wasn't produced
      by a dependent task as part of the current build (but was say produced
      on a different computer a month ago) there's no "obvious" way to link to
      it.  This PR does not actually include any of that tooling, but it would
      be a straightforward extension of this work.
      
      An second application is the building of fat files.  Currently, there is
      no mechanism to build a "fat" library or binary in atbuild, or even to
      specify that we want one.  Under this PR, we can do it.
      
      A third application is a distribution format for executables.  If an
      `.atbin` contains an `executable`, `atpm` (or hypothetical `atinstall`)
      could install/update/administrate that executable similar to `homebrew`
      or `apt`, and keep all your buildtools (or other random crap) up to
      date.  We would need to extend this with version fields and whatnot, but
      again, it's straightforward.
      
      An fourth application, and my real motivation, is as an intermediate
      binary representation.  An `atbin` can be "downcast" with another tool
      to a platform-native format like `deb`, `bottle`, or `Framework`.  This
      would allow us to cut debs, rpms, and framework releases with
      appropriate AT tools.
      
      One alternative is to adopt an existing "standard", like Framework, for
      this purpose.  Indeed, `atbuild` currently produces frameworks on OSX.
      
      There are some complexities of extending frameworks to this case.  For
      one, the Framework implementation is warty and involves a lot of
      symlinks and things like codesigning.  We don't currently maintain that
      code for Linux hosts, nor is the standard especially sensible for Linux,
      as it relies on plists and choices basically unpopular on that platform.
      
      For another, frameworks are not really built to house static library or
      executable payloads, which are important to atbuild.  There are air-
      quote "obvious" ways to extend to nontraditional payloads, but IMO this
      is more confusing than it is helpful.  An explicit step to "cast down"
      your atbin to a framework lets us check that your framework will
      actually make sense to the likes of Xcode.
      
      For a third, it's unclear what platform some random Framework is built
      for, and what architectures it supports.  You can find out by scripting
      out to platform-specific tools, but it's not portable.
      
      Another alternative is to support multiple payloads/libraries in a
      single atbin, "one atbin to rule them all".  However I don't see what we
      accomplish there that we don't accomplish with multiple atbins, except
      specification complexity.  So let's not do that, at least not initially.
      
      `packageatbin` is included in core primarily because it needs tight,
      source-level integration with atllbuild.  In addition to peeking at the
      atllbuild options it needs to run the atllbuild task several times in
      order to produce fat binaries, which means it has to work around the
      usual dependency pruning logic.  For that reason it can't be sensibly
      implemented via the current custom tool API.
      1c22e037
  2. 26 Apr, 2016 4 commits
  3. 25 Apr, 2016 9 commits
  4. 24 Apr, 2016 8 commits
    • Drew's avatar
      Unfuck CI · b5d265c3
      Drew authored
      b5d265c3
    • Drew's avatar
      Add iOS support · 656d6bb3
      Drew authored
      This commit adds support for static libraries, dynamic libraries, and
      executables compiled for iOS.
      
      FAQ:
      
      Q: How do I build them?
      
      Use the new `--platform` strings:
      
      * `ios-x86_64`
      * `ios-i386`
      * `ios-arm64`
      * `ios-armv7`
      
      Q: What if I want to build for more than one architecture?
      
      Coming Soon
      
      Q: What is an iOS "executable", anyway?
      
      No idea, but it works!
      
      Q: What is not yet supported?
      
      - [ ] XCTest
      - [ ] Deploying or running iOS build products
      - [ ] Frameworks
      - [ ] Code signing
      - [ ] Compiling for iOS on Linux.  Believe it or not, I think this
            is actually possible for some programs, but I have no use for it
      656d6bb3
    • Drew's avatar
      Don't use -static-stdlib for bootstrap · 098cb7bc
      Drew authored
      Do this from the self-host test for atbuild
      098cb7bc
    • Drew's avatar
      Support static linking · e56ece3e
      Drew authored
      To statically-link atbuild, use `--use-overlay static` when building
      e56ece3e
    • Drew's avatar
      Merge pull request #86 from AnarchyTools/foundation-removal · a99ccb1f
      Drew authored
      Foundation removal
      a99ccb1f
    • Johannes Schriewer's avatar
      Re-bootstrap · 69c2343e
      Johannes Schriewer authored
      69c2343e
    • Johannes Schriewer's avatar
      Update atpkg and atfoundation · e6a31713
      Johannes Schriewer authored
      e6a31713
    • Johannes Schriewer's avatar
      Re-bootstrap · e48ce241
      Johannes Schriewer authored
      e48ce241
  5. 22 Apr, 2016 11 commits
  6. 21 Apr, 2016 2 commits
    • Drew's avatar
      Merge pull request #84 from AnarchyTools/plugins · dfe27232
      Drew authored
      Add plugin support
      dfe27232
    • Drew's avatar
      Change to `.attool` · 5180ad67
      Drew authored
      @owensd convinced me that `plugin` is the wrong name.  We should call
      @them Custom Tools, with an extension `.attool`.  This emphasizes that
      @they are written for AT and provides something to google.
      5180ad67
  7. 20 Apr, 2016 2 commits
  8. 19 Apr, 2016 3 commits
    • Drew's avatar
      Merge pull request #78 from AnarchyTools/bad-diagnostic · fe2e626a
      Drew authored
      Replace bad diagnostic
      fe2e626a
    • Drew's avatar
      Add plugin support · ecca2810
      Drew authored
      We're supposed to be building simple, hackable tools but atbuild is
      becoming more of a monolithic tool.  This patch aims to change that.
      
      There are many reasons some feature should not be included in core:
      
      1.  Core needs to be minimal so we can bootstrap it on new platforms;
          every new feature is a new burden
      
      2.  Core needs to be x-platform but many features do not
          (see: xcode-emit, packageframework)
      
      3.  Features may want different release frequency (see: xcode-emit) or
          don't want to coordinate with atbuild
      
      4.  Features may be "not part of AnarchyTools" (Caroline) but still
          commonly used together
      
      5.  I'm annoyed at upstream over the static linking issue, and thinking
          of ways to keep us from being that point of central failure that annoys
          somebody else someday
      
      Therefore, we introduce the world's simplest plugin system designed to
      move code out of core, or keep code out of core that doesn't need to be.
      
      xcode-emit and Caroline will consume this API.  packageframework is a
      good candidate for a plugin that might be moved out from core.
      
      Documentation to follow
      ecca2810
    • Drew's avatar
      Merge pull request #80 from AnarchyTools/system-exit · e1a5541d
      Drew authored
      Don't print stack trace for user-visible subcommand errors
      e1a5541d