mirror of
https://github.com/urbit/shrub.git
synced 2024-11-24 13:06:09 +03:00
Merge branch 'na-release/next-vere' into jb/co-norm
* na-release/next-vere: (1601 commits) nix: run tests against the latest arvo source test: fixes +to-wain (no more trailing empty lines) pill: solid build: update gcloud to use non-deprecated action pill: solid glob: update to 0v4.fpa4r.s6dtc.h8tps.62jv0.qn0fj notifications: prevent safari shrinkage glob: update to 0v5.91i1u.1g535.t3de3.6c3ih.fanmv Sidebar: loosen property access launch: loosen property access in unread count notifications: fix scroll to load glob: update to 0v1.pak02.pfla3.gh56f.qhc6h.3h881 inbox: fix graph resource redirects inbox: fix link routing and rendering glob: update to 0v4.3fbh4.p7j6i.2pi9g.d1ltq.5u7uu hark-fe: fix crash hark: update graph marks for editable comments graph-store: change atom to %1 for all migrated comments glob: update to 0v5.67obv.15auf.c2rc7.jpcu2.iain3 inbox: correct notification order ...
This commit is contained in:
commit
d3e28f5e54
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,4 +1,3 @@
|
||||
bin/* filter=lfs diff=lfs merge=lfs -text
|
||||
bin/*/* filter=lfs diff=lfs merge=lfs -text
|
||||
pkg/arvo/**/*.js binary
|
||||
pkg/arvo/**/*.css binary
|
||||
|
11
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
11
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Landscape design issue
|
||||
url: https://github.com/urbit/landscape/issues/new?assignees=&labels=design+issue&template=report-a-design-issue.md&title=
|
||||
about: Submit non-functionality, design-specific issues to the Landscape team here.
|
||||
- name: Landscape feature request
|
||||
url: https://github.com/urbit/landscape/issues/new?assignees=&labels=feature+request&template=feature_request.md&title=
|
||||
about: Landscape is comprised of Tlon's user applications and client for Urbit. Submit Landscape feature requests here.
|
||||
- name: urbit-dev mailing list
|
||||
url: https://groups.google.com/a/urbit.org/g/dev
|
||||
about: Developer questions and discussions also take place on the urbit-dev mailing list.
|
4
.github/ISSUE_TEMPLATE/os1-bug-report.md
vendored
4
.github/ISSUE_TEMPLATE/os1-bug-report.md
vendored
@ -1,6 +1,6 @@
|
||||
---
|
||||
name: OS1 Bug report
|
||||
about: 'Use this template to file a bug for any OS1 app: Chat, Publish, Links, Groups,
|
||||
name: Landscape bug report
|
||||
about: 'Use this template to file a bug for any Landscape app: Chat, Publish, Links, Groups,
|
||||
Weather or Clock'
|
||||
title: ''
|
||||
labels: landscape
|
||||
|
120
.github/workflows/build.yml
vendored
Normal file
120
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
# Notes:
|
||||
#
|
||||
# jobs.<job_id>
|
||||
#
|
||||
# A seperate job id results in a lot of duplication of nix/cachix work.
|
||||
# The build will have to download any substituted derivations from cachix
|
||||
# for the steps with each distinct job id and upload built derivations to
|
||||
# cachix after each job has completed, either succesfully or on failure.
|
||||
#
|
||||
# jobs.<job_id>.steps.run
|
||||
#
|
||||
# build + test are distinct as each step entry results in a collapsable title
|
||||
# within the log output, which makes it easier to view failing builds or
|
||||
# tests independently.
|
||||
#
|
||||
# jobs.<job_id>.strategy.fail-fast
|
||||
#
|
||||
# Set to false so developers working on vere or king-haskell can have their
|
||||
# respective builds proceed without the other causing failure.
|
||||
#
|
||||
# shell.nix
|
||||
#
|
||||
# mkShell doesn't allow you to build it - so instantiate all the subshells
|
||||
# defined for the individual pkg/*/shell.nix as a sanity check and to create
|
||||
# some artefacts suitable for developers to pull from cachix. The top-level
|
||||
# shell.nix build time is dominated by Haskell dependencies so it's built as
|
||||
# part of the haskell build steps.
|
||||
#
|
||||
# Syntax:
|
||||
#
|
||||
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
|
||||
|
||||
name: Build, test, and upload urbit release tarball
|
||||
|
||||
on:
|
||||
push: null
|
||||
pull_request: null
|
||||
|
||||
jobs:
|
||||
urbit:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { os: ubuntu-latest }
|
||||
- { os: macos-latest }
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: cachix/install-nix-action@v12
|
||||
- uses: cachix/cachix-action@v8
|
||||
with:
|
||||
name: mars
|
||||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||
|
||||
- run: nix-build -A urbit --arg enableStatic true
|
||||
|
||||
- if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||
run: nix-build -A urbit-tests
|
||||
|
||||
haskell:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { os: ubuntu-latest }
|
||||
- { os: macos-latest }
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: cachix/install-nix-action@v12
|
||||
- uses: cachix/cachix-action@v8
|
||||
with:
|
||||
name: mars
|
||||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||
|
||||
- run: nix-build -A hs.urbit-king.components.exes.urbit-king --arg enableStatic true
|
||||
- run: nix-build -A hs-checks
|
||||
- run: nix-build shell.nix
|
||||
|
||||
upload:
|
||||
needs: [urbit, haskell]
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- { os: ubuntu-latest, system: x86_64-linux }
|
||||
- { os: macos-latest, system: x86_64-darwin }
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: cachix/install-nix-action@v12
|
||||
- uses: cachix/cachix-action@v8
|
||||
with:
|
||||
name: mars
|
||||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||
|
||||
- uses: google-github-actions/setup-gcloud@v0.2.0
|
||||
with:
|
||||
version: '290.0.1'
|
||||
service_account_key: ${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}
|
||||
project_id: ${{ secrets.GCS_PROJECT }}
|
||||
export_default_credentials: true
|
||||
|
||||
- run: nix-build -A tarball
|
||||
|
||||
- name: Run upload to bootstrap.urbit.org
|
||||
run: |
|
||||
version="$(cat ./pkg/urbit/version)"
|
||||
system="$(nix eval --raw '(builtins.currentSystem)')"
|
||||
target="gs://bootstrap.urbit.org/ci/urbit-v${version}-${system}-${GITHUB_SHA:0:9}.tgz"
|
||||
|
||||
gsutil cp -n ./result "$target"
|
||||
|
||||
echo "upload to $target complete."
|
89
.gitignore
vendored
89
.gitignore
vendored
@ -1,46 +1,79 @@
|
||||
# nix symlink artifacts
|
||||
#
|
||||
# OSX
|
||||
.DS_Store
|
||||
|
||||
# Editors
|
||||
*~
|
||||
*#
|
||||
.#*
|
||||
\#*#
|
||||
.*.sw[a-z]
|
||||
*.un~
|
||||
*.org
|
||||
.projectile
|
||||
s/*
|
||||
cscope.*
|
||||
|
||||
# Tags
|
||||
.tags
|
||||
.etags
|
||||
TAGS
|
||||
GPATH
|
||||
GRTAGS
|
||||
GTAGS
|
||||
|
||||
# Nix
|
||||
result
|
||||
result-*
|
||||
|
||||
# common dev piers
|
||||
#
|
||||
# Common Piers
|
||||
/zod
|
||||
/bus
|
||||
/nec
|
||||
/fakezod
|
||||
|
||||
# package manager caches
|
||||
#
|
||||
.stack-work
|
||||
# NodeJS
|
||||
node_modules
|
||||
|
||||
# build and release artifacts
|
||||
#
|
||||
# Haskell
|
||||
.stack-work
|
||||
stack.yaml.lock
|
||||
dist-newstyle
|
||||
.ghc*
|
||||
|
||||
# Profiling
|
||||
*.prof
|
||||
*.aux
|
||||
*.hp
|
||||
*.ps
|
||||
*.pdf
|
||||
|
||||
# Build/Release Artifacts
|
||||
build/
|
||||
cross/
|
||||
release/
|
||||
dist
|
||||
/out
|
||||
/work
|
||||
dist/
|
||||
out/
|
||||
work/
|
||||
*.o
|
||||
|
||||
# landscape dev
|
||||
#
|
||||
# Landscape Dev
|
||||
urbitrc
|
||||
*-min.js
|
||||
pkg/interface/link-webext/web-ext-artifacts
|
||||
|
||||
# catchall editor and OS stuff
|
||||
#
|
||||
.tags
|
||||
.etags
|
||||
tags
|
||||
TAGS
|
||||
GPATH
|
||||
GRTAGS
|
||||
GTAGS
|
||||
.DS_Store
|
||||
*.swp
|
||||
*.swo
|
||||
\#*\#
|
||||
s/*
|
||||
# Certificates
|
||||
*.pem
|
||||
*.key
|
||||
*.secret
|
||||
*.sec
|
||||
*.asc
|
||||
|
||||
# Archives
|
||||
*.zip
|
||||
*.gz
|
||||
*.tar
|
||||
*.bzip2
|
||||
*.xz
|
||||
|
||||
# Logs
|
||||
*.log
|
80
.travis.yml
80
.travis.yml
@ -1,80 +0,0 @@
|
||||
stages:
|
||||
- compile
|
||||
# Don't run the combine stage in pull requests, because deploy is disabled there.
|
||||
- name: combine
|
||||
if: type != pull_request
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: compile
|
||||
os: linux
|
||||
language: nix
|
||||
nix: 2.3.6
|
||||
before_install:
|
||||
- git lfs pull
|
||||
- echo "trusted-users = root travis" | sudo tee -a /etc/nix/nix.conf && sudo pkill nix-daemon
|
||||
install:
|
||||
- nix-env -iA cachix -f https://cachix.org/api/v1/install
|
||||
script:
|
||||
- cachix use urbit2
|
||||
- ./sh/cachix
|
||||
- make build
|
||||
- make release
|
||||
- sh/ci-tests
|
||||
|
||||
- stage: compile
|
||||
os: linux
|
||||
language: generic
|
||||
env: STACK_YAML=pkg/hs/stack.yaml
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.ghc
|
||||
- $HOME/.cabal
|
||||
- $HOME/.stack
|
||||
- $TRAVIS_BUILD_DIR/.stack-work
|
||||
before_install:
|
||||
- sh/travis-install-stack
|
||||
install:
|
||||
- stack --no-terminal --install-ghc build urbit-king --only-dependencies
|
||||
script:
|
||||
- stack test
|
||||
- sh/release-king-linux64-dynamic
|
||||
|
||||
- stage: compile
|
||||
os: osx
|
||||
language: generic
|
||||
sudo: required
|
||||
env: STACK_YAML=pkg/hs/stack.yaml
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.ghc
|
||||
- $HOME/.cabal
|
||||
- $HOME/.stack
|
||||
- $TRAVIS_BUILD_DIR/.stack-work
|
||||
before_install:
|
||||
- sh/travis-install-stack
|
||||
install:
|
||||
- stack --no-terminal --install-ghc build urbit-king --only-dependencies
|
||||
script:
|
||||
- stack test
|
||||
- sh/release-king-darwin-dynamic
|
||||
|
||||
- stage: combine
|
||||
os: linux
|
||||
language: generic
|
||||
script:
|
||||
- sh/combine-release-builds
|
||||
|
||||
deploy:
|
||||
- skip_cleanup: true
|
||||
provider: gcs
|
||||
access_key_id: GOOGTADOPP55X5ZTH3IKAXQW
|
||||
secret_access_key:
|
||||
secure: rSPif0VHX3Q3QpWM9iUt/Z9sicCY8ABuwVFPeT3YUnAAmSXM46PIHKieoGs79kx9IelFyQsM8xS0XWyt4S/haR7VaTJY+zHJjf0AnA1sr5ZIV70t3K0SXzq4+E1ffOZRiC0VmHatPz10wjaIpHxpjcROqQV4M1dBCq2H/rpccIE=
|
||||
bucket: bootstrap.urbit.org
|
||||
local-dir: release/
|
||||
acl: public-read
|
||||
on:
|
||||
condition: "-d release/"
|
||||
repo: urbit/urbit
|
||||
all_branches: true
|
@ -2,12 +2,14 @@
|
||||
|
||||
Thank you for your interest in contributing to Urbit.
|
||||
|
||||
See [urbit.org/docs/getting-started][start] for basic orientation and usage
|
||||
See [urbit.org/using/install][start] for basic orientation and usage
|
||||
instructions. You may also want to subscribe to [urbit-dev][list], the Urbit
|
||||
development mailing list. For specific information on contributing to the Urbit
|
||||
interface, see its [contribution guidelines][interface].
|
||||
|
||||
[start]: https://urbit.org/docs/getting-started/#arvo
|
||||
For information on Arvo's maintainers, see [pkg/arvo][main].
|
||||
|
||||
[start]: https://urbit.org/using/install
|
||||
[interface]: /pkg/interface/CONTRIBUTING.md
|
||||
|
||||
## Fake ships
|
||||
@ -36,6 +38,17 @@ To resume a fake ship, just pass the name of the pier:
|
||||
$ urbit my-fake-zod
|
||||
```
|
||||
|
||||
Fake ships by default use the same pre-compiled kernelspace ('pills') as livenet
|
||||
ships do: boot pills, which are not always current with `master`. If you wish to
|
||||
develop using code off the master branch, run the following from the repo
|
||||
directory:
|
||||
|
||||
```
|
||||
git lfs install
|
||||
git lfs pull
|
||||
urbit -F zod -B "bin/solid.pill" -A "pkg/arvo"
|
||||
```
|
||||
|
||||
## Git practice
|
||||
|
||||
### Contributing
|
||||
@ -45,11 +58,10 @@ The canonical source tree is the `master` branch of
|
||||
`master` when commencing new work; similarly, when we pull in your
|
||||
contribution, we'll do so by merging it to `master`.
|
||||
|
||||
Since we use GitHub, it's helpful (though not required) to contribute via a
|
||||
GitHub pull request. You can also post patches to the [mailing list][list],
|
||||
email them to maintainers, or request a maintainer pull from your tree directly
|
||||
-- but note that some maintainers will be more receptive to these methods than
|
||||
others.
|
||||
Since we use GitHub, we request you contribute via a GitHub pull request. Tag
|
||||
the [maintainer][main] for the component. If you have a question for the
|
||||
maintainer, you can direct message them from your Urbit ship using that
|
||||
information.
|
||||
|
||||
When contributing changes, via whatever means, make sure you describe them
|
||||
appropriately. You should attach a reasonably high-level summary of what the
|
||||
@ -58,8 +70,8 @@ exist, e.g. a GitHub issue, a mailing list discussion, a UP, etc. [Here][jbpr]
|
||||
is a good example of a pull request with a useful, concise description.
|
||||
|
||||
If your changes replace significant extant functionality, be sure to compare
|
||||
them with the thing you're replacing. You may also want to cc maintainers,
|
||||
reviewers, or other parties who might have a particular interest in what you're
|
||||
them with the thing you're replacing. You may also want to cc reviewers,
|
||||
or other parties who might have a particular interest in what you're
|
||||
contributing.
|
||||
|
||||
[jbpr]: https://github.com/urbit/urbit/pull/1782
|
||||
@ -283,3 +295,4 @@ Questions or other communications about contributing to Urbit can go to
|
||||
[reba]: https://git-rebase.io/
|
||||
[issu]: https://github.com/urbit/urbit/issues
|
||||
[hoon]: https://urbit.org/docs/learn/hoon/style/
|
||||
[main]: https://github.com/urbit/urbit/tree/master/pkg/arvo#maintainers
|
11
Makefile
11
Makefile
@ -3,20 +3,14 @@
|
||||
build:
|
||||
nix-build -A urbit -A herb --no-out-link
|
||||
|
||||
build-all:
|
||||
nix-build --no-out-link
|
||||
|
||||
install:
|
||||
nix-env -f . -iA urbit -iA urbit-debug -iA herb
|
||||
|
||||
cross:
|
||||
sh/cross
|
||||
|
||||
release:
|
||||
sh/release
|
||||
|
||||
test:
|
||||
sh/test
|
||||
nix-build -A urbit-tests --no-out-link
|
||||
|
||||
pills:
|
||||
sh/update-solid-pill
|
||||
@ -32,3 +26,6 @@ interface:
|
||||
clean:
|
||||
rm -rf ./out ./work
|
||||
rm -f result result-*
|
||||
|
||||
fmt:
|
||||
sh/fmt
|
||||
|
43
README.md
43
README.md
@ -1,27 +1,38 @@
|
||||
# Urbit
|
||||
|
||||
A personal server operating function.
|
||||
[Urbit](https://urbit.org) is a personal server stack built from scratch. It
|
||||
has an identity layer (Azimuth), virtual machine (Vere), and operating system
|
||||
(Arvo).
|
||||
|
||||
> The Urbit address space, Azimuth, is now live on the Ethereum blockchain. You
|
||||
> can find it at [`0x223c067f8cf28ae173ee5cafea60ca44c335fecb`][azim] or
|
||||
> [`azimuth.eth`][aens]. Owners of Azimuth points (galaxies, stars, or planets)
|
||||
> can view or manage them using [Bridge][brid], and can also use them to boot
|
||||
> [Arvo][arvo], the Urbit OS.
|
||||
A running Urbit "ship" is designed to operate with other ships peer-to-peer.
|
||||
Urbit is a general-purpose, peer-to-peer computer and network.
|
||||
|
||||
This repository contains:
|
||||
|
||||
- The [Arvo OS][arvo]
|
||||
- [herb][herb], a tool for Unix control of an Urbit ship
|
||||
- Source code for [Landscape's web interface][land]
|
||||
- Source code for the [vere][vere] virtual machine.
|
||||
|
||||
For more on the identity layer, see [Azimuth][azim]. To manage your Urbit
|
||||
identity, use [Bridge][brid].
|
||||
|
||||
[azim]: https://etherscan.io/address/0x223c067f8cf28ae173ee5cafea60ca44c335fecb
|
||||
[aens]: https://etherscan.io/address/azimuth.eth
|
||||
[brid]: https://github.com/urbit/bridge
|
||||
[arvo]: https://github.com/urbit/urbit/tree/master/pkg/arvo
|
||||
[azim]: https://github.com/urbit/azimuth
|
||||
[brid]: https://github.com/urbit/bridge
|
||||
[herb]: https://github.com/urbit/urbit/tree/master/pkg/herb
|
||||
[land]: https://github.com/urbit/urbit/tree/master/pkg/interface
|
||||
[vere]: https://github.com/urbit/urbit/tree/master/pkg/urbit
|
||||
|
||||
## Install
|
||||
|
||||
To install and run Urbit, please follow the instructions at
|
||||
[urbit.org/docs/getting-started/][start]. You'll be on the live network in a
|
||||
[urbit.org/using/install][start]. You'll be on the live network in a
|
||||
few minutes.
|
||||
|
||||
If you're interested in Urbit development, keep reading.
|
||||
|
||||
[start]: https://urbit.org/docs/getting-started/
|
||||
[start]: https://urbit.org/using/install/
|
||||
|
||||
## Development
|
||||
|
||||
@ -38,7 +49,7 @@ The Makefile in the project's root directory contains useful phony targets for
|
||||
building, installing, testing, and so on. You can use it to avoid dealing with
|
||||
Nix explicitly.
|
||||
|
||||
To build Urbit, for example, use:
|
||||
To build the Urbit virtual machine binary, for example, use:
|
||||
|
||||
```
|
||||
make build
|
||||
@ -68,12 +79,10 @@ Contributions of any form are more than welcome! Please take a look at our
|
||||
[contributing guidelines][cont] for details on our git practices, coding
|
||||
styles, how we manage issues, and so on.
|
||||
|
||||
You might also be interested in:
|
||||
For instructions on contributing to Landscape, see [its][lcont] guidelines.
|
||||
|
||||
- joining the [urbit-dev][list] mailing list.
|
||||
- [applying to Hoon School][mail], a course we run to teach the Hoon
|
||||
programming language and Urbit application development.
|
||||
You might also be interested in joining the [urbit-dev][list] mailing list.
|
||||
|
||||
[list]: https://groups.google.com/a/urbit.org/forum/#!forum/dev
|
||||
[mail]: mailto:support@urbit.org
|
||||
[cont]: https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md
|
||||
[lcont]: https://github.com/urbit/urbit/blob/master/pkg/interface/CONTRIBUTING.md
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:35d8930b9b35364605196d99766ec713154af9105ce7b9fabfaa50e8ca29a5fd
|
||||
size 4448128
|
||||
oid sha256:f4a6a782b2193a16dc10340e40787522ec34df50eb517fef849bc32b87a3e512
|
||||
size 4508418
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e5c82dea80aa7c5593f43fa4294db7974211abceedd907663da73889857642e7
|
||||
size 1309381
|
||||
oid sha256:db42476704efdbb5c2cbf81ea67f15603da5b848850b538081e7b108f969fa19
|
||||
size 1315294
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:59c3f8e23f5a80aab704d4246ad518f8e66fdf223023b768180b0581df9f47c2
|
||||
size 6320375
|
||||
oid sha256:d8ac4b3bf78d7c8ef62f668bfe14b243cffe5784a97c87486e1ae31c4b58e1f6
|
||||
size 6312584
|
||||
|
189
default.nix
189
default.nix
@ -1,8 +1,189 @@
|
||||
/* Examples
|
||||
|
||||
Shared urbit and urbit-worker binaries:
|
||||
|
||||
$ nix-build -A urbit
|
||||
|
||||
Static urbit and urbit-worker binaries:
|
||||
|
||||
$ nix-build -A urbit --arg enableStatic true
|
||||
|
||||
Note that on linux the previous command is equivalent to:
|
||||
|
||||
$ nix-build -A urbit --argstr crossSystem x86_64-unknown-linux-musl \
|
||||
--arg enableSatic true
|
||||
|
||||
Static urbit-king binary:
|
||||
|
||||
$ nix-build -A hs.urbit-king.components.exes.urbit-king --arg enableStatic true
|
||||
|
||||
Static release tarball:
|
||||
|
||||
$ nix-build -A tarball --arg enableStatic true
|
||||
|
||||
Build a pill:
|
||||
|
||||
$ nix-build -A ivory.build
|
||||
$ nix-build -A brass.build
|
||||
$ nix-build -A solid.build
|
||||
|
||||
Run the king-haskell checks (.tests are _build_ the test code, .checks _runs_):
|
||||
|
||||
$ nix-build -A hs.urbit-king.checks.urbit-king-tests
|
||||
|
||||
Build a specific Haskell package from ./pkg/hs:
|
||||
|
||||
$ nix-build -A hs.urbit-noun.components.library
|
||||
$ nix-build -A hs.urbit-atom.components.benchmarks.urbit-atom-bench
|
||||
$ nix-build -A hs.urbit-atom.components.tests.urbit-atom-tests
|
||||
*/
|
||||
|
||||
# The build system where packages will be _built_.
|
||||
{ system ? builtins.currentSystem
|
||||
# The host system where packages will _run_.
|
||||
, crossSystem ? null
|
||||
# Additional sources.json overrides.
|
||||
, sources ? { }
|
||||
# Additional nixpkgs.config overrides.
|
||||
, config ? { }
|
||||
# Additional nixpkgs.overlays.
|
||||
, overlays ? [ ]
|
||||
# Overlays to apply to the last package set in cross compilation.
|
||||
, crossOverlays ? [ ]
|
||||
# Whether to use pkgs.pkgsStatic.* to obtain statically linked package
|
||||
# dependencies - ie. when building fully-static libraries or executables.
|
||||
, enableStatic ? false }:
|
||||
|
||||
let
|
||||
|
||||
pkgs = import ./nix/pkgs {};
|
||||
deps = import ./nix/deps {};
|
||||
pkgsNative = import ./nix/default.nix { inherit system; };
|
||||
|
||||
in
|
||||
pkgsCross = import ./nix/default.nix {
|
||||
inherit system sources config overlays crossOverlays;
|
||||
|
||||
deps // pkgs
|
||||
# If we're running on linux and crossSystem is unspecified but
|
||||
# enableStatic = true - set the crossSystem to musl64.
|
||||
crossSystem =
|
||||
if system == "x86_64-linux" && crossSystem == null && enableStatic then
|
||||
"x86_64-unknown-linux-musl"
|
||||
else
|
||||
crossSystem;
|
||||
};
|
||||
|
||||
# Use nixpkgs' top-level/static overlay if enableStatic = true.
|
||||
pkgsStatic = if enableStatic then pkgsCross.pkgsStatic else pkgsCross;
|
||||
|
||||
# Enrich the global package set with our local functions and packages.
|
||||
# Cross vs static build dependencies can be selectively overridden for
|
||||
# inputs like python and haskell-nix
|
||||
callPackage =
|
||||
pkgsNative.lib.callPackageWith (pkgsStatic // libLocal // pkgsLocal);
|
||||
|
||||
# Local library import-from-derivation functions such as fetchGitHubLFS, etc.
|
||||
libLocal = pkgsNative.callPackage ./nix/lib { };
|
||||
|
||||
# Local vendored packages defined in ./pkg.
|
||||
# For non-vendored nixpkgs specific package overrides, see ./nix/overlays.
|
||||
pkgsLocal = {
|
||||
argon2u = callPackage ./nix/pkgs/argon2u { };
|
||||
|
||||
ca-bundle = callPackage ./nix/pkgs/ca-bundle { };
|
||||
|
||||
ed25519 = callPackage ./nix/pkgs/ed25519 { };
|
||||
|
||||
ent = callPackage ./nix/pkgs/ent { };
|
||||
|
||||
ge-additions = callPackage ./nix/pkgs/ge-additions { };
|
||||
|
||||
libaes_siv = callPackage ./nix/pkgs/libaes_siv { };
|
||||
|
||||
libscrypt = callPackage ./nix/pkgs/libscrypt { };
|
||||
|
||||
murmur3 = callPackage ./nix/pkgs/murmur3 { };
|
||||
|
||||
softfloat3 = callPackage ./nix/pkgs/softfloat3 { };
|
||||
|
||||
herb = callPackage ./nix/pkgs/herb { inherit (pkgsCross) python; };
|
||||
|
||||
arvo = callPackage ./nix/pkgs/arvo { };
|
||||
|
||||
ivory = callPackage ./nix/pkgs/pill/ivory.nix { };
|
||||
|
||||
brass = callPackage ./nix/pkgs/pill/brass.nix { };
|
||||
|
||||
solid = callPackage ./nix/pkgs/pill/solid.nix { };
|
||||
|
||||
urbit = callPackage ./nix/pkgs/urbit { inherit enableStatic; };
|
||||
|
||||
hs = callPackage ./nix/pkgs/hs {
|
||||
inherit enableStatic;
|
||||
inherit (pkgsCross) haskell-nix;
|
||||
};
|
||||
};
|
||||
|
||||
# Additional top-level packages and attributes exposed for convenience.
|
||||
pkgsExtra = with pkgsLocal; rec {
|
||||
# Expose packages with local customisations (like patches) for dev access.
|
||||
inherit (pkgsCross) libsigsegv;
|
||||
|
||||
# Collect haskell check (aka "run the tests") attributes so we can run every
|
||||
# test for our local haskell packages, similar to the urbit-tests attribute.
|
||||
hs-checks = (pkgsNative.recurseIntoAttrs
|
||||
(libLocal.collectHaskellComponents pkgsLocal.hs)).checks;
|
||||
|
||||
urbit-debug = urbit.override { enableDebug = true; };
|
||||
urbit-tests = libLocal.testFakeShip {
|
||||
inherit herb;
|
||||
inherit arvo;
|
||||
|
||||
urbit = urbit-debug;
|
||||
pill = solid.lfs;
|
||||
};
|
||||
|
||||
ivory-ropsten = ivory.override { arvo = arvo.ropsten; };
|
||||
brass-ropsten = brass.override { arvo = arvo.ropsten; };
|
||||
|
||||
# Create a .tgz of the primary binaries.
|
||||
tarball = let
|
||||
name = "urbit-v${urbit.version}-${urbit.system}";
|
||||
urbit-king = hs.urbit-king.components.exes.urbit-king;
|
||||
in libLocal.makeReleaseTarball {
|
||||
inherit name;
|
||||
|
||||
contents = {
|
||||
"${name}/urbit" = "${urbit}/bin/urbit";
|
||||
"${name}/urbit-worker" = "${urbit}/bin/urbit-worker";
|
||||
"${name}/urbit-king" = "${urbit-king}/bin/urbit-king";
|
||||
};
|
||||
};
|
||||
|
||||
# A convenience function for constructing a shell.nix for any of the
|
||||
# pkgsLocal derivations by automatically propagating any dependencies
|
||||
# to the nix-shell.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# let
|
||||
# pkgs = import ./default.nix { };
|
||||
# in pkgs.shellFor {
|
||||
# packages = ps: [
|
||||
# ps.urbit
|
||||
# ps.herb
|
||||
# ];
|
||||
# }
|
||||
#
|
||||
shellFor = { name, packages, ... }@attrs:
|
||||
pkgsNative.mkShell ({
|
||||
inputsFrom = packages pkgsLocal;
|
||||
} // builtins.removeAttrs attrs [ "packages" ]);
|
||||
};
|
||||
|
||||
# Ensure that in the case of cross-compilation we're not statically linking
|
||||
# against glibc. This is typically a sign that crossSystem is misconfigured.
|
||||
checkPlatform =
|
||||
if enableStatic && pkgsCross.stdenv.hostPlatform.libc == "glibc" then
|
||||
builtins.trace "warning: statically linking against glibc."
|
||||
else
|
||||
pkgsNative.lib.id;
|
||||
|
||||
in checkPlatform (pkgsLocal // pkgsExtra)
|
||||
|
@ -1,22 +0,0 @@
|
||||
# All the non-release builds that should be cached in `cachix`.
|
||||
|
||||
let
|
||||
|
||||
pkgs = import ../pkgs {};
|
||||
deps = import ../deps {};
|
||||
|
||||
# Cache the result of cloning source repos.
|
||||
repos = {
|
||||
argon2-src = deps.argon2.src;
|
||||
ed25519-src = deps.ed25519.src;
|
||||
h2o-src = deps.h2o.src;
|
||||
murmur3-src = deps.murmur3.src;
|
||||
scrypt-src = deps.scrypt.src;
|
||||
secp256k1-src = deps.secp256k1.src;
|
||||
softfloat3-src = deps.softfloat3.src;
|
||||
uv-src = deps.uv.src;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
deps // pkgs // repos
|
@ -1,11 +0,0 @@
|
||||
let
|
||||
|
||||
util = import ./util.nix;
|
||||
nixcrpkgs = import ../nixcrpkgs.nix;
|
||||
release = import ../release.nix;
|
||||
all_releases = util.flattenSetPrefix release;
|
||||
crosstools = { inherit (nixcrpkgs.native) pkgconf; };
|
||||
|
||||
in
|
||||
|
||||
crosstools // all_releases
|
@ -1,7 +0,0 @@
|
||||
let
|
||||
ops = import ../ops/default.nix {};
|
||||
in
|
||||
{
|
||||
results = ops.test;
|
||||
fakebus = ops.bus;
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
# Some utility functions:
|
||||
|
||||
rec {
|
||||
|
||||
# The inverse of builtins.listToAttrs
|
||||
attrsToList = o:
|
||||
map (a: { name=a; value=builtins.getAttr a o; })
|
||||
(builtins.attrNames o);
|
||||
|
||||
# ∀o,x,y. produce o' such that o'.y == o.x.y (assuming no conflicts)
|
||||
flattenSet = o:
|
||||
builtins.foldl' (acc: v: acc // v) {}
|
||||
(builtins.attrValues o);
|
||||
|
||||
prefixSetAttrs = prefix: o:
|
||||
builtins.listToAttrs
|
||||
(map ({name, value}: { name=prefix + name; value=value; })
|
||||
(attrsToList o));
|
||||
|
||||
# ∀o,x,y. produce o' such that o'.x-y == o.x.y
|
||||
flattenSetPrefix = o:
|
||||
(builtins.foldl' (acc: o: acc // o) {}
|
||||
(map ({name, value}: prefixSetAttrs name value)
|
||||
(attrsToList o)));
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
crossenv:
|
||||
|
||||
rec {
|
||||
argon2 = import ./deps/argon2/cross.nix { inherit crossenv; };
|
||||
murmur3 = import ./deps/murmur3/cross.nix { inherit crossenv; };
|
||||
uv = import ./deps/uv/cross.nix { inherit crossenv; };
|
||||
ed25519 = import ./deps/ed25519/cross.nix { inherit crossenv; };
|
||||
scrypt = import ./deps/scrypt/cross.nix { inherit crossenv; };
|
||||
softfloat3 = import ./deps/softfloat3/cross.nix { inherit crossenv; };
|
||||
secp256k1 = import ./deps/secp256k1/cross.nix { inherit crossenv; };
|
||||
h2o = import ./deps/h2o/cross.nix { inherit crossenv uv; };
|
||||
ivory-header = import ./deps/ivory-header/cross.nix { inherit crossenv; };
|
||||
ca-header = import ./deps/ca-header/cross.nix { inherit crossenv; };
|
||||
}
|
56
nix/default.nix
Normal file
56
nix/default.nix
Normal file
@ -0,0 +1,56 @@
|
||||
# The build system where packages will be _built_.
|
||||
{ system ? builtins.currentSystem
|
||||
# The host system where packages will _run_.
|
||||
, crossSystem ? null
|
||||
# Additional sources.json overrides.
|
||||
, sources ? { }
|
||||
# Additional nixpkgs.config overrides.
|
||||
, config ? { }
|
||||
# Additional nixpkgs.overlays.
|
||||
, overlays ? [ ]
|
||||
# Overlays to apply to the last package set in cross compilation.
|
||||
, crossOverlays ? [ ] }:
|
||||
|
||||
let
|
||||
|
||||
sourcesFinal = import ./sources.nix { inherit pkgs; } // sources;
|
||||
|
||||
haskellNix = import sourcesFinal."haskell.nix" {
|
||||
sourcesOverride = {
|
||||
hackage = sourcesFinal."hackage.nix";
|
||||
stackage = sourcesFinal."stackage.nix";
|
||||
};
|
||||
};
|
||||
|
||||
configFinal = haskellNix.config // config;
|
||||
|
||||
overlaysFinal = haskellNix.overlays ++ [
|
||||
(_final: prev: {
|
||||
# Add top-level .sources attribute for other overlays to access sources.
|
||||
sources = sourcesFinal;
|
||||
|
||||
# Additional non-convential package/exe mappings for shellFor.tools.
|
||||
haskell-nix = prev.haskell-nix // {
|
||||
toolPackageName = prev.haskell-nix.toolPackageName // {
|
||||
shellcheck = "ShellCheck";
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
# General unguarded (native) overrides for nixpkgs.
|
||||
(import ./overlays/native.nix)
|
||||
|
||||
# Specific overrides guarded by the host platform.
|
||||
(import ./overlays/musl.nix)
|
||||
] ++ overlays;
|
||||
|
||||
pkgs = import sourcesFinal.nixpkgs {
|
||||
inherit system crossSystem crossOverlays;
|
||||
|
||||
config = configFinal;
|
||||
overlays = overlaysFinal;
|
||||
};
|
||||
|
||||
in pkgs // {
|
||||
pkgsStatic = pkgs.pkgsStatic.extend (import ./overlays/static.nix);
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
let
|
||||
|
||||
pkgs = import ./nixpkgs.nix;
|
||||
tlon = import ./pkgs { pkgs=pkgs; };
|
||||
deps = import ./deps { pkgs=pkgs; };
|
||||
|
||||
tools =
|
||||
with pkgs;
|
||||
[ cargo rustc meson ninja pkgconfig libtool gdb ];
|
||||
|
||||
libs =
|
||||
with pkgs;
|
||||
[ openssl curl gmp scrypt libsigsegv openssl zlib lmdb ];
|
||||
|
||||
osx =
|
||||
with pkgs;
|
||||
lib.optionals stdenv.isDarwin (
|
||||
with darwin.apple_sdk.frameworks;
|
||||
[ Cocoa CoreServices ]);
|
||||
|
||||
vendor =
|
||||
with deps;
|
||||
[ argon2 ed25519 h2o murmur3 scrypt secp256k1 softfloat3 uv ent ge-additions ivory-header ca-header ];
|
||||
|
||||
in
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "urbit-deps-env";
|
||||
env = pkgs.buildEnv { name = name; paths = buildInputs; };
|
||||
buildInputs = tools ++ libs ++ osx ++ vendor;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
cp -r $src ./src
|
||||
chmod -R a+w ./src
|
||||
cd ./src
|
||||
|
||||
sed -i 's|ar rcs|${AR} rcs|' Makefile
|
||||
|
||||
make libargon2.a -j4
|
||||
|
||||
mkdir -p $out/{lib,include}
|
||||
cp libargon2.a $out/lib
|
||||
cp include/argon2.h $out/include
|
||||
cp ./src/blake2/*.h $out/include
|
@ -1,17 +0,0 @@
|
||||
{ crossenv }:
|
||||
|
||||
crossenv.make_derivation rec {
|
||||
name = "argon2-4da94";
|
||||
builder = ./builder.sh;
|
||||
|
||||
CC = "${crossenv.host}-gcc";
|
||||
AR = "${crossenv.host}-ar";
|
||||
NO_THREADS = true;
|
||||
|
||||
src = crossenv.nixpkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "argon2";
|
||||
rev = "4da94a611ee62bad87ab2b131ffda3bcc0723d9c";
|
||||
sha256 = "0bqq1hg367l4jkb6cqhxlblpvdbwz3l586qsfakwzfd9wdvnm3yc";
|
||||
};
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
{ pkgs }:
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "argon2-4da94";
|
||||
builder = ./builder.sh;
|
||||
NO_THREADS = true;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "argon2";
|
||||
rev = "4da94a611ee62bad87ab2b131ffda3bcc0723d9c";
|
||||
sha256 = "0bqq1hg367l4jkb6cqhxlblpvdbwz3l586qsfakwzfd9wdvnm3yc";
|
||||
};
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
set -ex
|
||||
|
||||
cleanup () {
|
||||
echo "done"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
|
||||
if ! [ -f "$SSL_CERT_FILE" ]; then
|
||||
echo "$SSL_CERT_FILE doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p ./include
|
||||
|
||||
cat $SSL_CERT_FILE > include/ca-bundle.crt
|
||||
xxd -i include/ca-bundle.crt > ca-bundle.h
|
||||
|
||||
mkdir -p $out/include
|
||||
|
||||
mv ca-bundle.h $out/include
|
||||
rm -rf ./include
|
||||
|
||||
set +x
|
@ -1,8 +0,0 @@
|
||||
{ crossenv }:
|
||||
|
||||
crossenv.make_derivation rec {
|
||||
name = "ca-bundle.h";
|
||||
builder = ./builder.sh;
|
||||
native_inputs = with crossenv.nixpkgs; [ cacert xxd ];
|
||||
SSL_CERT_FILE = "${crossenv.nixpkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{ pkgs }:
|
||||
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "ca-bundle.h";
|
||||
builder = ./builder.sh;
|
||||
nativeBuildInputs = with pkgs; [ cacert xxd ];
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{ pkgs ? import ../nixpkgs.nix }:
|
||||
|
||||
rec {
|
||||
argon2 = import ./argon2 { inherit pkgs; };
|
||||
murmur3 = import ./murmur3 { inherit pkgs; };
|
||||
uv = import ./uv { inherit pkgs; };
|
||||
ed25519 = import ./ed25519 { inherit pkgs; };
|
||||
scrypt = import ./scrypt { inherit pkgs; };
|
||||
softfloat3 = import ./softfloat3 { inherit pkgs; };
|
||||
secp256k1 = import ./secp256k1 { inherit pkgs; };
|
||||
h2o = import ./h2o { inherit pkgs uv; };
|
||||
ivory-header = import ./ivory-header { inherit pkgs; };
|
||||
ca-header = import ./ca-header { inherit pkgs; };
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
sources=" \
|
||||
$src/src/add_scalar.c \
|
||||
$src/src/seed.c \
|
||||
$src/src/verify.c \
|
||||
$src/src/add_scalar.c \
|
||||
$src/src/sha512.c \
|
||||
$src/src/ge.c \
|
||||
$src/src/fe.c \
|
||||
$src/src/keypair.c \
|
||||
$src/src/sign.c \
|
||||
$src/src/sc.c \
|
||||
$src/src/key_exchange.c \
|
||||
"
|
||||
|
||||
CFLAGS="-O3 -Wall -I$src/src"
|
||||
|
||||
for fn in $sources
|
||||
do echo $CC $CFLAGS -c $fn -o $(basename $fn).o
|
||||
$CC -O3 -Wall -I$src/src -c $fn -o $(basename $fn).o
|
||||
done
|
||||
|
||||
mkdir -p $out/{lib,include}
|
||||
|
||||
$AR rcs $out/lib/libed25519.a *.o
|
||||
echo $AR rcs $out/lib/libed25519.a *.o
|
||||
|
||||
cp $src/src/*.h $out/include
|
@ -1,16 +0,0 @@
|
||||
{ crossenv }:
|
||||
|
||||
crossenv.make_derivation rec {
|
||||
name = "ed25519-76385";
|
||||
builder = ./builder.sh;
|
||||
|
||||
CC = "${crossenv.host}-gcc";
|
||||
AR = "${crossenv.host}-ar";
|
||||
|
||||
src = crossenv.nixpkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "ed25519";
|
||||
rev = "76385f2ebbbc9580a9c236952d68d11d73a6135c";
|
||||
sha256 = "0s1spif4s9lgcwcny3fl2fvpbw6acqn3s8r6qxnrmkd9icgyw4cp";
|
||||
};
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{ pkgs }:
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "ed25519-76385";
|
||||
builder = ./builder.sh;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "ed25519";
|
||||
rev = "76385f2ebbbc9580a9c236952d68d11d73a6135c";
|
||||
sha256 = "0s1spif4s9lgcwcny3fl2fvpbw6acqn3s8r6qxnrmkd9icgyw4cp";
|
||||
};
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
sources=" \
|
||||
deps/cloexec/cloexec.c \
|
||||
deps/libgkc/gkc.c \
|
||||
deps/libyrmcds/close.c \
|
||||
deps/libyrmcds/connect.c \
|
||||
deps/libyrmcds/recv.c \
|
||||
deps/libyrmcds/send.c \
|
||||
deps/libyrmcds/send_text.c \
|
||||
deps/libyrmcds/socket.c \
|
||||
deps/libyrmcds/strerror.c \
|
||||
deps/libyrmcds/text_mode.c \
|
||||
deps/picohttpparser/picohttpparser.c \
|
||||
lib/common/cache.c \
|
||||
lib/common/file.c \
|
||||
lib/common/filecache.c \
|
||||
lib/common/hostinfo.c \
|
||||
lib/common/http1client.c \
|
||||
lib/common/memcached.c \
|
||||
lib/common/memory.c \
|
||||
lib/common/multithread.c \
|
||||
lib/common/serverutil.c \
|
||||
lib/common/socket.c \
|
||||
lib/common/socketpool.c \
|
||||
lib/common/string.c \
|
||||
lib/common/time.c \
|
||||
lib/common/timeout.c \
|
||||
lib/common/url.c \
|
||||
lib/core/config.c \
|
||||
lib/core/configurator.c \
|
||||
lib/core/context.c \
|
||||
lib/core/headers.c \
|
||||
lib/core/logconf.c \
|
||||
lib/core/proxy.c \
|
||||
lib/core/request.c \
|
||||
lib/core/token.c \
|
||||
lib/core/util.c \
|
||||
lib/handler/access_log.c \
|
||||
lib/handler/chunked.c \
|
||||
lib/handler/compress.c \
|
||||
lib/handler/compress/gzip.c \
|
||||
lib/handler/errordoc.c \
|
||||
lib/handler/expires.c \
|
||||
lib/handler/fastcgi.c \
|
||||
lib/handler/file.c \
|
||||
lib/handler/headers.c \
|
||||
lib/handler/mimemap.c \
|
||||
lib/handler/proxy.c \
|
||||
lib/handler/redirect.c \
|
||||
lib/handler/reproxy.c \
|
||||
lib/handler/throttle_resp.c \
|
||||
lib/handler/status.c \
|
||||
lib/handler/headers_util.c \
|
||||
lib/handler/status/events.c \
|
||||
lib/handler/status/requests.c \
|
||||
lib/handler/http2_debug_state.c \
|
||||
lib/handler/status/durations.c \
|
||||
lib/handler/configurator/access_log.c \
|
||||
lib/handler/configurator/compress.c \
|
||||
lib/handler/configurator/errordoc.c \
|
||||
lib/handler/configurator/expires.c \
|
||||
lib/handler/configurator/fastcgi.c \
|
||||
lib/handler/configurator/file.c \
|
||||
lib/handler/configurator/headers.c \
|
||||
lib/handler/configurator/proxy.c \
|
||||
lib/handler/configurator/redirect.c \
|
||||
lib/handler/configurator/reproxy.c \
|
||||
lib/handler/configurator/throttle_resp.c \
|
||||
lib/handler/configurator/status.c \
|
||||
lib/handler/configurator/http2_debug_state.c \
|
||||
lib/handler/configurator/headers_util.c \
|
||||
lib/http1.c \
|
||||
lib/tunnel.c \
|
||||
lib/http2/cache_digests.c \
|
||||
lib/http2/casper.c \
|
||||
lib/http2/connection.c \
|
||||
lib/http2/frame.c \
|
||||
lib/http2/hpack.c \
|
||||
lib/http2/scheduler.c \
|
||||
lib/http2/stream.c \
|
||||
lib/http2/http2_debug_state.c \
|
||||
"
|
||||
|
||||
CFLAGS=" \
|
||||
-O3 \
|
||||
-Wall -Wno-unused-value -Wno-unused-function \
|
||||
-I$src/include \
|
||||
-I$src/deps/cloexec \
|
||||
-I$src/deps/brotli/enc \
|
||||
-I$src/deps/golombset \
|
||||
-I$src/deps/libgkc \
|
||||
-I$src/deps/libyrmcds \
|
||||
-I$src/deps/klib \
|
||||
-I$src/deps/neverbleed \
|
||||
-I$src/deps/picohttpparser \
|
||||
-I$src/deps/picotest \
|
||||
-I$src/deps/yaml/include \
|
||||
-I$src/deps/yoml
|
||||
"
|
||||
|
||||
for s in $sources
|
||||
do cc $CFLAGS -c $src/$s -o $(sed 's|/|_|g; s/.c$/.o/' <<< $s)
|
||||
done
|
||||
|
||||
mkdir -p $out/{lib,include}
|
||||
ar rcs $out/lib/libh2o.a *.o
|
||||
cp -r $src/include/* $out/include
|
||||
cp $src/deps/picohttpparser/picohttpparser.h $out/include
|
@ -1,17 +0,0 @@
|
||||
{ crossenv, uv }:
|
||||
|
||||
crossenv.make_derivation rec {
|
||||
inherit (crossenv) openssl zlib;
|
||||
inherit uv;
|
||||
|
||||
name = "h2o-0ed9a";
|
||||
cross_inputs = [ uv crossenv.openssl crossenv.zlib ];
|
||||
builder = ./cross.sh;
|
||||
|
||||
src = crossenv.nixpkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "h2o";
|
||||
rev = "0ed9ac70757a16ec45f91b8a347850d9699c3fb1";
|
||||
sha256 = "16b5zbwdq371hhqga76dh7x4c0qr3xb5ah9r8hnm6rip460p6xpm";
|
||||
};
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
cp -r $src src
|
||||
chmod -R u+w src
|
||||
cd src
|
||||
|
||||
cmake-cross . \
|
||||
-DZLIB_LIBRARY=$zlib/lib/libz.a \
|
||||
-DZLIB_INCLUDE_DIR=$zlib/include \
|
||||
-DCMAKE_INSTALL_PREFIX=$out \
|
||||
-DBUILD_SHARED_LIBS=off \
|
||||
-DWITH_MRUBY=off \
|
||||
-DWITH_BUNDLED_SSL=off \
|
||||
-DWITH_PICOTLS=on
|
||||
|
||||
make libh2o
|
||||
|
||||
mkdir -p $out/{lib,lib/pkgconfig,include}
|
||||
|
||||
cp ./libh2o.a $out/lib
|
||||
|
||||
cp ./libh2o.pc $out/lib/pkgconfig
|
||||
|
||||
cp -r include/* $out/include
|
||||
|
||||
cp deps/picohttpparser/picohttpparser.h $out/include
|
@ -1,13 +0,0 @@
|
||||
{ pkgs, uv }:
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "h2o-0ed9a";
|
||||
buildInputs = [ uv pkgs.openssl pkgs.zlib ];
|
||||
builder = ./builder.sh;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "h2o";
|
||||
rev = "0ed9ac70757a16ec45f91b8a347850d9699c3fb1";
|
||||
sha256 = "16b5zbwdq371hhqga76dh7x4c0qr3xb5ah9r8hnm6rip460p6xpm";
|
||||
};
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
set -e
|
||||
|
||||
if ! [ -f "$IVORY" ]; then
|
||||
echo "$IVORY doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# heuristics to confirm the ivory pill is valid
|
||||
#
|
||||
|
||||
# first 7 bytes != "version" (start of an lfs pointer)
|
||||
#
|
||||
if [ "$(head -c 7 "$IVORY")" = "version" ]; then
|
||||
echo "$IVORY is an LFS pointer (it starts with 'version')"
|
||||
echo "to fix, run: git lfs install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# greater than 10KB
|
||||
#
|
||||
if ! [ $(du -k "$IVORY" | cut -f1) -gt 10 ]; then
|
||||
echo "$IVORY is less than 10KB"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat $IVORY > u3_Ivory.pill
|
||||
xxd -i u3_Ivory.pill > ivory.h
|
||||
|
||||
mkdir -p $out/include
|
||||
|
||||
mv ivory.h $out/include
|
||||
rm u3_Ivory.pill
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
crossenv,
|
||||
ivory ? ../../../bin/ivory.pill
|
||||
}:
|
||||
|
||||
crossenv.make_derivation rec {
|
||||
name = "ivory.h";
|
||||
builder = ./builder.sh;
|
||||
native_inputs = with crossenv.nixpkgs; [ xxd ];
|
||||
IVORY = ivory;
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
pkgs,
|
||||
ivory ? ../../../bin/ivory.pill
|
||||
}:
|
||||
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "ivory.h";
|
||||
builder = ./builder.sh;
|
||||
nativeBuildInputs = with pkgs; [ xxd ];
|
||||
IVORY = ivory;
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
echo $CC -fPIC -O3 -o murmur3.o -c $src/murmur3.c
|
||||
$CC -fPIC -O3 -o murmur3.o -c $src/murmur3.c
|
||||
|
||||
mkdir -p $out/{lib,include}
|
||||
|
||||
echo $AR rcs $out/lib/libmurmur3.a murmur3.o
|
||||
$AR rcs $out/lib/libmurmur3.a murmur3.o
|
||||
|
||||
cp $src/murmur3.h $out/include
|
@ -1,16 +0,0 @@
|
||||
{ crossenv }:
|
||||
|
||||
crossenv.make_derivation rec {
|
||||
name = "murmur3-71a75";
|
||||
builder = ./builder.sh;
|
||||
|
||||
CC = "${crossenv.host}-gcc";
|
||||
AR = "${crossenv.host}-ar";
|
||||
|
||||
src = crossenv.nixpkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "murmur3";
|
||||
rev = "71a75d57ca4e7ca0f7fc2fd84abd93595b0624ca";
|
||||
sha256 = "0k7jq2nb4ad9ajkr6wc4w2yy2f2hkwm3nkbj2pklqgwsg6flxzwg";
|
||||
};
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{ pkgs }:
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "murmur3-71a75";
|
||||
builder = ./builder.sh;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "murmur3";
|
||||
rev = "71a75d57ca4e7ca0f7fc2fd84abd93595b0624ca";
|
||||
sha256 = "0k7jq2nb4ad9ajkr6wc4w2yy2f2hkwm3nkbj2pklqgwsg6flxzwg";
|
||||
};
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
sources=" \
|
||||
crypto_scrypt-check \
|
||||
crypto_scrypt-hash \
|
||||
crypto_scrypt-hexconvert \
|
||||
crypto_scrypt-nosse \
|
||||
crypto-mcf \
|
||||
crypto-scrypt-saltgen \
|
||||
slowequals \
|
||||
sha256 \
|
||||
b64 \
|
||||
"
|
||||
|
||||
CFLAGS="-I$src -Wall -ffast-math -O3 -D_FORTIFY_SOURCE=2 -fstack-protector"
|
||||
|
||||
for s in $sources
|
||||
do echo $CC $CFLAGS -c $src/$s.c -o $s.o
|
||||
$CC $CFLAGS -c $src/$s.c -o $s.o
|
||||
done
|
||||
|
||||
echo $AR rcs libscrypt.a *.o
|
||||
$AR rcs libscrypt.a *.o
|
||||
|
||||
mkdir -p $out/{lib,include}
|
||||
cp libscrypt.a $out/lib
|
||||
cp $src/*.h $out/include
|
@ -1,16 +0,0 @@
|
||||
{ crossenv }:
|
||||
|
||||
crossenv.make_derivation rec {
|
||||
name = "scrypt-02969";
|
||||
builder = ./builder.sh;
|
||||
|
||||
CC = "${crossenv.host}-gcc";
|
||||
AR = "${crossenv.host}-ar";
|
||||
|
||||
src = crossenv.nixpkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "libscrypt";
|
||||
rev = "029693ff1cbe4f69d3a2da87d0f4f034f92cc0c2";
|
||||
sha256 = "17pcxypzjmmrvacw45cacvibm6mlr9ip30hy30l1appsnywx679n";
|
||||
};
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{ pkgs }:
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "scrypt-02969";
|
||||
builder = ./builder.sh;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "libscrypt";
|
||||
rev = "029693ff1cbe4f69d3a2da87d0f4f034f92cc0c2";
|
||||
sha256 = "17pcxypzjmmrvacw45cacvibm6mlr9ip30hy30l1appsnywx679n";
|
||||
};
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
cp -r $src ./src
|
||||
chmod -R u+w ./src
|
||||
cd src
|
||||
|
||||
libtoolize
|
||||
bash ./autogen.sh
|
||||
bash ./configure --prefix=$out --host=$host $configureFlags
|
||||
make
|
||||
make install
|
@ -1,25 +0,0 @@
|
||||
{ crossenv }:
|
||||
|
||||
crossenv.make_derivation rec {
|
||||
name = "secp256k1-b4e87";
|
||||
builder = ./builder.sh;
|
||||
|
||||
CFLAGS = "-fPIC";
|
||||
|
||||
configureFlags = [
|
||||
"--disable-shared"
|
||||
"--enable-module-recovery"
|
||||
];
|
||||
|
||||
cross_inputs = [ crossenv.libgmp ];
|
||||
native_inputs =
|
||||
with crossenv.nixpkgs;
|
||||
[ autoconf automake libtool m4 ];
|
||||
|
||||
src = crossenv.nixpkgs.fetchFromGitHub {
|
||||
owner = "bitcoin-core";
|
||||
repo = "secp256k1";
|
||||
rev = "e34ceb333b1c0e6f4115ecbb80c632ac1042fa49";
|
||||
sha256 = "0as78s179hcr3ysk3fw98k5wzabgnwri7vkkc17wg31lyz6ids6c";
|
||||
};
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
{ pkgs }:
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "secp256k1-b4e87";
|
||||
builder = ./builder.sh;
|
||||
|
||||
CFLAGS = "-fPIC";
|
||||
|
||||
configureFlags = [
|
||||
"--disable-shared"
|
||||
"--enable-module-recovery"
|
||||
];
|
||||
|
||||
buildInputs = [ pkgs.gmp ];
|
||||
nativeBuildInputs =
|
||||
with pkgs;
|
||||
[ autoconf automake libtool m4 ];
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "bitcoin-core";
|
||||
repo = "secp256k1";
|
||||
rev = "e34ceb333b1c0e6f4115ecbb80c632ac1042fa49";
|
||||
sha256 = "0as78s179hcr3ysk3fw98k5wzabgnwri7vkkc17wg31lyz6ids6c";
|
||||
};
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
cp -r $src $TMP/$name
|
||||
chmod -R u+w $TMP/$name
|
||||
cd $TMP/$name
|
||||
|
||||
cd ./build/Linux-386-SSE2-GCC
|
||||
sed -i 's|gcc|$(CC)|' Makefile
|
||||
sed -i 's/ar crs/$(AR) crs/' Makefile
|
||||
|
||||
make -j4
|
||||
|
||||
mkdir -p $out/{lib,include}
|
||||
cp $src/source/include/*.h $out/include
|
||||
cp softfloat.a $out/lib/libsoftfloat3.a
|
@ -1,16 +0,0 @@
|
||||
{ crossenv }:
|
||||
|
||||
crossenv.make_derivation rec {
|
||||
name = "softfloat3-ec4c7";
|
||||
builder = ./builder.sh;
|
||||
|
||||
CC = "${crossenv.host}-gcc";
|
||||
AR = "${crossenv.host}-ar";
|
||||
|
||||
src = crossenv.nixpkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "berkeley-softfloat-3";
|
||||
rev = "ec4c7e31b32e07aad80e52f65ff46ac6d6aad986";
|
||||
sha256 = "1lz4bazbf7lns1xh8aam19c814a4n4czq5xsq5rmi9sgqw910339";
|
||||
};
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{ pkgs }:
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "softfloat3-ec4c7";
|
||||
builder = ./builder.sh;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "berkeley-softfloat-3";
|
||||
rev = "ec4c7e31b32e07aad80e52f65ff46ac6d6aad986";
|
||||
sha256 = "1lz4bazbf7lns1xh8aam19c814a4n4czq5xsq5rmi9sgqw910339";
|
||||
};
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
cp -r $src ./src
|
||||
chmod -R a+w ./src
|
||||
cd ./src
|
||||
|
||||
LIBTOOLIZE=libtoolize ./autogen.sh
|
||||
bash ./configure --prefix=$out --host=$host $configureFlags
|
||||
make install
|
@ -1,17 +0,0 @@
|
||||
{ crossenv }:
|
||||
|
||||
crossenv.make_derivation rec {
|
||||
name = "uv-64294";
|
||||
native_inputs = with crossenv.nixpkgs; [ autoconf automake libtool m4 ];
|
||||
builder = ./builder.sh;
|
||||
|
||||
configureFlags = [ "--disable-shared" ];
|
||||
CFLAGS = "-fPIC";
|
||||
|
||||
src = crossenv.nixpkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "libuv";
|
||||
rev = "6429495dc9a80aaf1c243038b381451f12bc7dcf";
|
||||
sha256 = "07m2m4v9mds0wihzjxjwswwfj3rnk2ycr3vgwfcrvnb5xjz7rs15";
|
||||
};
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
{ pkgs }:
|
||||
|
||||
let
|
||||
|
||||
osx =
|
||||
with pkgs;
|
||||
lib.optionals stdenv.isDarwin (
|
||||
with darwin.apple_sdk.frameworks;
|
||||
[ Cocoa CoreServices ]);
|
||||
|
||||
in
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
name = "uv-64294";
|
||||
buildInputs = osx ++ (with pkgs; [ autoconf automake libtool m4 ]);
|
||||
builder = ./builder.sh;
|
||||
|
||||
CFLAGS = "-fPIC";
|
||||
configureFlags = [ "--disable-shared" ];
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "urbit";
|
||||
repo = "libuv";
|
||||
rev = "6429495dc9a80aaf1c243038b381451f12bc7dcf";
|
||||
sha256 = "07m2m4v9mds0wihzjxjwswwfj3rnk2ycr3vgwfcrvnb5xjz7rs15";
|
||||
};
|
||||
}
|
54
nix/lib/boot-fake-ship.nix
Normal file
54
nix/lib/boot-fake-ship.nix
Normal file
@ -0,0 +1,54 @@
|
||||
{ lib, stdenvNoCC, cacert }:
|
||||
|
||||
{ urbit, herb, arvo ? null, pill, ship, arguments ? [ "-l" ] }:
|
||||
|
||||
let
|
||||
|
||||
args = arguments ++ [ "-d" "-F" "${ship}" "-B" "${pill}" ]
|
||||
++ lib.optionals (arvo != null) [ "-A" "${arvo}" ];
|
||||
|
||||
in stdenvNoCC.mkDerivation {
|
||||
name = "fake-${ship}";
|
||||
|
||||
buildInputs = [ cacert urbit herb ];
|
||||
|
||||
phases = [ "buildPhase" "installPhase " ];
|
||||
|
||||
buildPhase = ''
|
||||
if ! [ -f "$SSL_CERT_FILE" ]; then
|
||||
header "$SSL_CERT_FILE doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -xeuo pipefail
|
||||
|
||||
urbit ${lib.concatStringsSep " " args} ./pier
|
||||
|
||||
cleanup () {
|
||||
if [ -f ./pier/.vere.lock ]; then
|
||||
kill $(< ./pier/.vere.lock) || true
|
||||
fi
|
||||
|
||||
set +x
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
check () {
|
||||
[ 3 -eq "$(herb ./pier -d 3)" ]
|
||||
}
|
||||
|
||||
if check && sleep 10 && check; then
|
||||
header "boot success"
|
||||
herb ./pier -p hood -d '+hood/exit'
|
||||
else
|
||||
header "boot failure"
|
||||
kill $(< ./pier/.vere.lock) || true
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mv ./pier $out
|
||||
'';
|
||||
}
|
37
nix/lib/default.nix
Normal file
37
nix/lib/default.nix
Normal file
@ -0,0 +1,37 @@
|
||||
# Functions that are expected run on the native (non-cross) system.
|
||||
|
||||
{ lib, recurseIntoAttrs, haskell-nix, callPackage }:
|
||||
|
||||
rec {
|
||||
bootFakeShip = callPackage ./boot-fake-ship.nix { };
|
||||
|
||||
testFakeShip = callPackage ./test-fake-ship.nix { inherit bootFakeShip; };
|
||||
|
||||
fetchGitHubLFS = callPackage ./fetch-github-lfs.nix { };
|
||||
|
||||
makeReleaseTarball = callPackage ./make-release-tarball.nix { };
|
||||
|
||||
collectHaskellComponents = project:
|
||||
let
|
||||
|
||||
# These functions pull out from the Haskell project either all the
|
||||
# components of a particular type, or all the checks.
|
||||
|
||||
pkgs = haskell-nix.haskellLib.selectProjectPackages project;
|
||||
|
||||
collectChecks = _:
|
||||
recurseIntoAttrs (builtins.mapAttrs (_: p: p.checks) pkgs);
|
||||
|
||||
collectComponents = type:
|
||||
haskell-nix.haskellLib.collectComponents' type pkgs;
|
||||
|
||||
# Recompute the Haskell package set sliced by component type
|
||||
in builtins.mapAttrs (type: f: f type) {
|
||||
# These names must match the subcomponent: components.<name>.<...>
|
||||
"library" = collectComponents;
|
||||
"tests" = collectComponents;
|
||||
"benchmarks" = collectComponents;
|
||||
"exes" = collectComponents;
|
||||
"checks" = collectChecks;
|
||||
};
|
||||
}
|
107
nix/lib/fetch-github-lfs.nix
Normal file
107
nix/lib/fetch-github-lfs.nix
Normal file
@ -0,0 +1,107 @@
|
||||
{ lib, stdenvNoCC, runCommandLocal, cacert, curl, jq }:
|
||||
|
||||
{ src
|
||||
# `name` shouldn't use `baseNameOf` otherwise we'll
|
||||
# get `is not allowed to refer to a store path` errors.
|
||||
, name ? baseNameOf src, owner ? "urbit", repo ? "urbit"
|
||||
, preferLocalBuild ? true }:
|
||||
|
||||
assert builtins.isPath src;
|
||||
|
||||
let
|
||||
|
||||
# Parse the first 7 characters of the supplied `src` path for the required
|
||||
# `version` key as defined by the lfs specification:
|
||||
# https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md
|
||||
#
|
||||
# If `version` exists we assume we're dealing with a lfs pointer and parse
|
||||
# the `oid` and `size` from the pointer and write these into a JSON object.
|
||||
#
|
||||
# If the first 7 characters are unrecognised we assume the path is a binary
|
||||
# file and set both `oid` and `size` to `null`.
|
||||
#
|
||||
# The `oid` and `size` are then JSON decoded into an expression to use
|
||||
# as the fixed-output derivation's `sha256 = oid`, and to form a download
|
||||
# operation payload to request the actual lfs blob's real url.
|
||||
pointer = builtins.fromJSON (builtins.readFile
|
||||
(runCommandLocal "lfs-pointer-${name}" { } ''
|
||||
oid="null"
|
||||
size="null"
|
||||
|
||||
if [[ "$(head -c 7 "${src}")" != "version" ]]; then
|
||||
header "lfs ${src} is a binary blob, skipping"
|
||||
else
|
||||
header "reading lfs pointer from ${src}"
|
||||
|
||||
contents=($(awk '{print $2}' "${src}"))
|
||||
oid="''${contents[1]#sha256:}"
|
||||
size="''${contents[2]}"
|
||||
fi
|
||||
|
||||
cat <<EOF > "$out"
|
||||
{"oid": "$oid", "size": $size}
|
||||
EOF
|
||||
''));
|
||||
|
||||
downloadUrl =
|
||||
"https://github.com/${owner}/${repo}.git/info/lfs/objects/batch";
|
||||
|
||||
# Encode `oid` and `size` into a download operation per:
|
||||
# https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md
|
||||
#
|
||||
# This is done using toJSON to avoid bash quotation issues.
|
||||
downloadPayload = builtins.toJSON {
|
||||
operation = "download";
|
||||
objects = [ pointer ];
|
||||
};
|
||||
|
||||
# Define a fixed-output derivation using the lfs pointer's `oid` as the
|
||||
# expected sha256 output hash, if `oid` is not null.
|
||||
#
|
||||
|
||||
# 1. Request the actual url of the binary file from the lfs batch api.
|
||||
# 2. Download the binary file contents to `$out`.
|
||||
download = stdenvNoCC.mkDerivation {
|
||||
name = "lfs-blob-${name}";
|
||||
nativeBuildInputs = [ curl jq ];
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
curl=(
|
||||
curl
|
||||
--location
|
||||
--max-redirs 20
|
||||
--retry 3
|
||||
--disable-epsv
|
||||
--cookie-jar cookies
|
||||
$NIX_CURL_FLAGS
|
||||
)
|
||||
|
||||
header "reading lfs metadata from ${downloadUrl}"
|
||||
|
||||
href=$("''${curl[@]}" \
|
||||
-d '${downloadPayload}' \
|
||||
-H 'Accept: application/vnd.git-lfs+json' \
|
||||
'${downloadUrl}' \
|
||||
| jq -r '.objects[0].actions.download.href')
|
||||
|
||||
header "download lfs data from remote"
|
||||
|
||||
# Pozor/Achtung: the href contains credential and signature information,
|
||||
# so we avoid echoing it to stdout/err.
|
||||
"''${curl[@]}" -s --output "$out" "$href"
|
||||
'';
|
||||
|
||||
impureEnvVars = stdenvNoCC.lib.fetchers.proxyImpureEnvVars;
|
||||
|
||||
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "flat";
|
||||
outputHash = pointer.oid;
|
||||
|
||||
inherit preferLocalBuild;
|
||||
};
|
||||
|
||||
# If `pointer.oid` is null then supplied the `src` must be a binary
|
||||
# blob and can be returned directly.
|
||||
in if pointer.oid == null || pointer.size == null then src else download
|
30
nix/lib/make-release-tarball.nix
Normal file
30
nix/lib/make-release-tarball.nix
Normal file
@ -0,0 +1,30 @@
|
||||
{ lib, stdenvNoCC, coreutils }:
|
||||
|
||||
{ name, extension ? "tgz", contents # { target = source, ... }
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
transforms = builtins.concatStringsSep " " (lib.mapAttrsToList
|
||||
(target: source: ''--transform "s,${source},${target},"'') contents);
|
||||
|
||||
sources = builtins.concatStringsSep " "
|
||||
(lib.mapAttrsToList (_target: source: "${source}") contents);
|
||||
|
||||
in stdenvNoCC.mkDerivation {
|
||||
name = "${name}.${extension}";
|
||||
phases = [ "buildPhase" ];
|
||||
|
||||
nativeBuildInputs = [ coreutils ];
|
||||
|
||||
buildPhase = ''
|
||||
tar -vczf $out \
|
||||
--owner=0 --group=0 --mode=u+rw,uga+r \
|
||||
--absolute-names \
|
||||
--hard-dereference \
|
||||
${transforms} \
|
||||
${sources}
|
||||
'';
|
||||
|
||||
preferLocalBuild = true;
|
||||
}
|
173
nix/lib/test-fake-ship.nix
Normal file
173
nix/lib/test-fake-ship.nix
Normal file
@ -0,0 +1,173 @@
|
||||
{ lib, stdenvNoCC, cacert, python3, bootFakeShip }:
|
||||
|
||||
{ urbit, herb, arvo ? null, pill, ship ? "bus", arguments ? urbit.meta.arguments
|
||||
, doCheck ? true }:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "test-${ship}";
|
||||
|
||||
src = bootFakeShip { inherit urbit herb arvo pill ship; };
|
||||
|
||||
phases = [ "unpackPhase" "buildPhase" "checkPhase" ];
|
||||
|
||||
buildInputs = [ cacert urbit herb python3 ];
|
||||
|
||||
unpackPhase = ''
|
||||
cp -R $src ./pier
|
||||
chmod -R u+rw ./pier
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
set -x
|
||||
|
||||
urbit ${lib.concatStringsSep " " arguments} -d ./pier 2> urbit-output
|
||||
|
||||
# Sledge Hammer!
|
||||
# See: https://github.com/travis-ci/travis-ci/issues/4704#issuecomment-348435959
|
||||
python3 -c $'import os\n[os.set_blocking(i, True) for i in range(3)]\n'
|
||||
|
||||
tail -F urbit-output >&2 &
|
||||
|
||||
tailproc=$!
|
||||
|
||||
cleanup () {
|
||||
kill $(cat ./pier/.vere.lock) || true
|
||||
kill "$tailproc" 2>/dev/null || true
|
||||
|
||||
set +x
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
# measure initial memory usage
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %init-mass-start ~'
|
||||
herb ./pier -p hood -d '+hood/mass'
|
||||
herb ./pier -d '~& ~ ~& %init-mass-end ~'
|
||||
|
||||
# run the unit tests
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %test-unit-start ~'
|
||||
herb ./pier -d '####-test %/tests'
|
||||
herb ./pier -d '~& ~ ~& %test-unit-end ~'
|
||||
|
||||
# use the :test app to build all agents, generators, and marks
|
||||
#
|
||||
herb ./pier -p hood -d '+hood/start %test'
|
||||
|
||||
herb ./pier -d '~& ~ ~& %test-agents-start ~'
|
||||
herb ./pier -p test -d '%agents'
|
||||
herb ./pier -d '~& ~ ~& %test-agents-end ~'
|
||||
|
||||
herb ./pier -d '~& ~ ~& %test-generators-start ~'
|
||||
herb ./pier -p test -d '%generators'
|
||||
herb ./pier -d '~& ~ ~& %test-generators-end ~'
|
||||
|
||||
herb ./pier -d '~& ~ ~& %test-marks-start ~'
|
||||
herb ./pier -p test -d '%marks'
|
||||
herb ./pier -d '~& ~ ~& %test-marks-end ~'
|
||||
|
||||
# measure memory usage post tests
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %test-mass-start ~'
|
||||
herb ./pier -p hood -d '+hood/mass'
|
||||
herb ./pier -d '~& ~ ~& %test-mass-end ~'
|
||||
|
||||
# defragment the loom
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %pack-start ~'
|
||||
herb ./pier -p hood -d '+hood/pack'
|
||||
herb ./pier -d '~& ~ ~& %pack-end ~'
|
||||
|
||||
# reclaim space within arvo
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %trim-start ~'
|
||||
herb ./pier -p hood -d '+hood/trim'
|
||||
herb ./pier -d '~& ~ ~& %trim-end ~'
|
||||
|
||||
# measure memory usage pre |meld
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %trim-mass-start ~'
|
||||
herb ./pier -p hood -d '+hood/mass'
|
||||
herb ./pier -d '~& ~ ~& %trim-mass-end ~'
|
||||
|
||||
# globally deduplicate
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %meld-start ~'
|
||||
herb ./pier -p hood -d '+hood/meld'
|
||||
herb ./pier -d '~& ~ ~& %meld-end ~'
|
||||
|
||||
# measure memory usage post |meld
|
||||
#
|
||||
herb ./pier -d '~& ~ ~& %meld-mass-start ~'
|
||||
herb ./pier -p hood -d '+hood/mass'
|
||||
herb ./pier -d '~& ~ ~& %meld-mass-end ~'
|
||||
|
||||
herb ./pier -p hood -d '+hood/exit'
|
||||
|
||||
cleanup
|
||||
|
||||
# Collect output
|
||||
cp urbit-output test-output-unit
|
||||
cp urbit-output test-output-agents
|
||||
cp urbit-output test-output-generators
|
||||
cp urbit-output test-output-marks
|
||||
|
||||
sed -i '0,/test-unit-start/d' test-output-unit
|
||||
sed -i '/test-unit-end/,$d' test-output-unit
|
||||
|
||||
sed -i '0,/test-agents-start/d' test-output-agents
|
||||
sed -i '/test-agents-end/,$d' test-output-agents
|
||||
|
||||
sed -i '0,/test-generators-start/d' test-output-generators
|
||||
sed -i '/test-generators-end/,$d' test-output-generators
|
||||
|
||||
sed -i '0,/test-marks-start/d' test-output-marks
|
||||
sed -i '/test-marks-end/,$d' test-output-marks
|
||||
|
||||
mkdir -p $out
|
||||
|
||||
cp test-output-* $out/
|
||||
'';
|
||||
|
||||
checkPhase = ''
|
||||
hdr () {
|
||||
echo =====$(sed 's/./=/g' <<< "$1")=====
|
||||
echo ==== $1 ====
|
||||
echo =====$(sed 's/./=/g' <<< "$1")=====
|
||||
}
|
||||
|
||||
for f in $(find "$out/" -type f); do
|
||||
hdr "$(basename $f)"
|
||||
cat "$f"
|
||||
done
|
||||
|
||||
fail=0
|
||||
|
||||
for f in $(find "$out/" -type f); do
|
||||
if egrep "((FAILED|CRASHED)|(ford|warn):) " $f >/dev/null; then
|
||||
if [[ $fail -eq 0 ]]; then
|
||||
hdr "Test Failures"
|
||||
fi
|
||||
|
||||
echo "ERROR Test failure in $(basename $f)"
|
||||
|
||||
((fail++))
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $fail -eq 0 ]]; then
|
||||
hdr "Success"
|
||||
fi
|
||||
|
||||
exit "$fail"
|
||||
'';
|
||||
|
||||
inherit doCheck;
|
||||
|
||||
# Fix 'bind: operation not permitted' when nix.useSandbox = true on darwin.
|
||||
# See https://github.com/NixOS/nix/blob/5f6840fbb49ae5b534423bd8a4360646ee93dbaf/src/libstore/build.cc#L2961
|
||||
__darwinAllowLocalNetworking = true;
|
||||
|
||||
meta = { platforms = [ "x86_64-linux" ]; };
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
let
|
||||
|
||||
nixpkgs = import ./nixpkgs.nix;
|
||||
|
||||
osx_sdk = builtins.fetchurl {
|
||||
sha256 = "89aa34dfe5bcbc7d53d3c55a84b35ac810ecfbcdd16a64c9667992b0c36c60c4";
|
||||
url = "https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/MacOSX10.11.sdk.tar.xz";
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
import ./nixcrpkgs/top.nix { inherit osx_sdk nixpkgs; }
|
4
nix/nixcrpkgs/.gitignore
vendored
4
nix/nixcrpkgs/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
/result*
|
||||
/support/results
|
||||
macos/MacOSX10.12.sdk.tar.xz
|
||||
macos/MacOSX10.13.sdk.tar.xz
|
@ -1,31 +0,0 @@
|
||||
Copyright (c) 2003-2017 Eelco Dolstra and the Nixpkgs/NixOS contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
======================================================================
|
||||
|
||||
Note: the license above does not apply to the packages built by the
|
||||
Nix Packages collection, merely to the package descriptions (i.e., Nix
|
||||
expressions, build scripts, etc.). Also, the license does not apply
|
||||
to some of the binaries used for bootstrapping Nixpkgs (e.g.,
|
||||
pkgs/stdenv/linux/tools/bash). It also might not apply to patches
|
||||
included in Nixpkgs, which may be derivative works of the packages to
|
||||
which they apply. The aforementioned artifacts are all covered by the
|
||||
licenses of the respective packages.
|
@ -1,25 +0,0 @@
|
||||
Copyright (c) 2017 Pololu Corporation. For more information, see
|
||||
|
||||
http://www.pololu.com/
|
||||
http://forum.pololu.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
@ -1,175 +0,0 @@
|
||||
# nixcrpkgs
|
||||
|
||||
[www.pololu.com](https://www.pololu.com/)
|
||||
|
||||
*nixcrpkgs* is a collection of tools for cross-compiling statically-linked,
|
||||
standalone software applications. With nixcrpkgs, you can specify what
|
||||
platforms you want to target, what libraries and build tools you depend on, and
|
||||
the commands that build your software. When you build your software, nixcrpkgs
|
||||
will automatically take care of building or retrieving everything you need,
|
||||
including cross-compilers and libraries.
|
||||
|
||||
nixcrpkgs primarily consists of *Nix expressions*, which are recipes for
|
||||
building software with [Nix, the purely functional package
|
||||
manager][nix]. These recipes build on top of the [Nix
|
||||
Packages collection (Nixpkgs)][nixpkgs].
|
||||
|
||||
## Features
|
||||
|
||||
- Supported target platforms:
|
||||
- Windows (32-bit or 64-bit) using [mingw-w64](https://mingw-w64.org/) and [GCC](https://gcc.gnu.org/) 6.3.0
|
||||
- Linux (32-bit, 64-bit, and ARM) using [musl](https://www.musl-libc.org/) and [GCC](https://gcc.gnu.org/) 6.3.0
|
||||
- macOS using [Clang](https://clang.llvm.org/) 5.0.0
|
||||
- Supported languages for cross-compiling:
|
||||
- C
|
||||
- C++
|
||||
- Supported build platforms:
|
||||
- Linux
|
||||
- Supported build tools:
|
||||
- [CMake](https://cmake.org/)
|
||||
- [GNU Make](https://www.gnu.org/software/make/)
|
||||
- [Ninja](https://ninja-build.org/)
|
||||
- pkg-config (as implemented by [pkgconf](https://github.com/pkgconf/pkgconf))
|
||||
- [GNU Bash](https://www.gnu.org/software/bash/)
|
||||
- [Ruby](https://www.ruby-lang.org/)
|
||||
- Notable supported libraries:
|
||||
- [Qt](https://www.qt.io/) 5.9.6
|
||||
- [libusb](https://libusb.info/)
|
||||
- [libusbp](https://github.com/pololu/libusbp)
|
||||
- [Windows API](https://en.wikipedia.org/wiki/Windows_API) (thanks to mingw-w64)
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
To get started, you should first install Nix on a Linux machine by following the
|
||||
instructions on the [Nix website][nix].
|
||||
|
||||
Next, run `df -h` to make sure you have enough disk space.
|
||||
|
||||
- The filesystem that holds `/nix` should have several gigabytes of free
|
||||
space. Each GCC cross-compiler takes about 300 MB while each Qt installation
|
||||
takes about 800 MB.
|
||||
- The filesystem that holds `/tmp` should have at least 4 gigabytes of free
|
||||
space, which will be needed while building cross-compilers. If that is not the
|
||||
case on your system, you can set the `TMPDIR` environment variable to tell
|
||||
`nix-build` to perform its builds in a different directory on a filesystem with
|
||||
more free space.
|
||||
|
||||
Next, clone or download this repository and use `cd` to change into the
|
||||
top-level directory.
|
||||
|
||||
To build a simple "Hello, World!" program for Windows, run:
|
||||
|
||||
nix-build -A win32.hello
|
||||
|
||||
The first time you run this command, it will take a while because Nix has to
|
||||
build a cross-compiling toolchain. When `nix-build` is done, it will print the
|
||||
name of a directory in `/nix/store` that holds the resulting program, and it
|
||||
will create a symbolic link in the current directory named `result` that points
|
||||
to that directory.
|
||||
|
||||
If you copy `result/bin/hello.exe` to a Windows machine and run it, you should
|
||||
see a message box appear that says "Hello, World!".
|
||||
|
||||
If you run `nix-build -A win32.hello` a second time, Nix will detect that
|
||||
nothing about the build recipes has changed, so it will simply print the
|
||||
directory name and remake the symbolic link.
|
||||
|
||||
To see how the `hello` package is specified in nixcrpkgs, you can look in
|
||||
`pkgs.nix` and the `pkgs/hello` directory. To see how the GCC cross-compiler
|
||||
for Windows was specified, you can look in the `mingw-w64` directory. If you
|
||||
change any of the build recipes for `hello` or its dependencies and then run the
|
||||
`nix-build` command again, Nix will automatically rebuild those dependencies and
|
||||
anything that depends on them, ensuring that you always get a consistent build.
|
||||
|
||||
|
||||
### Obtaining the macOS SDK
|
||||
|
||||
If you are trying to build software for macOS, you will need to get a
|
||||
macOS SDK tarball and put it in the the right place. Otherwise, you
|
||||
will get an error like this:
|
||||
|
||||
error: getting attributes of path '/home/yourname/nixcrpkgs/macos/MacOSX.sdk.tar.xz': No such file or directory
|
||||
|
||||
To generate the tarball, follow these steps:
|
||||
|
||||
1. On a macOS machine, install [Xcode](https://developer.apple.com/xcode/).
|
||||
2. Download this repository to the machine.
|
||||
3. In a Terminal window, run the `macos/gen_sdk_package.sh` script from this repository.
|
||||
4. After several minutes, the current directory should have a tarball with a name like
|
||||
`MacOSX10.12.sdk.tar.xz` and a size of about 25 MB.
|
||||
5. Copy the SDK tarball file to the machine where you will be building software,
|
||||
and put it in the `macos` directory.
|
||||
6. The nixcrpkgs build recipe for the SDK is hardcoded to look for a file named
|
||||
`MacOSX.sdk.tar.xz`, so rename the tarball to that.
|
||||
7. Consider keeping a backup of the tarball so you can always rebuild any software you
|
||||
made with it.
|
||||
|
||||
Now you should be able to build your software for macOS.
|
||||
|
||||
|
||||
## Integrating nixcrpkgs into your project
|
||||
|
||||
The instructions above show how to cross-compile a "Hello, World!" program that
|
||||
is included with nixcrpkgs. Instead of including your project in nixcrpkgs like
|
||||
the hello program, you will probably want to just use nixcrpkgs as a tool in
|
||||
your project. To get an idea of how to do that, you can look at other projects
|
||||
that have done the same. In the projects listed below, you should look for a
|
||||
file named `default.nix` in the top-level directory and look for build
|
||||
instructions that explain what `nix-build` commands to run.
|
||||
|
||||
* The [Pololu Tic Stepper Motor Controller software](https://github.com/pololu/pololu-tic-software) is a C/C++ project that uses CMake and nixcrpkgs.
|
||||
* The [Pololu USB AVR Programmer v2 software](https://github.com/pololu/pololu-usb-avr-programmer-v2) is a C++ project that uses CMake and nixcrpkgs.
|
||||
* The [Pololu USB Bootloader Utility (p-load)](https://github.com/pololu/p-load) is a C++ project that uses CMake and nixcrpkgs.
|
||||
|
||||
[nix]: http://nixos.org/nix/
|
||||
[nixpkgs]: http://nixos.org/nixpkgs/
|
||||
|
||||
## Updating package versions
|
||||
|
||||
Each build recipe in nixcrpkgs specifies a version number for the software that it builds. It is relatively easy to update the recipes even if you have not worked with Nix before. The general procedure is:
|
||||
|
||||
1) Find the build recipe you want to update. For example, if you wanted to update the version of GCC used to build Linux programs, you would update the build recipe in `linux/gcc/default.nix`.
|
||||
2) Find the part of the build recipe where the software sources are downloaded from the internet. It is usually a `fetchurl` command with two parameters: `url` and `sha256`. The `url` parameter usually refers to a version string defined nearby, so update that version string and/or the `url` parameter as desired.
|
||||
3) In a shell, run `nix-prefetch-url URL`, where URL is the new URL specified in your modified build recipe with all version variables fully expanded). This command will download the URL you specified, store it in the Nix store, and output the hash of it in the proper format for Nix build recipes.
|
||||
3) Update the `sha256` hash string in the build recipe by replacing it with the hash that was printed in the output of `nix-prefetch-url`. Updating the hash in the build recipe is important: Nix uses it to determine whether you already downloaded the right file, so if you don't update the hash then Nix might use the wrong file (e.g. an older version of the software that you downloaded earlier).
|
||||
4) Run the usual `nix-build` command that you use to build your software. For example, you could go to the top-level directory of nixcrpkgs and run `nix-build -A rpi.hello` to build a "Hello world" program for the Raspberry Pi, or you could run `nix-build -A rpi.gcc` to just build the cross-compiler.
|
||||
5) Fix any error messages that happen, one at a time. (Tip: to make a `.patch` file, run `diff -ur old new` where `old` and `new` are directories that contain the unpatched and patched versions of the source code, respectively.)
|
||||
6) Once things are working, consider publishing your work on Github so others can benefit from what you figured out.
|
||||
|
||||
|
||||
## Maintaining the nixcrpkgs system
|
||||
|
||||
You should occasionally run `nix-collect-garbage` to remove items that are no
|
||||
longer needed and reclaim your disk space. However, note that Nix will
|
||||
typically remove all of your cross compilers and libraries when you run this
|
||||
command, so be prepared to do a lengthy mass rebuild. The Nix manual has more
|
||||
information about [Nix garbage
|
||||
collection](http://nixos.org/nix/manual/#sec-garbage-collection).
|
||||
|
||||
You should occasionally run `nix-channel --update` to update to the latest
|
||||
version of Nixpkgs. However, when doing this, be aware that the new version of
|
||||
Nixpkgs might require you to do a mass rebuild.
|
||||
|
||||
You should occasionally update your checkout of the nixcrpkgs repository to get
|
||||
the latest versions of build tools, new features, and bug fixes. Once again,
|
||||
this might require a mass rebuild.
|
||||
|
||||
If you want your builds to be very stable and reliable, you could make forks of
|
||||
nixcrpkgs and/or Nixpkgs and update them at your own pace, carefully considering
|
||||
any changes made by others before merging them in. That's one of the beauties
|
||||
of Nix when compared to other package management systems: you will never be
|
||||
forced to upgrade your build tools, and using old tools is just as easy as using
|
||||
new ones. You can use the `NIX_PATH` environment variable to tell `nix-build`
|
||||
to use your forked versions.
|
||||
|
||||
|
||||
## Related projects
|
||||
|
||||
* [osxcross]: Cross-compiling toolchain targeting macOS.
|
||||
* [musl-cross-make]: Makefile-based build tool for creating cross-compilers targeting musl.
|
||||
* [musl_nix_arm]: A fork of nixcrpkgs with a focus on building Docker images for ARM Linux.
|
||||
|
||||
[osxcross]: https://github.com/tpoechtrager/osxcross
|
||||
[musl-cross-make]: https://github.com/richfelker/musl-cross-make
|
||||
[musl_nix_arm]: https://github.com/filleduchaos/musl_nix_arm
|
@ -1,8 +0,0 @@
|
||||
source $setup
|
||||
names=($names)
|
||||
dirs=($dirs)
|
||||
mkdir $out
|
||||
cd $out
|
||||
for ((i=0;i<${#names[@]};i++)); do
|
||||
ln -s "${dirs[i]}" "${names[i]}"
|
||||
done
|
@ -1,8 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
cat > $out <<EOF
|
||||
set(CMAKE_SYSTEM_NAME ${cmake_system_name})
|
||||
set(CMAKE_C_COMPILER ${host}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${host}-g++)
|
||||
set(CMAKE_RC_COMPILER ${host}-windres)
|
||||
EOF
|
@ -1,7 +0,0 @@
|
||||
{ nixpkgs, host, cmake_system_name }:
|
||||
|
||||
nixpkgs.stdenv.mkDerivation {
|
||||
name = "cmake_toolchain-${host}.txt";
|
||||
builder = ./builder.sh;
|
||||
inherit host cmake_system_name;
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
import ./top.nix {
|
||||
nixpkgs = import <nixpkgs> {};
|
||||
osx_sdk = ./macos/MacOSX.sdk.tar.xz;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
## Linux GCC toolchain
|
||||
|
||||
The files in this directory define how we build our GCC cross-compiler that
|
||||
targets Linux, using the musl libc.
|
||||
|
||||
### A note about `-rdynamic`
|
||||
|
||||
Do not pass `-rdynamic` to GCC when building an executable; it will cause the compiled executable to depend on a musl libc dynamic loader in `/lib` that probably doesn't exist, and defeats the point of static linking. The `-static` option overrides `-rdynamic`, so adding`-static` to the linker flags of a project using `-rdynamic` is one way to fix the issue.
|
||||
|
||||
CMake will pass `-rdynamic` unless you set [CMP0065](https://cmake.org/cmake/help/v3.8/policy/CMP0065.html) to new as shown below, or set your [CMake policy version](https://cmake.org/cmake/help/v3.8/command/cmake_policy.html) to 3.4 or later.
|
||||
|
||||
# Don't use -rdynamic since it causes Musl static linking to not work.
|
||||
cmake_policy(SET CMP0065 NEW)
|
||||
|
@ -1,26 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
unset CC CXX CFLAGS LDFLAGS LD AR AS RANLIB SIZE STRINGS NM STRIP OBJCOPY
|
||||
|
||||
tar -xf $src
|
||||
|
||||
cd binutils-$version
|
||||
for patch in $patches; do
|
||||
echo applying patch $patch
|
||||
patch -p1 -i $patch
|
||||
done
|
||||
|
||||
# Clear the default library search path (noSysDirs)
|
||||
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
|
||||
|
||||
cd ..
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
../binutils-$version/configure --prefix=$out $configure_flags
|
||||
|
||||
make
|
||||
|
||||
make install
|
||||
|
@ -1,26 +0,0 @@
|
||||
{ native, host }:
|
||||
|
||||
native.make_derivation rec {
|
||||
name = "binutils-${version}-${host}";
|
||||
|
||||
version = "2.27";
|
||||
|
||||
src = native.nixpkgs.fetchurl {
|
||||
url = "mirror://gnu/binutils/binutils-${version}.tar.bz2";
|
||||
sha256 = "125clslv17xh1sab74343fg6v31msavpmaa1c1394zsqa773g5rn";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./deterministic.patch
|
||||
];
|
||||
|
||||
native_inputs = [ native.nixpkgs.bison native.nixpkgs.zlib ];
|
||||
|
||||
configure_flags =
|
||||
"--target=${host} " +
|
||||
"--enable-shared " +
|
||||
"--enable-deterministic-archives " +
|
||||
"--disable-werror ";
|
||||
|
||||
builder = ./builder.sh;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
Make binutils output deterministic by default.
|
||||
--- orig/ld/ldlang.c
|
||||
+++ new/ld/ldlang.c
|
||||
@@ -3095,6 +3095,8 @@
|
||||
ldfile_output_machine))
|
||||
einfo (_("%P%F:%s: can not set architecture: %E\n"), name);
|
||||
|
||||
+ link_info.output_bfd->flags |= BFD_DETERMINISTIC_OUTPUT;
|
||||
+
|
||||
link_info.hash = bfd_link_hash_table_create (link_info.output_bfd);
|
||||
if (link_info.hash == NULL)
|
||||
einfo (_("%P%F: can not create hash table: %E\n"));
|
@ -1,78 +0,0 @@
|
||||
{ native, arch, gcc_options ? "" }:
|
||||
let
|
||||
nixpkgs = native.nixpkgs;
|
||||
|
||||
host = "${arch}-linux-musleabi";
|
||||
|
||||
os = "linux";
|
||||
|
||||
compiler = "gcc";
|
||||
|
||||
exe_suffix = "";
|
||||
|
||||
binutils = import ./binutils { inherit native host; };
|
||||
|
||||
linux_arch =
|
||||
if arch == "i686" || arch == "x86_64" then "x86"
|
||||
else if arch == "armv6" || arch == "armv7" then "arm"
|
||||
else throw "not sure what Linux architecture code to use";
|
||||
|
||||
headers = native.make_derivation rec {
|
||||
name = "linux-headers-${linux_arch}-${version}";
|
||||
inherit linux_arch;
|
||||
version = "4.4.10";
|
||||
src = nixpkgs.fetchurl {
|
||||
url = "https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${version}.tar.xz";
|
||||
sha256 = "1kpjvvd9q9wwr3314q5ymvxii4dv2d27295bzly225wlc552xhja";
|
||||
};
|
||||
builder = ./headers_builder.sh;
|
||||
};
|
||||
|
||||
gcc = import ./gcc {
|
||||
inherit native host binutils headers gcc_options;
|
||||
};
|
||||
|
||||
license = native.make_derivation {
|
||||
name = "linux-license";
|
||||
inherit (gcc) musl_src gcc_src;
|
||||
linux_src = headers.src;
|
||||
builder = ./license_builder.sh;
|
||||
};
|
||||
|
||||
global_license_set = { _global = license; };
|
||||
|
||||
cmake_toolchain = import ../cmake_toolchain {
|
||||
cmake_system_name = "Linux";
|
||||
inherit nixpkgs host;
|
||||
};
|
||||
|
||||
crossenv = {
|
||||
is_cross = true;
|
||||
|
||||
# Build tools available on the PATH for every derivation.
|
||||
default_native_inputs = native.default_native_inputs ++
|
||||
[ gcc binutils native.pkgconf native.wrappers ];
|
||||
|
||||
# Target info environment variables.
|
||||
inherit host arch os compiler exe_suffix;
|
||||
|
||||
# CMake toolchain file.
|
||||
inherit cmake_toolchain;
|
||||
|
||||
# A wide variety of programs and build tools.
|
||||
inherit nixpkgs;
|
||||
|
||||
# Some native build tools made by nixcrpkgs.
|
||||
inherit native;
|
||||
|
||||
# License information that should be shipped with any software
|
||||
# compiled by this environment.
|
||||
inherit global_license_set;
|
||||
|
||||
# Make it easy to refer to the build tools.
|
||||
inherit headers gcc binutils;
|
||||
|
||||
make_derivation = import ../make_derivation.nix crossenv;
|
||||
};
|
||||
in
|
||||
crossenv
|
@ -1,34 +0,0 @@
|
||||
source $setup
|
||||
|
||||
tar -xf $gcc_src
|
||||
mv gcc-* gcc
|
||||
cd gcc
|
||||
for patch in $gcc_patches; do
|
||||
echo applying patch $patch
|
||||
patch -p1 -i $patch
|
||||
done
|
||||
cd ..
|
||||
|
||||
tar -xf $musl_src
|
||||
mv musl-* musl
|
||||
|
||||
mkdir -p $out/$host
|
||||
cp -r --no-preserve=mode $headers/include $out/$host
|
||||
|
||||
mkdir build_gcc
|
||||
cd build_gcc
|
||||
../gcc/configure --prefix=$out $gcc_conf
|
||||
cd ..
|
||||
make -C build_gcc all-gcc
|
||||
mkdir build_musl
|
||||
cd build_musl
|
||||
../musl/configure --prefix=$out/$host $musl_conf \
|
||||
CC="../build_gcc/gcc/xgcc -B ../build_gcc/gcc" \
|
||||
LIBCC=../build_gcc/$host/libgcc/libgcc.a
|
||||
cd ..
|
||||
make -C build_musl install-headers
|
||||
make -C build_gcc all-target-libgcc
|
||||
make -C build_musl
|
||||
make -C build_musl install
|
||||
make -C build_gcc
|
||||
make -C build_gcc install
|
@ -1,81 +0,0 @@
|
||||
{ native, host, binutils, headers, gcc_options }:
|
||||
|
||||
let
|
||||
nixpkgs = native.nixpkgs;
|
||||
isl = nixpkgs.isl_0_14;
|
||||
inherit (nixpkgs) stdenv lib fetchurl;
|
||||
inherit (nixpkgs) gmp libmpc libelf mpfr zlib;
|
||||
in
|
||||
|
||||
native.make_derivation rec {
|
||||
name = "gcc-${gcc_version}-${host}";
|
||||
|
||||
gcc_version = "6.3.0";
|
||||
gcc_src = fetchurl {
|
||||
url = "mirror://gnu/gcc/gcc-${gcc_version}/gcc-${gcc_version}.tar.bz2";
|
||||
sha256 = "17xjz30jb65hcf714vn9gcxvrrji8j20xm7n33qg1ywhyzryfsph";
|
||||
};
|
||||
|
||||
musl_version = "1.1.16";
|
||||
musl_src = nixpkgs.fetchurl {
|
||||
url = "https://www.musl-libc.org/releases/musl-${musl_version}.tar.gz";
|
||||
sha256 = "048h0w4yjyza4h05bkc6dpwg3hq6l03na46g0q1ha8fpwnjqawck";
|
||||
};
|
||||
|
||||
inherit host headers;
|
||||
|
||||
builder = ./builder.sh;
|
||||
|
||||
gcc_patches = [
|
||||
# These patches are from nixpkgs.
|
||||
./use-source-date-epoch.patch
|
||||
./libstdc++-target.patch
|
||||
|
||||
# Without this, we cannot build a simple hello world program for ARM.
|
||||
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31798
|
||||
./link_gcc_c_sequence_spec.patch
|
||||
|
||||
# Fix a compiler error in GCC's ubsan.c: ISO C++ forbids comparison
|
||||
# between pointer and integer.
|
||||
./ubsan.patch
|
||||
];
|
||||
|
||||
native_inputs = [ binutils ];
|
||||
|
||||
gcc_conf =
|
||||
"--target=${host} " +
|
||||
gcc_options +
|
||||
"--with-gnu-as " +
|
||||
"--with-gnu-ld " +
|
||||
"--with-as=${binutils}/bin/${host}-as " +
|
||||
"--with-ld=${binutils}/bin/${host}-ld " +
|
||||
"--with-isl=${isl} " +
|
||||
"--with-gmp-include=${gmp.dev}/include " +
|
||||
"--with-gmp-lib=${gmp.out}/lib " +
|
||||
"--with-libelf=${libelf}" +
|
||||
"--with-mpfr=${mpfr.dev} " +
|
||||
"--with-mpfr-include=${mpfr.dev}/include " +
|
||||
"--with-mpfr-lib=${mpfr.out}/lib " +
|
||||
"--with-mpc=${libmpc.out} " +
|
||||
"--with-zlib-include=${zlib.dev}/include " +
|
||||
"--with-zlib-lib=${zlib.out}/lib " +
|
||||
"--enable-deterministic-archives " +
|
||||
"--enable-languages=c,c++ " +
|
||||
"--enable-libstdcxx-time " +
|
||||
"--enable-static " +
|
||||
"--enable-tls " +
|
||||
"--disable-gnu-indirect-function " +
|
||||
"--disable-libmudflap " +
|
||||
"--disable-libmpx " +
|
||||
"--disable-libsanitizer " +
|
||||
"--disable-multilib " +
|
||||
"--disable-shared " +
|
||||
"--disable-werror";
|
||||
|
||||
musl_conf =
|
||||
"--target=${host} " +
|
||||
"--disable-shared";
|
||||
|
||||
hardeningDisable = [ "format" ];
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
Patch to make the target libraries 'configure' scripts find the proper CPP.
|
||||
I noticed that building the mingw32 cross compiler.
|
||||
Looking at the build script for mingw in archlinux, I think that only nixos
|
||||
needs this patch. I don't know why.
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 93f66b6..d691917 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -266,6 +266,7 @@ BASE_TARGET_EXPORTS = \
|
||||
AR="$(AR_FOR_TARGET)"; export AR; \
|
||||
AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
|
||||
CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
|
||||
+ CPP="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CC; \
|
||||
CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
|
||||
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
|
||||
CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
|
||||
@@ -291,11 +292,13 @@ BASE_TARGET_EXPORTS = \
|
||||
RAW_CXX_TARGET_EXPORTS = \
|
||||
$(BASE_TARGET_EXPORTS) \
|
||||
CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
|
||||
- CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
|
||||
+ CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
|
||||
+ CXXCPP="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX;
|
||||
|
||||
NORMAL_TARGET_EXPORTS = \
|
||||
$(BASE_TARGET_EXPORTS) \
|
||||
- CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
|
||||
+ CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
|
||||
+ CXXCPP="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX;
|
||||
|
||||
# Where to find GMP
|
||||
HOST_GMPLIBS = @gmplibs@
|
@ -1,12 +0,0 @@
|
||||
diff -ur gcc-6.3.0-orig/gcc/config/gnu-user.h gcc-6.3.0/gcc/config/gnu-user.h
|
||||
--- gcc-6.3.0-orig/gcc/config/gnu-user.h 2017-08-13 19:03:08.671572528 -0700
|
||||
+++ gcc-6.3.0/gcc/config/gnu-user.h 2017-08-13 19:15:00.768588499 -0700
|
||||
@@ -123,7 +123,7 @@
|
||||
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
#define LINK_GCC_C_SEQUENCE_SPEC \
|
||||
- "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
|
||||
+ "--start-group %G %L --end-group"
|
||||
|
||||
/* Use --as-needed -lgcc_s for eh support. */
|
||||
#ifdef HAVE_LD_AS_NEEDED
|
@ -1,10 +0,0 @@
|
||||
--- gcc-6.3.0-orig/gcc/ubsan.c
|
||||
+++ gcc-6.3.0/gcc/ubsan.c
|
||||
@@ -1471,7 +1471,7 @@
|
||||
|
||||
expanded_location xloc = expand_location (loc);
|
||||
if (xloc.file == NULL || strncmp (xloc.file, "\1", 2) == 0
|
||||
- || xloc.file == '\0' || xloc.file[0] == '\xff'
|
||||
+ || xloc.file == NULL || xloc.file[0] == '\xff'
|
||||
|| xloc.file[1] == '\xff')
|
||||
return false;
|
@ -1,52 +0,0 @@
|
||||
https://gcc.gnu.org/ml/gcc-patches/2015-06/msg02210.html
|
||||
|
||||
diff --git a/libcpp/macro.c b/libcpp/macro.c
|
||||
index 1e0a0b5..a52e3cb 100644
|
||||
--- a/libcpp/macro.c
|
||||
+++ b/libcpp/macro.c
|
||||
@@ -349,14 +349,38 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node)
|
||||
slow on some systems. */
|
||||
time_t tt;
|
||||
struct tm *tb = NULL;
|
||||
+ char *source_date_epoch;
|
||||
|
||||
- /* (time_t) -1 is a legitimate value for "number of seconds
|
||||
- since the Epoch", so we have to do a little dance to
|
||||
- distinguish that from a genuine error. */
|
||||
- errno = 0;
|
||||
- tt = time(NULL);
|
||||
- if (tt != (time_t)-1 || errno == 0)
|
||||
- tb = localtime (&tt);
|
||||
+ /* Allow the date and time to be set externally by an exported
|
||||
+ environment variable to enable reproducible builds. */
|
||||
+ source_date_epoch = getenv ("SOURCE_DATE_EPOCH");
|
||||
+ if (source_date_epoch)
|
||||
+ {
|
||||
+ errno = 0;
|
||||
+ tt = (time_t) strtol (source_date_epoch, NULL, 10);
|
||||
+ if (errno == 0)
|
||||
+ {
|
||||
+ tb = gmtime (&tt);
|
||||
+ if (tb == NULL)
|
||||
+ cpp_error (pfile, CPP_DL_ERROR,
|
||||
+ "SOURCE_DATE_EPOCH=\"%s\" is not a valid date",
|
||||
+ source_date_epoch);
|
||||
+ }
|
||||
+ else
|
||||
+ cpp_error (pfile, CPP_DL_ERROR,
|
||||
+ "SOURCE_DATE_EPOCH=\"%s\" is not a valid number",
|
||||
+ source_date_epoch);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* (time_t) -1 is a legitimate value for "number of seconds
|
||||
+ since the Epoch", so we have to do a little dance to
|
||||
+ distinguish that from a genuine error. */
|
||||
+ errno = 0;
|
||||
+ tt = time(NULL);
|
||||
+ if (tt != (time_t)-1 || errno == 0)
|
||||
+ tb = localtime (&tt);
|
||||
+ }
|
||||
|
||||
if (tb)
|
||||
{
|
@ -1,13 +0,0 @@
|
||||
source $setup
|
||||
shopt -u nullglob
|
||||
|
||||
tar -xf $src
|
||||
mv linux-$version linux
|
||||
|
||||
mkdir -p obj/staged
|
||||
make -C linux headers_install \
|
||||
ARCH=$linux_arch \
|
||||
O=$(pwd)/obj \
|
||||
INSTALL_HDR_PATH=$out
|
||||
|
||||
find $out '(' -name .install -o -name ..install.cmd ')' -exec rm {} +
|
@ -1,45 +0,0 @@
|
||||
source $setup
|
||||
|
||||
tar -xf $gcc_src
|
||||
mv gcc-* gcc
|
||||
|
||||
tar -xf $musl_src
|
||||
mv musl-* musl
|
||||
|
||||
tar -xf $linux_src
|
||||
mv linux-* linux
|
||||
|
||||
license_gcc=$(cat gcc/COPYING3.LIB)
|
||||
license_musl=$(cat musl/COPYRIGHT)
|
||||
license_linux=$(cat linux/COPYING)
|
||||
|
||||
cat > $out <<EOF
|
||||
<p>
|
||||
The third-party software included with this software may
|
||||
have been patched or otherwise modified.
|
||||
</p>
|
||||
|
||||
<h2>GCC run-time libraries</h2>
|
||||
|
||||
<p>
|
||||
The GCC run-time libraries libgcc and libstdc++ are licensed under the GNU
|
||||
General Public License Version 3 (GPLv3) as shown below.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$license_gcc
|
||||
</pre>
|
||||
|
||||
<h2>musl libc</h2>
|
||||
|
||||
<pre>
|
||||
$license_musl
|
||||
</pre>
|
||||
|
||||
<h2>Linux headers</h2>
|
||||
|
||||
<pre>
|
||||
$license_linux
|
||||
</pre>
|
||||
|
||||
EOF
|
1
nix/nixcrpkgs/macos/.gitignore
vendored
1
nix/nixcrpkgs/macos/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/MacOSX.sdk.tar.xz
|
@ -1,46 +0,0 @@
|
||||
source $setup
|
||||
|
||||
tar -xf $src
|
||||
mv cctools-port-* cctools-port
|
||||
|
||||
cd cctools-port
|
||||
|
||||
for patch in $patches; do
|
||||
echo applying patch $patch
|
||||
patch -p1 -i $patch
|
||||
done
|
||||
|
||||
# Similar to but not the same as the other _structs.h.
|
||||
rm cctools/include/foreign/mach/i386/_structs.h
|
||||
|
||||
# Causes a troublesome undefined reference.
|
||||
rm cctools/libstuff/vm_flush_cache.c
|
||||
|
||||
cd ..
|
||||
|
||||
mv cctools-port/cctools/ar .
|
||||
mv cctools-port/cctools/include .
|
||||
mv cctools-port/cctools/libstuff .
|
||||
rm -r cctools-port
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
CFLAGS="-Wno-deprecated -Wno-deprecated-declarations -Wno-unused-result -Werror -Wfatal-errors -O2 -g -I../include -I../include/foreign -DPROGRAM_PREFIX=\\\"$host-\\\" -D__LITTLE_ENDIAN__ -D__private_extern__= -D__DARWIN_UNIX03 -DPACKAGE_NAME=\\\"cctools\\\" -DPACKAGE_VERSION=\\\"$apple_version\\\" -DEMULATED_HOST_CPU_TYPE=16777223 -DEMULATED_HOST_CPU_SUBTYPE=3"
|
||||
|
||||
CXXFLAGS="-std=gnu++11 $CFLAGS"
|
||||
|
||||
LDFLAGS="-ldl -lpthread"
|
||||
|
||||
for f in ../ar/*.c ../libstuff/*.c; do
|
||||
echo "compiling $f"
|
||||
eval "gcc -c $CFLAGS $f -o $(basename $f).o"
|
||||
done
|
||||
|
||||
gcc *.o $LDFLAGS -o $host-ar
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp $host-ar $out/bin/
|
||||
|
||||
# ar looks for ranlib in this directory
|
||||
ln -s $ranlib/bin/$host-ranlib $out/bin/
|
@ -1,11 +0,0 @@
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/bytesex.h cctools-port-bytesex/cctools/include/stuff/bytesex.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/bytesex.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-bytesex/cctools/include/stuff/bytesex.h 2017-11-10 19:07:26.338161875 -0800
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <mach/m88k/thread_status.h>
|
||||
#include <mach/i860/thread_status.h>
|
||||
#include <mach/i386/thread_status.h>
|
||||
+#include <mach/i386/_structs.h>
|
||||
#include <mach/hppa/thread_status.h>
|
||||
#include <mach/sparc/thread_status.h>
|
||||
/* cctools-port: need to undef these to avoid warnings */
|
File diff suppressed because it is too large
Load Diff
@ -1,299 +0,0 @@
|
||||
diff -ur cctools-port-c1cc758/cctools/ld64/src/ld/parsers/libunwind/Registers.hpp cctools-port-patched/cctools/ld64/src/ld/parsers/libunwind/Registers.hpp
|
||||
--- cctools-port-c1cc758/cctools/ld64/src/ld/parsers/libunwind/Registers.hpp 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-patched/cctools/ld64/src/ld/parsers/libunwind/Registers.hpp 2017-10-29 10:12:23.150301208 -0700
|
||||
@@ -72,22 +72,22 @@
|
||||
const char* getRegisterName(int num);
|
||||
void jumpto();
|
||||
|
||||
- uint32_t getSP() const { return fRegisters.__esp; }
|
||||
- void setSP(uint32_t value) { fRegisters.__esp = value; }
|
||||
- uint32_t getIP() const { return fRegisters.__eip; }
|
||||
- void setIP(uint32_t value) { fRegisters.__eip = value; }
|
||||
- uint32_t getEBP() const { return fRegisters.__ebp; }
|
||||
- void setEBP(uint32_t value) { fRegisters.__ebp = value; }
|
||||
- uint32_t getEBX() const { return fRegisters.__ebx; }
|
||||
- void setEBX(uint32_t value) { fRegisters.__ebx = value; }
|
||||
- uint32_t getECX() const { return fRegisters.__ecx; }
|
||||
- void setECX(uint32_t value) { fRegisters.__ecx = value; }
|
||||
- uint32_t getEDX() const { return fRegisters.__edx; }
|
||||
- void setEDX(uint32_t value) { fRegisters.__edx = value; }
|
||||
- uint32_t getESI() const { return fRegisters.__esi; }
|
||||
- void setESI(uint32_t value) { fRegisters.__esi = value; }
|
||||
- uint32_t getEDI() const { return fRegisters.__edi; }
|
||||
- void setEDI(uint32_t value) { fRegisters.__edi = value; }
|
||||
+ uint32_t getSP() const { return fRegisters.esp; }
|
||||
+ void setSP(uint32_t value) { fRegisters.esp = value; }
|
||||
+ uint32_t getIP() const { return fRegisters.eip; }
|
||||
+ void setIP(uint32_t value) { fRegisters.eip = value; }
|
||||
+ uint32_t getEBP() const { return fRegisters.ebp; }
|
||||
+ void setEBP(uint32_t value) { fRegisters.ebp = value; }
|
||||
+ uint32_t getEBX() const { return fRegisters.ebx; }
|
||||
+ void setEBX(uint32_t value) { fRegisters.ebx = value; }
|
||||
+ uint32_t getECX() const { return fRegisters.ecx; }
|
||||
+ void setECX(uint32_t value) { fRegisters.ecx = value; }
|
||||
+ uint32_t getEDX() const { return fRegisters.edx; }
|
||||
+ void setEDX(uint32_t value) { fRegisters.edx = value; }
|
||||
+ uint32_t getESI() const { return fRegisters.esi; }
|
||||
+ void setESI(uint32_t value) { fRegisters.esi = value; }
|
||||
+ uint32_t getEDI() const { return fRegisters.edi; }
|
||||
+ void setEDI(uint32_t value) { fRegisters.edi = value; }
|
||||
|
||||
private:
|
||||
i386_thread_state_t fRegisters;
|
||||
@@ -122,25 +122,25 @@
|
||||
{
|
||||
switch ( regNum ) {
|
||||
case UNW_REG_IP:
|
||||
- return fRegisters.__eip;
|
||||
+ return fRegisters.eip;
|
||||
case UNW_REG_SP:
|
||||
- return fRegisters.__esp;
|
||||
+ return fRegisters.esp;
|
||||
case UNW_X86_EAX:
|
||||
- return fRegisters.__eax;
|
||||
+ return fRegisters.eax;
|
||||
case UNW_X86_ECX:
|
||||
- return fRegisters.__ecx;
|
||||
+ return fRegisters.ecx;
|
||||
case UNW_X86_EDX:
|
||||
- return fRegisters.__edx;
|
||||
+ return fRegisters.edx;
|
||||
case UNW_X86_EBX:
|
||||
- return fRegisters.__ebx;
|
||||
+ return fRegisters.ebx;
|
||||
case UNW_X86_EBP:
|
||||
- return fRegisters.__ebp;
|
||||
+ return fRegisters.ebp;
|
||||
case UNW_X86_ESP:
|
||||
- return fRegisters.__esp;
|
||||
+ return fRegisters.esp;
|
||||
case UNW_X86_ESI:
|
||||
- return fRegisters.__esi;
|
||||
+ return fRegisters.esi;
|
||||
case UNW_X86_EDI:
|
||||
- return fRegisters.__edi;
|
||||
+ return fRegisters.edi;
|
||||
}
|
||||
ABORT("unsupported x86 register");
|
||||
}
|
||||
@@ -149,34 +149,34 @@
|
||||
{
|
||||
switch ( regNum ) {
|
||||
case UNW_REG_IP:
|
||||
- fRegisters.__eip = value;
|
||||
+ fRegisters.eip = value;
|
||||
return;
|
||||
case UNW_REG_SP:
|
||||
- fRegisters.__esp = value;
|
||||
+ fRegisters.esp = value;
|
||||
return;
|
||||
case UNW_X86_EAX:
|
||||
- fRegisters.__eax = value;
|
||||
+ fRegisters.eax = value;
|
||||
return;
|
||||
case UNW_X86_ECX:
|
||||
- fRegisters.__ecx = value;
|
||||
+ fRegisters.ecx = value;
|
||||
return;
|
||||
case UNW_X86_EDX:
|
||||
- fRegisters.__edx = value;
|
||||
+ fRegisters.edx = value;
|
||||
return;
|
||||
case UNW_X86_EBX:
|
||||
- fRegisters.__ebx = value;
|
||||
+ fRegisters.ebx = value;
|
||||
return;
|
||||
case UNW_X86_EBP:
|
||||
- fRegisters.__ebp = value;
|
||||
+ fRegisters.ebp = value;
|
||||
return;
|
||||
case UNW_X86_ESP:
|
||||
- fRegisters.__esp = value;
|
||||
+ fRegisters.esp = value;
|
||||
return;
|
||||
case UNW_X86_ESI:
|
||||
- fRegisters.__esi = value;
|
||||
+ fRegisters.esi = value;
|
||||
return;
|
||||
case UNW_X86_EDI:
|
||||
- fRegisters.__edi = value;
|
||||
+ fRegisters.edi = value;
|
||||
return;
|
||||
}
|
||||
ABORT("unsupported x86 register");
|
||||
@@ -253,22 +253,22 @@
|
||||
void setVectorRegister(int num, v128 value);
|
||||
const char* getRegisterName(int num);
|
||||
void jumpto();
|
||||
- uint64_t getSP() const { return fRegisters.__rsp; }
|
||||
- void setSP(uint64_t value) { fRegisters.__rsp = value; }
|
||||
- uint64_t getIP() const { return fRegisters.__rip; }
|
||||
- void setIP(uint64_t value) { fRegisters.__rip = value; }
|
||||
- uint64_t getRBP() const { return fRegisters.__rbp; }
|
||||
- void setRBP(uint64_t value) { fRegisters.__rbp = value; }
|
||||
- uint64_t getRBX() const { return fRegisters.__rbx; }
|
||||
- void setRBX(uint64_t value) { fRegisters.__rbx = value; }
|
||||
- uint64_t getR12() const { return fRegisters.__r12; }
|
||||
- void setR12(uint64_t value) { fRegisters.__r12 = value; }
|
||||
- uint64_t getR13() const { return fRegisters.__r13; }
|
||||
- void setR13(uint64_t value) { fRegisters.__r13 = value; }
|
||||
- uint64_t getR14() const { return fRegisters.__r14; }
|
||||
- void setR14(uint64_t value) { fRegisters.__r14 = value; }
|
||||
- uint64_t getR15() const { return fRegisters.__r15; }
|
||||
- void setR15(uint64_t value) { fRegisters.__r15 = value; }
|
||||
+ uint64_t getSP() const { return fRegisters.rsp; }
|
||||
+ void setSP(uint64_t value) { fRegisters.rsp = value; }
|
||||
+ uint64_t getIP() const { return fRegisters.rip; }
|
||||
+ void setIP(uint64_t value) { fRegisters.rip = value; }
|
||||
+ uint64_t getRBP() const { return fRegisters.rbp; }
|
||||
+ void setRBP(uint64_t value) { fRegisters.rbp = value; }
|
||||
+ uint64_t getRBX() const { return fRegisters.rbx; }
|
||||
+ void setRBX(uint64_t value) { fRegisters.rbx = value; }
|
||||
+ uint64_t getR12() const { return fRegisters.r12; }
|
||||
+ void setR12(uint64_t value) { fRegisters.r12 = value; }
|
||||
+ uint64_t getR13() const { return fRegisters.r13; }
|
||||
+ void setR13(uint64_t value) { fRegisters.r13 = value; }
|
||||
+ uint64_t getR14() const { return fRegisters.r14; }
|
||||
+ void setR14(uint64_t value) { fRegisters.r14 = value; }
|
||||
+ uint64_t getR15() const { return fRegisters.r15; }
|
||||
+ void setR15(uint64_t value) { fRegisters.r15 = value; }
|
||||
private:
|
||||
x86_thread_state64_t fRegisters;
|
||||
};
|
||||
@@ -302,41 +302,41 @@
|
||||
{
|
||||
switch ( regNum ) {
|
||||
case UNW_REG_IP:
|
||||
- return fRegisters.__rip;
|
||||
+ return fRegisters.rip;
|
||||
case UNW_REG_SP:
|
||||
- return fRegisters.__rsp;
|
||||
+ return fRegisters.rsp;
|
||||
case UNW_X86_64_RAX:
|
||||
- return fRegisters.__rax;
|
||||
+ return fRegisters.rax;
|
||||
case UNW_X86_64_RDX:
|
||||
- return fRegisters.__rdx;
|
||||
+ return fRegisters.rdx;
|
||||
case UNW_X86_64_RCX:
|
||||
- return fRegisters.__rcx;
|
||||
+ return fRegisters.rcx;
|
||||
case UNW_X86_64_RBX:
|
||||
- return fRegisters.__rbx;
|
||||
+ return fRegisters.rbx;
|
||||
case UNW_X86_64_RSI:
|
||||
- return fRegisters.__rsi;
|
||||
+ return fRegisters.rsi;
|
||||
case UNW_X86_64_RDI:
|
||||
- return fRegisters.__rdi;
|
||||
+ return fRegisters.rdi;
|
||||
case UNW_X86_64_RBP:
|
||||
- return fRegisters.__rbp;
|
||||
+ return fRegisters.rbp;
|
||||
case UNW_X86_64_RSP:
|
||||
- return fRegisters.__rsp;
|
||||
+ return fRegisters.rsp;
|
||||
case UNW_X86_64_R8:
|
||||
- return fRegisters.__r8;
|
||||
+ return fRegisters.r8;
|
||||
case UNW_X86_64_R9:
|
||||
- return fRegisters.__r9;
|
||||
+ return fRegisters.r9;
|
||||
case UNW_X86_64_R10:
|
||||
- return fRegisters.__r10;
|
||||
+ return fRegisters.r10;
|
||||
case UNW_X86_64_R11:
|
||||
- return fRegisters.__r11;
|
||||
+ return fRegisters.r11;
|
||||
case UNW_X86_64_R12:
|
||||
- return fRegisters.__r12;
|
||||
+ return fRegisters.r12;
|
||||
case UNW_X86_64_R13:
|
||||
- return fRegisters.__r13;
|
||||
+ return fRegisters.r13;
|
||||
case UNW_X86_64_R14:
|
||||
- return fRegisters.__r14;
|
||||
+ return fRegisters.r14;
|
||||
case UNW_X86_64_R15:
|
||||
- return fRegisters.__r15;
|
||||
+ return fRegisters.r15;
|
||||
}
|
||||
ABORT("unsupported x86_64 register");
|
||||
}
|
||||
@@ -345,58 +345,58 @@
|
||||
{
|
||||
switch ( regNum ) {
|
||||
case UNW_REG_IP:
|
||||
- fRegisters.__rip = value;
|
||||
+ fRegisters.rip = value;
|
||||
return;
|
||||
case UNW_REG_SP:
|
||||
- fRegisters.__rsp = value;
|
||||
+ fRegisters.rsp = value;
|
||||
return;
|
||||
case UNW_X86_64_RAX:
|
||||
- fRegisters.__rax = value;
|
||||
+ fRegisters.rax = value;
|
||||
return;
|
||||
case UNW_X86_64_RDX:
|
||||
- fRegisters.__rdx = value;
|
||||
+ fRegisters.rdx = value;
|
||||
return;
|
||||
case UNW_X86_64_RCX:
|
||||
- fRegisters.__rcx = value;
|
||||
+ fRegisters.rcx = value;
|
||||
return;
|
||||
case UNW_X86_64_RBX:
|
||||
- fRegisters.__rbx = value;
|
||||
+ fRegisters.rbx = value;
|
||||
return;
|
||||
case UNW_X86_64_RSI:
|
||||
- fRegisters.__rsi = value;
|
||||
+ fRegisters.rsi = value;
|
||||
return;
|
||||
case UNW_X86_64_RDI:
|
||||
- fRegisters.__rdi = value;
|
||||
+ fRegisters.rdi = value;
|
||||
return;
|
||||
case UNW_X86_64_RBP:
|
||||
- fRegisters.__rbp = value;
|
||||
+ fRegisters.rbp = value;
|
||||
return;
|
||||
case UNW_X86_64_RSP:
|
||||
- fRegisters.__rsp = value;
|
||||
+ fRegisters.rsp = value;
|
||||
return;
|
||||
case UNW_X86_64_R8:
|
||||
- fRegisters.__r8 = value;
|
||||
+ fRegisters.r8 = value;
|
||||
return;
|
||||
case UNW_X86_64_R9:
|
||||
- fRegisters.__r9 = value;
|
||||
+ fRegisters.r9 = value;
|
||||
return;
|
||||
case UNW_X86_64_R10:
|
||||
- fRegisters.__r10 = value;
|
||||
+ fRegisters.r10 = value;
|
||||
return;
|
||||
case UNW_X86_64_R11:
|
||||
- fRegisters.__r11 = value;
|
||||
+ fRegisters.r11 = value;
|
||||
return;
|
||||
case UNW_X86_64_R12:
|
||||
- fRegisters.__r12 = value;
|
||||
+ fRegisters.r12 = value;
|
||||
return;
|
||||
case UNW_X86_64_R13:
|
||||
- fRegisters.__r13 = value;
|
||||
+ fRegisters.r13 = value;
|
||||
return;
|
||||
case UNW_X86_64_R14:
|
||||
- fRegisters.__r14 = value;
|
||||
+ fRegisters.r14 = value;
|
||||
return;
|
||||
case UNW_X86_64_R15:
|
||||
- fRegisters.__r15 = value;
|
||||
+ fRegisters.r15 = value;
|
||||
return;
|
||||
}
|
||||
ABORT("unsupported x86_64 register");
|
@ -1,93 +0,0 @@
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/errors.h cctools-port-libstuff-no-error/cctools/include/stuff/errors.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/errors.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-libstuff-no-error/cctools/include/stuff/errors.h 2017-11-10 21:52:54.172522281 -0800
|
||||
@@ -40,7 +40,7 @@
|
||||
__attribute__ ((format (printf, 1, 2)))
|
||||
#endif
|
||||
__attribute__((visibility("hidden")));
|
||||
-extern void error(
|
||||
+extern void errorf(
|
||||
const char *format, ...)
|
||||
#ifdef __GNUC__
|
||||
__attribute__ ((format (printf, 1, 2)))
|
||||
diff -ur cctools-port-c1cc758/cctools/libstuff/errors.c cctools-port-libstuff-no-error/cctools/libstuff/errors.c
|
||||
--- cctools-port-c1cc758/cctools/libstuff/errors.c 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-libstuff-no-error/cctools/libstuff/errors.c 2017-11-10 21:52:42.795730237 -0800
|
||||
@@ -57,7 +57,7 @@
|
||||
*/
|
||||
__private_extern__
|
||||
void
|
||||
-error(
|
||||
+errorf(
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
diff -ur cctools-port-c1cc758/cctools/libstuff/ofile.c cctools-port-libstuff-no-error/cctools/libstuff/ofile.c
|
||||
--- cctools-port-c1cc758/cctools/libstuff/ofile.c 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-libstuff-no-error/cctools/libstuff/ofile.c 2017-11-10 21:54:20.156803208 -0800
|
||||
@@ -115,6 +115,8 @@
|
||||
};
|
||||
#endif /* !defined(OTOOL) */
|
||||
|
||||
+#define error errorf
|
||||
+
|
||||
static enum bool ofile_specific_arch(
|
||||
struct ofile *ofile,
|
||||
uint32_t narch);
|
||||
diff -ur cctools-port-c1cc758/cctools/libstuff/swap_headers.c cctools-port-libstuff-no-error/cctools/libstuff/swap_headers.c
|
||||
--- cctools-port-c1cc758/cctools/libstuff/swap_headers.c 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-libstuff-no-error/cctools/libstuff/swap_headers.c 2017-11-10 21:54:49.873797374 -0800
|
||||
@@ -50,6 +50,8 @@
|
||||
#include "stuff/bytesex.h"
|
||||
#include "stuff/errors.h"
|
||||
|
||||
+#define error errorf
|
||||
+
|
||||
/*
|
||||
* swap_object_headers() swaps the object file headers from the host byte sex
|
||||
* into the non-host byte sex. It returns TRUE if it can and did swap the
|
||||
diff -ur cctools-port-c1cc758/cctools/libstuff/SymLoc.c cctools-port-libstuff-no-error/cctools/libstuff/SymLoc.c
|
||||
--- cctools-port-c1cc758/cctools/libstuff/SymLoc.c 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-libstuff-no-error/cctools/libstuff/SymLoc.c 2017-11-10 21:53:06.199321490 -0800
|
||||
@@ -118,7 +118,7 @@
|
||||
if(fclose(file) != 0)
|
||||
system_error("fclose() failed");
|
||||
if (!*viewPath) {
|
||||
- error("symLocForDylib(): Can't locate view path for release %s",
|
||||
+ errorf("symLocForDylib(): Can't locate view path for release %s",
|
||||
releaseName);
|
||||
return NULL;
|
||||
}
|
||||
@@ -252,7 +252,7 @@
|
||||
// process return value
|
||||
if (!c) {
|
||||
if(no_error_if_missing == FALSE)
|
||||
- error("Can't find project that builds %s", installName);
|
||||
+ errorf("Can't find project that builds %s", installName);
|
||||
return NULL;
|
||||
} else {
|
||||
*found_project = TRUE;
|
||||
diff -ur cctools-port-c1cc758/cctools/libstuff/version_number.c cctools-port-libstuff-no-error/cctools/libstuff/version_number.c
|
||||
--- cctools-port-c1cc758/cctools/libstuff/version_number.c 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-libstuff-no-error/cctools/libstuff/version_number.c 2017-11-10 21:55:18.674114769 -0800
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "stuff/allocate.h"
|
||||
#include "stuff/errors.h"
|
||||
|
||||
+#define error errorf
|
||||
+
|
||||
/*
|
||||
* get_version_number() converts an ascii version number string of the form:
|
||||
* X[.Y[.Z]]
|
||||
diff -ur cctools-port-c1cc758/cctools/libstuff/writeout.c cctools-port-libstuff-no-error/cctools/libstuff/writeout.c
|
||||
--- cctools-port-c1cc758/cctools/libstuff/writeout.c 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-libstuff-no-error/cctools/libstuff/writeout.c 2017-11-10 21:55:43.537722114 -0800
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "stuff/lto.h"
|
||||
#endif /* LTO_SUPPORT */
|
||||
|
||||
+#define error errorf
|
||||
+
|
||||
static void copy_new_symbol_info(
|
||||
char *p,
|
||||
uint32_t *size,
|
@ -1,271 +0,0 @@
|
||||
diff -ur cctools-port-c1cc758/cctools/include/foreign/extern.h cctools-port-private-extern/cctools/include/foreign/extern.h
|
||||
--- cctools-port-c1cc758/cctools/include/foreign/extern.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/foreign/extern.h 2017-11-10 18:32:37.035890924 -0800
|
||||
@@ -1 +1,2 @@
|
||||
+#pragma once
|
||||
#define __private_extern__ __attribute__((visibility("hidden")))
|
||||
diff -ur cctools-port-c1cc758/cctools/include/mach-o/dyld.h cctools-port-private-extern/cctools/include/mach-o/dyld.h
|
||||
--- cctools-port-c1cc758/cctools/include/mach-o/dyld.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/mach-o/dyld.h 2017-11-10 18:32:37.035890924 -0800
|
||||
@@ -27,9 +27,7 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+#include <extern.h>
|
||||
|
||||
#include <mach-o/loader.h>
|
||||
#include <AvailabilityMacros.h>
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/allocate.h cctools-port-private-extern/cctools/include/stuff/allocate.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/allocate.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/allocate.h 2017-11-10 18:33:52.006780029 -0800
|
||||
@@ -20,9 +20,8 @@
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+
|
||||
+#include <extern.h>
|
||||
|
||||
/* defined in allocate.c */
|
||||
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/arch.h cctools-port-private-extern/cctools/include/stuff/arch.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/arch.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/arch.h 2017-11-10 18:34:36.487305108 -0800
|
||||
@@ -23,9 +23,8 @@
|
||||
#ifndef _STUFF_ARCH_H_
|
||||
#define _STUFF_ARCH_H_
|
||||
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+#include <extern.h>
|
||||
+
|
||||
/*
|
||||
* This file contains the current known set of flags and constants for the
|
||||
* known architectures.
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/best_arch.h cctools-port-private-extern/cctools/include/stuff/best_arch.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/best_arch.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/best_arch.h 2017-11-10 18:34:48.764116432 -0800
|
||||
@@ -20,9 +20,8 @@
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+
|
||||
+#include <extern.h>
|
||||
|
||||
#include <mach/machine.h>
|
||||
#include <stuff/bool.h>
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/breakout.h cctools-port-private-extern/cctools/include/stuff/breakout.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/breakout.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/breakout.h 2017-11-10 18:35:04.334299743 -0800
|
||||
@@ -20,9 +20,8 @@
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+
|
||||
+#include <extern.h>
|
||||
|
||||
#import "stuff/ofile.h"
|
||||
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/bytesex.h cctools-port-private-extern/cctools/include/stuff/bytesex.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/bytesex.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/bytesex.h 2017-11-10 18:35:12.637730768 -0800
|
||||
@@ -29,9 +29,7 @@
|
||||
#ifndef _STUFF_BYTESEX_H_
|
||||
#define _STUFF_BYTESEX_H_
|
||||
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+#include <extern.h>
|
||||
|
||||
#include <mach-o/fat.h>
|
||||
#include <mach-o/loader.h>
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/execute.h cctools-port-private-extern/cctools/include/stuff/execute.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/execute.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/execute.h 2017-11-10 18:35:34.417986815 -0800
|
||||
@@ -20,9 +20,8 @@
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+
|
||||
+#include <extern.h>
|
||||
|
||||
/*
|
||||
* execute() does an execvp using the argv passed to it. If the parameter
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/guess_short_name.h cctools-port-private-extern/cctools/include/stuff/guess_short_name.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/guess_short_name.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/guess_short_name.h 2017-11-10 18:40:11.801171715 -0800
|
||||
@@ -22,6 +22,8 @@
|
||||
*/
|
||||
#include "stuff/bool.h"
|
||||
|
||||
+#include <extern.h>
|
||||
+
|
||||
__private_extern__ char * guess_short_name(
|
||||
char *name,
|
||||
enum bool *is_framework,
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/hash_string.h cctools-port-private-extern/cctools/include/stuff/hash_string.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/hash_string.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/hash_string.h 2017-11-10 18:35:43.698095826 -0800
|
||||
@@ -20,9 +20,8 @@
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+
|
||||
+#include <extern.h>
|
||||
|
||||
__private_extern__ int32_t hash_string(
|
||||
char *key);
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/hppa.h cctools-port-private-extern/cctools/include/stuff/hppa.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/hppa.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/hppa.h 2017-11-10 18:36:01.414970472 -0800
|
||||
@@ -20,9 +20,8 @@
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+
|
||||
+#include <extern.h>
|
||||
|
||||
__private_extern__ void calc_hppa_HILO(
|
||||
uint32_t base,
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/lto.h cctools-port-private-extern/cctools/include/stuff/lto.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/lto.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/lto.h 2017-11-10 18:40:27.811342692 -0800
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "stuff/arch.h"
|
||||
|
||||
+#include <extern.h>
|
||||
+
|
||||
#ifdef LTO_SUPPORT
|
||||
|
||||
__private_extern__ int is_llvm_bitcode_from_memory(
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/macosx_deployment_target.h cctools-port-private-extern/cctools/include/stuff/macosx_deployment_target.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/macosx_deployment_target.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/macosx_deployment_target.h 2017-11-10 18:39:47.814249693 -0800
|
||||
@@ -22,6 +22,8 @@
|
||||
*/
|
||||
#include <mach/mach.h>
|
||||
|
||||
+#include <extern.h>
|
||||
+
|
||||
struct macosx_deployment_target {
|
||||
uint32_t major; /* major version */
|
||||
uint32_t minor; /* minor version (if any or zero) */
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/ofile.h cctools-port-private-extern/cctools/include/stuff/ofile.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/ofile.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/ofile.h 2017-11-10 18:36:14.268454589 -0800
|
||||
@@ -24,9 +24,7 @@
|
||||
#ifndef _STUFF_OFILE_H_
|
||||
#define _STUFF_OFILE_H_
|
||||
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+#include <extern.h>
|
||||
|
||||
#import <ar.h>
|
||||
#ifndef AR_EFMT1
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/print.h cctools-port-private-extern/cctools/include/stuff/print.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/print.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/print.h 2017-11-10 18:36:24.805244801 -0800
|
||||
@@ -20,9 +20,8 @@
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+
|
||||
+#include <extern.h>
|
||||
|
||||
#import <stdarg.h>
|
||||
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/reloc.h cctools-port-private-extern/cctools/include/stuff/reloc.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/reloc.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/reloc.h 2017-11-10 18:36:31.878661041 -0800
|
||||
@@ -20,9 +20,8 @@
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+
|
||||
+#include <extern.h>
|
||||
|
||||
#import <mach/machine.h>
|
||||
#import "stuff/bool.h"
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/rnd.h cctools-port-private-extern/cctools/include/stuff/rnd.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/rnd.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/rnd.h 2017-11-10 18:36:39.068745293 -0800
|
||||
@@ -27,9 +27,7 @@
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+#include <extern.h>
|
||||
|
||||
/*
|
||||
* rnd() rounds v to a multiple of r.
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/symbol_list.h cctools-port-private-extern/cctools/include/stuff/symbol_list.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/symbol_list.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/symbol_list.h 2017-11-10 18:37:11.605792928 -0800
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <mach-o/nlist.h>
|
||||
#include <stuff/bool.h>
|
||||
|
||||
+#include <extern.h>
|
||||
+
|
||||
/*
|
||||
* Data structures to perform selective stripping of symbol table entries.
|
||||
*/
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/unix_standard_mode.h cctools-port-private-extern/cctools/include/stuff/unix_standard_mode.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/unix_standard_mode.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/unix_standard_mode.h 2017-11-10 18:37:42.596155389 -0800
|
||||
@@ -22,5 +22,7 @@
|
||||
*/
|
||||
#include "stuff/bool.h"
|
||||
|
||||
+#include <extern.h>
|
||||
+
|
||||
__private_extern__ enum bool get_unix_standard_mode(
|
||||
void);
|
||||
diff -ur cctools-port-c1cc758/cctools/include/stuff/vm_flush_cache.h cctools-port-private-extern/cctools/include/stuff/vm_flush_cache.h
|
||||
--- cctools-port-c1cc758/cctools/include/stuff/vm_flush_cache.h 2017-10-01 13:47:04.000000000 -0700
|
||||
+++ cctools-port-private-extern/cctools/include/stuff/vm_flush_cache.h 2017-11-10 18:37:59.973025145 -0800
|
||||
@@ -20,9 +20,8 @@
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
-#if defined(__MWERKS__) && !defined(__private_extern__)
|
||||
-#define __private_extern__ __declspec(private_extern)
|
||||
-#endif
|
||||
+
|
||||
+#include <extern.h>
|
||||
|
||||
#import <mach/mach.h>
|
||||
__private_extern__ kern_return_t vm_flush_cache(
|
@ -1,30 +0,0 @@
|
||||
source $setup
|
||||
|
||||
tar -xf $llvm_src
|
||||
mv llvm-* llvm
|
||||
|
||||
tar -xf $lld_src
|
||||
mv lld-* lld
|
||||
mv lld llvm/tools/
|
||||
|
||||
tar -xf $src
|
||||
mv cfe-* clang
|
||||
cd clang
|
||||
for patch in $patches; do
|
||||
echo applying patch $patch
|
||||
patch -p1 -i $patch
|
||||
done
|
||||
cd ..
|
||||
mv clang llvm/projects/
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
cmake ../llvm -GNinja -DDEFAULT_SYSROOT=$out -DCMAKE_INSTALL_PREFIX=$out $cmake_flags
|
||||
|
||||
ninja
|
||||
|
||||
ninja install
|
||||
|
||||
# clang-tblgen is supposed to be an internal tool, but tapi needs it
|
||||
cp bin/clang-tblgen $out/bin
|
@ -1,37 +0,0 @@
|
||||
diff -ur cfe-5.0.0.src.orig/lib/Driver/ToolChains/Gnu.cpp cfe-5.0.0.src/lib/Driver/ToolChains/Gnu.cpp
|
||||
--- cfe-5.0.0.src.orig/lib/Driver/ToolChains/Gnu.cpp 2017-09-13 07:15:52.419093088 -0700
|
||||
+++ cfe-5.0.0.src/lib/Driver/ToolChains/Gnu.cpp 2017-09-13 07:21:58.892639000 -0700
|
||||
@@ -493,10 +493,6 @@
|
||||
CmdArgs.push_back("-export-dynamic");
|
||||
|
||||
if (!Args.hasArg(options::OPT_shared)) {
|
||||
- const std::string Loader =
|
||||
- D.DyldPrefix + ToolChain.getDynamicLinker(Args);
|
||||
- CmdArgs.push_back("-dynamic-linker");
|
||||
- CmdArgs.push_back(Args.MakeArgString(Loader));
|
||||
}
|
||||
}
|
||||
|
||||
diff -ur cfe-5.0.0.src.orig/lib/Driver/ToolChains/Linux.cpp cfe-5.0.0.src/lib/Driver/ToolChains/Linux.cpp
|
||||
--- cfe-5.0.0.src.orig/lib/Driver/ToolChains/Linux.cpp 2017-09-13 07:15:52.419093088 -0700
|
||||
+++ cfe-5.0.0.src/lib/Driver/ToolChains/Linux.cpp 2017-09-13 07:17:58.530311694 -0700
|
||||
@@ -195,18 +195,7 @@
|
||||
llvm::Triple::ArchType Arch = Triple.getArch();
|
||||
std::string SysRoot = computeSysRoot();
|
||||
|
||||
- // Cross-compiling binutils and GCC installations (vanilla and openSUSE at
|
||||
- // least) put various tools in a triple-prefixed directory off of the parent
|
||||
- // of the GCC installation. We use the GCC triple here to ensure that we end
|
||||
- // up with tools that support the same amount of cross compiling as the
|
||||
- // detected GCC installation. For example, if we find a GCC installation
|
||||
- // targeting x86_64, but it is a bi-arch GCC installation, it can also be
|
||||
- // used to target i386.
|
||||
- // FIXME: This seems unlikely to be Linux-specific.
|
||||
- ToolChain::path_list &PPaths = getProgramPaths();
|
||||
- PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" +
|
||||
- GCCInstallation.getTriple().str() + "/bin")
|
||||
- .str());
|
||||
+ // Removed some code here that found programs like ld in "/..//bin"
|
||||
|
||||
Distro Distro(D.getVFS());
|
||||
|
@ -1,192 +0,0 @@
|
||||
# Note: To reduce clutter here, it might be nice to move clang to
|
||||
# `native`, and also make `native` provide a function for building
|
||||
# binutils. So clang and binutils recipes could be shared by the
|
||||
# different platforms we targets.
|
||||
|
||||
{ osx_sdk, native }:
|
||||
let
|
||||
nixpkgs = native.nixpkgs;
|
||||
|
||||
arch = "x86_64";
|
||||
|
||||
# was darwin15, changed to darwin so that lld guesses flavor=Darwin correctly
|
||||
darwin_name = "darwin15";
|
||||
|
||||
macos_version_min = "10.11";
|
||||
|
||||
host = "${arch}-apple-${darwin_name}";
|
||||
|
||||
os = "macos";
|
||||
|
||||
compiler = "clang";
|
||||
|
||||
exe_suffix = "";
|
||||
|
||||
clang = native.make_derivation rec {
|
||||
name = "clang";
|
||||
|
||||
version = "5.0.0";
|
||||
|
||||
src = nixpkgs.fetchurl {
|
||||
url = "https://llvm.org/releases/${version}/cfe-${version}.src.tar.xz";
|
||||
sha256 = "0w09s8fn3lkn6i04nj0cisgp821r815fk5b5fjn97xrd371277q1";
|
||||
};
|
||||
|
||||
llvm_src = nixpkgs.fetchurl {
|
||||
url = "https://llvm.org/releases/${version}/llvm-${version}.src.tar.xz";
|
||||
sha256 = "1nin64vz21hyng6jr19knxipvggaqlkl2l9jpd5czbc4c2pcnpg3";
|
||||
};
|
||||
|
||||
# Note: We aren't actually using lld for anything yet.
|
||||
lld_src = nixpkgs.fetchurl {
|
||||
url = "http://releases.llvm.org/${version}/lld-${version}.src.tar.xz";
|
||||
sha256 = "15rqsmfw0jlsri7hszbs8l0j7v1030cy9xvvdb245397llh7k6ir";
|
||||
};
|
||||
|
||||
patches = [ ./clang_megapatch.patch ];
|
||||
|
||||
builder = ./clang_builder.sh;
|
||||
|
||||
native_inputs = [ nixpkgs.python2 ];
|
||||
|
||||
cmake_flags =
|
||||
"-DCMAKE_BUILD_TYPE=Release " +
|
||||
# "-DCMAKE_BUILD_TYPE=Debug " +
|
||||
"-DLLVM_TARGETS_TO_BUILD=X86\;ARM " +
|
||||
"-DLLVM_ENABLE_RTTI=ON " + # ld64 uses dynamic_cast, requiring rtti
|
||||
"-DLLVM_ENABLE_ASSERTIONS=OFF";
|
||||
};
|
||||
|
||||
# Note: There is an alternative version we could use, but it
|
||||
# has a copy of LLVM in it: https://github.com/tpoechtrager/apple-libtapi
|
||||
tapi = native.make_derivation rec {
|
||||
name = "tapi";
|
||||
version = "${version0}.${version1}.${version2}";
|
||||
version0 = "2";
|
||||
version1 = "0";
|
||||
version2 = "0";
|
||||
src = nixpkgs.fetchurl {
|
||||
url = "https://github.com/DavidEGrayson/tapi/archive/f98d0c3.tar.gz";
|
||||
sha256 = "0jibz0fsyh47q8y3w6f0qspjh6fhs164rkhjg7x6k7qhlawcdy6g";
|
||||
};
|
||||
builder = ./tapi_builder.sh;
|
||||
native_inputs = [ clang ];
|
||||
inherit clang;
|
||||
};
|
||||
|
||||
cctools_commit = "c1cc758";
|
||||
cctools_apple_version = "274.2"; # from README.md
|
||||
cctools_port_src = nixpkgs.fetchurl {
|
||||
url = "https://github.com/tpoechtrager/cctools-port/archive/${cctools_commit}.tar.gz";
|
||||
sha256= "11bfcndzbdmjp2piabyqs34da617fh5fhirqvb9w87anfan15ffa";
|
||||
};
|
||||
|
||||
ld = native.make_derivation rec {
|
||||
name = "cctools-ld64";
|
||||
apple_version = cctools_apple_version;
|
||||
src = cctools_port_src;
|
||||
patches = [
|
||||
./cctools-format.patch
|
||||
./cctools-ld64-registers.patch
|
||||
];
|
||||
builder = ./ld_builder.sh;
|
||||
native_inputs = [ tapi ];
|
||||
inherit host;
|
||||
};
|
||||
|
||||
ranlib = native.make_derivation rec {
|
||||
name = "cctools-ranlib";
|
||||
apple_version = cctools_apple_version;
|
||||
src = ld.src;
|
||||
builder = ./ranlib_builder.sh;
|
||||
patches = [
|
||||
./cctools-format.patch
|
||||
./cctools-bytesex.patch
|
||||
];
|
||||
inherit host;
|
||||
};
|
||||
|
||||
ar = native.make_derivation rec {
|
||||
name = "cctools-ar";
|
||||
apple_version = cctools_apple_version;
|
||||
src = cctools_port_src;
|
||||
builder = ./ar_builder.sh;
|
||||
patches = [
|
||||
./cctools-format.patch
|
||||
./cctools-libstuff-no-error.patch
|
||||
];
|
||||
inherit host ranlib;
|
||||
};
|
||||
|
||||
strip = native.make_derivation rec {
|
||||
name = "cctools-strip";
|
||||
apple_version = cctools_apple_version;
|
||||
src = cctools_port_src;
|
||||
builder = ./strip_builder.sh;
|
||||
patches = [
|
||||
./cctools-format.patch
|
||||
];
|
||||
inherit host;
|
||||
};
|
||||
|
||||
# TODO: add instructions for building the SDK tarball, probably want a copy of
|
||||
# the script from osxcross.
|
||||
sdk = native.make_derivation rec {
|
||||
name = "macos-sdk";
|
||||
builder = ./sdk_builder.sh;
|
||||
src = osx_sdk;
|
||||
};
|
||||
|
||||
toolchain = native.make_derivation rec {
|
||||
name = "macos-toolchain";
|
||||
builder = ./toolchain_builder.sh;
|
||||
src_file = ./wrapper.cpp;
|
||||
inherit host clang ld ranlib ar strip sdk;
|
||||
|
||||
CXXFLAGS =
|
||||
"-std=c++11 " +
|
||||
"-Wall " +
|
||||
"-I. " +
|
||||
"-O2 -g " +
|
||||
"-DWRAPPER_OS_VERSION_MIN=\\\"${macos_version_min}\\\" " +
|
||||
"-DWRAPPER_HOST=\\\"${host}\\\" " +
|
||||
"-DWRAPPER_ARCH=\\\"${arch}\\\" " +
|
||||
"-DWRAPPER_SDK_PATH=\\\"${sdk}\\\" " +
|
||||
"-DWRAPPER_LINKER_VERSION=\\\"${ld.apple_version}\\\"";
|
||||
};
|
||||
|
||||
cmake_toolchain = import ../cmake_toolchain {
|
||||
cmake_system_name = "Darwin";
|
||||
inherit nixpkgs host;
|
||||
};
|
||||
|
||||
crossenv = {
|
||||
is_cross = true;
|
||||
|
||||
# Build tools available on the PATH for every derivation.
|
||||
default_native_inputs = native.default_native_inputs
|
||||
++ [ clang toolchain native.wrappers ];
|
||||
|
||||
# Target info environment variables.
|
||||
inherit host arch os compiler exe_suffix macos_version_min;
|
||||
|
||||
# CMake toolchain file.
|
||||
inherit cmake_toolchain;
|
||||
|
||||
# A wide variety of programs and build tools.
|
||||
inherit nixpkgs;
|
||||
|
||||
# Some native build tools made by nixcrpkgs.
|
||||
inherit native;
|
||||
|
||||
# License information that should be shipped with any software
|
||||
# compiled by this environment.
|
||||
global_license_set = { };
|
||||
|
||||
# Make it easy to build or refer to the build tools.
|
||||
inherit clang tapi ld ranlib ar sdk toolchain strip;
|
||||
|
||||
make_derivation = import ../make_derivation.nix crossenv;
|
||||
};
|
||||
in
|
||||
crossenv
|
@ -1,164 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Package the OS X SDKs into a tar file to be used by `build.sh`.
|
||||
#
|
||||
|
||||
# This file comes from the osxcross project and is licensed under the GNU GPLv2.
|
||||
# For more information, see the `COPYING` file from:
|
||||
# https://github.com/tpoechtrager/osxcross/tree/1a1733a773fe26e7b6c93b16fbf9341f22fac831
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
function set_xcode_dir()
|
||||
{
|
||||
local tmp=$(ls $1 2>/dev/null | grep "^Xcode.*.app" | grep -v "beta" | head -n1)
|
||||
|
||||
if [ -z "$tmp" ]; then
|
||||
tmp=$(ls $1 2>/dev/null | grep "^Xcode.*.app" | head -n1)
|
||||
fi
|
||||
|
||||
if [ -n "$tmp" ]; then
|
||||
XCODEDIR="$1/$tmp"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $(uname -s) != "Darwin" ]; then
|
||||
if [ -z "$XCODEDIR" ]; then
|
||||
echo "This script must be run on OS X" 1>&2
|
||||
echo "... Or with XCODEDIR=... on Linux" 1>&2
|
||||
exit 1
|
||||
else
|
||||
case $XCODEDIR in
|
||||
/*) ;;
|
||||
*) XCODEDIR="$PWD/$XCODEDIR" ;;
|
||||
esac
|
||||
set_xcode_dir $XCODEDIR
|
||||
fi
|
||||
else
|
||||
set_xcode_dir $(echo /Volumes/Xcode* | tr ' ' '\n' | grep -v "beta" | head -n1)
|
||||
|
||||
if [ -z "$XCODEDIR" ]; then
|
||||
set_xcode_dir /Applications
|
||||
|
||||
if [ -z "$XCODEDIR" ]; then
|
||||
set_xcode_dir $(echo /Volumes/Xcode* | tr ' ' '\n' | head -n1)
|
||||
|
||||
if [ -z "$XCODEDIR" ]; then
|
||||
echo "please mount Xcode.dmg" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d $XCODEDIR ]; then
|
||||
echo "cannot find Xcode (XCODEDIR=$XCODEDIR)" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "found Xcode: $XCODEDIR"
|
||||
|
||||
WDIR=$(pwd)
|
||||
|
||||
which gnutar &>/dev/null
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
TAR=gnutar
|
||||
else
|
||||
TAR=tar
|
||||
fi
|
||||
|
||||
which xz &>/dev/null
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
COMPRESSOR=xz
|
||||
PKGEXT="tar.xz"
|
||||
else
|
||||
COMPRESSOR=bzip2
|
||||
PKGEXT="tar.bz2"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
pushd $XCODEDIR &>/dev/null
|
||||
|
||||
if [ -d "Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" ]; then
|
||||
pushd "Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" &>/dev/null
|
||||
else
|
||||
if [ -d "../Packages" ]; then
|
||||
pushd "../Packages" &>/dev/null
|
||||
elif [ -d "Packages" ]; then
|
||||
pushd "Packages" &>/dev/null
|
||||
else
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Xcode (or this script) is out of date" 1>&2
|
||||
echo "trying some magic to find the SDKs anyway ..." 1>&2
|
||||
|
||||
SDKDIR=$(find . -name SDKs -type d | grep MacOSX | head -n1)
|
||||
|
||||
if [ -z "$SDKDIR" ]; then
|
||||
echo "cannot find SDKs!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd $SDKDIR &>/dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
SDKS=$(ls | grep "^MacOSX10.*" | grep -v "Patch")
|
||||
|
||||
if [ -z "$SDKS" ]; then
|
||||
echo "No SDK found" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Xcode 5
|
||||
LIBCXXDIR1="Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1"
|
||||
|
||||
# Xcode 6
|
||||
LIBCXXDIR2="Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"
|
||||
|
||||
# Manual directory
|
||||
MANDIR="Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man"
|
||||
|
||||
for SDK in $SDKS; do
|
||||
echo -n "packaging $(echo "$SDK" | sed -E "s/(.sdk|.pkg)//g") SDK "
|
||||
echo "(this may take several minutes) ..."
|
||||
|
||||
if [[ $SDK == *.pkg ]]; then
|
||||
cp $SDK $WDIR
|
||||
continue
|
||||
fi
|
||||
|
||||
TMP=$(mktemp -d /tmp/XXXXXXXXXXX)
|
||||
cp -r $SDK $TMP &>/dev/null || true
|
||||
|
||||
pushd $XCODEDIR &>/dev/null
|
||||
|
||||
# libc++ headers for C++11/C++14
|
||||
if [ -d $LIBCXXDIR1 ]; then
|
||||
cp -rf $LIBCXXDIR1 "$TMP/$SDK/usr/include/c++"
|
||||
elif [ -d $LIBCXXDIR2 ]; then
|
||||
cp -rf $LIBCXXDIR2 "$TMP/$SDK/usr/include/c++"
|
||||
fi
|
||||
|
||||
if [ -d $MANDIR ]; then
|
||||
mkdir -p $TMP/$SDK/usr/share/man
|
||||
cp -rf $MANDIR/* $TMP/$SDK/usr/share/man
|
||||
fi
|
||||
|
||||
popd &>/dev/null
|
||||
|
||||
pushd $TMP &>/dev/null
|
||||
$TAR -cf - * | $COMPRESSOR -9 -c - > "$WDIR/$SDK.$PKGEXT"
|
||||
popd &>/dev/null
|
||||
|
||||
rm -rf $TMP
|
||||
done
|
||||
|
||||
popd &>/dev/null
|
||||
popd &>/dev/null
|
||||
|
||||
echo ""
|
||||
ls -lh | grep MacOSX
|
@ -1,45 +0,0 @@
|
||||
source $setup
|
||||
|
||||
tar -xf $src
|
||||
mv cctools-port-* cctools-port
|
||||
|
||||
cd cctools-port
|
||||
|
||||
for patch in $patches; do
|
||||
echo applying patch $patch
|
||||
patch -p1 -i $patch
|
||||
done
|
||||
|
||||
# Similar to but not the same as the other _structs.h.
|
||||
rm cctools/include/foreign/mach/i386/_structs.h
|
||||
|
||||
cd ..
|
||||
|
||||
mv cctools-port/cctools/ld64 ld64
|
||||
mv cctools-port/cctools/include include
|
||||
rm -r cctools-port
|
||||
rm -r ld64/src/other
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
CFLAGS="-Wno-deprecated -Wno-deprecated-declarations -Wno-unused-result -Werror -Wfatal-errors -O2 -g -I../ld64/src -I../ld64/src/ld -I../ld64/src/ld/parsers -I../ld64/src/abstraction -I../ld64/src/3rd -I../ld64/src/3rd/include -I../ld64/src/3rd/BlocksRuntime -I../include -I../include/foreign -DTAPI_SUPPORT -DPROGRAM_PREFIX=\\\"$host-\\\" -D__LITTLE_ENDIAN__ -D__private_extern__= $(pkg-config --cflags libtapi)"
|
||||
|
||||
CXXFLAGS="-std=gnu++11 $CFLAGS"
|
||||
|
||||
LDFLAGS="$(pkg-config --libs libtapi) -ldl -lpthread"
|
||||
|
||||
for f in ../ld64/src/ld/*.c ../ld64/src/3rd/*.c; do
|
||||
echo "compiling $f"
|
||||
eval "gcc -c $CFLAGS $f -o $(basename $f).o"
|
||||
done
|
||||
|
||||
for f in $(find ../ld64/src -name \*.cpp); do
|
||||
echo "compiling $f"
|
||||
eval "g++ -c $CXXFLAGS $f -o $(basename $f).o"
|
||||
done
|
||||
|
||||
g++ *.o $LDFLAGS -o $host-ld
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp $host-ld $out/bin
|
@ -1,45 +0,0 @@
|
||||
source $setup
|
||||
|
||||
tar -xf $src
|
||||
mv cctools-port-* cctools-port
|
||||
|
||||
cd cctools-port
|
||||
|
||||
for patch in $patches; do
|
||||
echo applying patch $patch
|
||||
patch -p1 -i $patch
|
||||
done
|
||||
|
||||
# Similar to but not the same as the other _structs.h.
|
||||
rm cctools/include/foreign/mach/i386/_structs.h
|
||||
|
||||
# Causes a troublesome undefined reference.
|
||||
rm cctools/libstuff/vm_flush_cache.c
|
||||
|
||||
cd ..
|
||||
|
||||
mv cctools-port/cctools/misc .
|
||||
mv cctools-port/cctools/include .
|
||||
mv cctools-port/cctools/libstuff .
|
||||
rm -r cctools-port
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
CFLAGS="-Wno-deprecated -Wno-deprecated-declarations -Wno-unused-result -Wno-format-overflow -Werror -Wfatal-errors -O2 -g -I../include -I../include/foreign -DPROGRAM_PREFIX=\\\"$host-\\\" -D__LITTLE_ENDIAN__ -D__private_extern__= -D__DARWIN_UNIX03 -DPACKAGE_NAME=\\\"cctools\\\" -DPACKAGE_VERSION=\\\"$apple_version\\\" -DEMULATED_HOST_CPU_TYPE=16777223 -DEMULATED_HOST_CPU_SUBTYPE=3"
|
||||
|
||||
CXXFLAGS="-std=gnu++11 $CFLAGS"
|
||||
|
||||
LDFLAGS="-ldl"
|
||||
|
||||
for f in ../libstuff/*.c ; do
|
||||
echo "compiling $f"
|
||||
eval "gcc -c $CFLAGS $f -o $(basename $f).o"
|
||||
done
|
||||
|
||||
eval "gcc $CFLAGS ../misc/libtool.c *.o $LDFLAGS -o $host-libtool"
|
||||
eval "gcc $CFLAGS -DRANLIB ../misc/libtool.c *.o $LDFLAGS -o $host-ranlib"
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp $host-libtool $host-ranlib $out/bin/
|
||||
|
@ -1,4 +0,0 @@
|
||||
source $setup
|
||||
|
||||
tar -xf $src
|
||||
mv MacOSX*.sdk $out
|
@ -1,43 +0,0 @@
|
||||
source $setup
|
||||
|
||||
tar -xf $src
|
||||
mv cctools-port-* cctools-port
|
||||
|
||||
cd cctools-port
|
||||
|
||||
for patch in $patches; do
|
||||
echo applying patch $patch
|
||||
patch -p1 -i $patch
|
||||
done
|
||||
|
||||
# Similar to but not the same as the other _structs.h.
|
||||
rm cctools/include/foreign/mach/i386/_structs.h
|
||||
|
||||
# Causes a troublesome undefined reference.
|
||||
rm cctools/libstuff/vm_flush_cache.c
|
||||
|
||||
cd ..
|
||||
|
||||
mv cctools-port/cctools/misc .
|
||||
mv cctools-port/cctools/include .
|
||||
mv cctools-port/cctools/libstuff .
|
||||
rm -r cctools-port
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
CFLAGS="-Wno-deprecated -Wno-deprecated-declarations -Wno-unused-result -Werror -Wfatal-errors -O2 -g -I../include -I../include/foreign -DPROGRAM_PREFIX=\\\"$host-\\\" -D__LITTLE_ENDIAN__ -D__private_extern__= -D__DARWIN_UNIX03 -DPACKAGE_NAME=\\\"cctools\\\" -DPACKAGE_VERSION=\\\"$apple_version\\\" -DEMULATED_HOST_CPU_TYPE=16777223 -DEMULATED_HOST_CPU_SUBTYPE=3"
|
||||
|
||||
CXXFLAGS="-std=gnu++11 $CFLAGS"
|
||||
|
||||
LDFLAGS="-ldl -lpthread"
|
||||
|
||||
for f in ../misc/strip.c ../libstuff/*.c; do
|
||||
echo "compiling $f"
|
||||
eval "gcc -c $CFLAGS $f -o $(basename $f).o"
|
||||
done
|
||||
|
||||
gcc *.o $LDFLAGS -o $host-strip
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp $host-strip $out/bin/
|
@ -1,80 +0,0 @@
|
||||
source $setup
|
||||
|
||||
tar -xf $src
|
||||
mv tapi-* tapi
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
mkdir -p include/tapi/{Core,Driver}
|
||||
cat > include/tapi/Core/ArchitectureConfig.h <<EOF
|
||||
#pragma once
|
||||
#define SUPPORT_ARCH_I386 1
|
||||
#define SUPPORT_ARCH_X86_64 1
|
||||
#define SUPPORT_ARCH_X86_64H 1
|
||||
EOF
|
||||
|
||||
cat > include/tapi/Version.inc <<EOF
|
||||
#pragma once
|
||||
#define TAPI_VERSION $version
|
||||
#define TAPI_VERSION_MAJOR $version0
|
||||
#define TAPI_VERSION_MINOR $version1
|
||||
#define TAPI_VERSION_PATCH $version2
|
||||
EOF
|
||||
|
||||
clang-tblgen -I$clang/include -gen-clang-diags-defs \
|
||||
-o include/tapi/Driver/DiagnosticTAPIKinds.inc \
|
||||
../tapi/include/tapi/Driver/DiagnosticTAPIKinds.td
|
||||
|
||||
llvm-tblgen -I$clang/include -gen-opt-parser-defs \
|
||||
-o include/tapi/Driver/TAPIOptions.inc \
|
||||
../tapi/include/tapi/Driver/TAPIOptions.td
|
||||
|
||||
function build-lib() {
|
||||
libsrc=$1
|
||||
lib=$2
|
||||
mkdir $lib.o
|
||||
for f in $libsrc/*.cpp; do
|
||||
echo "compiling $f"
|
||||
g++ -c $CFLAGS $f -o $lib.o/$(basename $f).o
|
||||
done
|
||||
echo "archiving $lib"
|
||||
ar cr $lib $lib.o/*.o
|
||||
}
|
||||
|
||||
CFLAGS="-std=gnu++11 -O2 -Iinclude -I../tapi/include -I$clang/include"
|
||||
|
||||
build-lib ../tapi/tools/libtapi libtapi.a
|
||||
build-lib ../tapi/lib/Config libtapiConfig.a
|
||||
build-lib ../tapi/lib/Core libtapiCore.a
|
||||
build-lib ../tapi/lib/Driver libtapiDriver.a
|
||||
build-lib ../tapi/lib/Scanner libtapiScanner.a
|
||||
build-lib ../tapi/lib/SDKDB libtapiSDKDB.a
|
||||
|
||||
CLANG_LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangSerialization -lclangParse -lclangSema -lclangAST -lclangAnalysis -lclangEdit -lclangLex -lclangBasic -lLLVMDemangle -lLLVMObject -lLLVMBitReader -lLLVMMC -lLLVMMCParser -lLLVMCore -lLLVMBinaryFormat -lLLVMOption -lLLVMProfileData -lLLVMSupport"
|
||||
|
||||
LDFLAGS="-L$clang/lib -L. -ltapi -ltapiDriver -ltapiCore -ltapiDriver -ltapiScanner -ltapiSDKDB -ltapiConfig $CLANG_LIBS -lpthread"
|
||||
|
||||
echo "building tapi"
|
||||
g++ $CFLAGS ../tapi/tools/tapi/tapi.cpp $LDFLAGS -o tapi
|
||||
|
||||
echo "building tapi-run"
|
||||
g++ $CFLAGS ../tapi/tools/tapi-run/tapi-run.cpp $LDFLAGS -o tapi-run
|
||||
|
||||
mkdir -p $out/lib/pkgconfig $out/bin
|
||||
cp *.a $out/lib
|
||||
cp tapi tapi-run $out/bin
|
||||
|
||||
cp -r ../tapi/include $out/
|
||||
|
||||
cp include/tapi/Version.inc $out/include/tapi/
|
||||
|
||||
cat > $out/lib/pkgconfig/libtapi.pc <<EOF
|
||||
prefix=$out
|
||||
libdir=\${prefix}/lib
|
||||
includedir=\${prefix}/include
|
||||
|
||||
Version: $version
|
||||
Libs: -L\${libdir} -L$clang/lib -ltapi -ltapiCore $CLANG_LIBS -lpthread
|
||||
Cflags: -I\${includedir}
|
||||
EOF
|
@ -1,24 +0,0 @@
|
||||
source $setup
|
||||
|
||||
mkdir -p $out/bin
|
||||
|
||||
cd $out/bin
|
||||
|
||||
CXXFLAGS="$CXXFLAGS -DWRAPPER_PATH=\\\"$out/bin:$ld/bin:$clang/bin\\\""
|
||||
|
||||
eval "g++ $CXXFLAGS $src_file -o $host-wrapper"
|
||||
|
||||
ln -s $clang/bin/llvm-dsymutil dsymutil
|
||||
ln -s $ar/bin/$host-ar
|
||||
ln -s $ranlib/bin/$host-ranlib
|
||||
ln -s $ranlib/bin/$host-libtool
|
||||
ln -s $strip/bin/$host-strip
|
||||
|
||||
ln -s $host-wrapper $host-cc
|
||||
ln -s $host-wrapper $host-c++
|
||||
|
||||
ln -s $host-wrapper $host-clang
|
||||
ln -s $host-wrapper $host-clang++
|
||||
|
||||
ln -s $host-wrapper $host-gcc
|
||||
ln -s $host-wrapper $host-g++
|
@ -1,139 +0,0 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <unistd.h>
|
||||
|
||||
int do_exec(const std::string & compiler_name,
|
||||
const std::vector<std::string> & args)
|
||||
{
|
||||
char ** exec_args = new char *[args.size() + 1];
|
||||
size_t i = 0;
|
||||
for (const std::string & arg : args)
|
||||
{
|
||||
exec_args[i++] = (char *)arg.c_str();
|
||||
}
|
||||
exec_args[i] = nullptr;
|
||||
|
||||
execvp(compiler_name.c_str(), exec_args);
|
||||
|
||||
int result = errno;
|
||||
std::cerr << "execvp failed: " << compiler_name << ": "
|
||||
<< strerror(result) << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int compiler_main(int argc, char ** argv,
|
||||
const std::string & compiler_name)
|
||||
{
|
||||
std::vector<std::string> args;
|
||||
|
||||
args.push_back(compiler_name);
|
||||
|
||||
args.push_back("-target");
|
||||
args.push_back(WRAPPER_HOST);
|
||||
|
||||
args.push_back("-mmacosx-version-min=" WRAPPER_OS_VERSION_MIN);
|
||||
|
||||
// The ld64 linker will just assume sdk_version is the same as
|
||||
// macosx-version-min if we don't supply it. That probably will not
|
||||
// do any harm.
|
||||
// args.push_back("-Wl,-sdk_version," WRAPPER_SDK_VERSION);
|
||||
|
||||
// Suppress warnings about the -Wl arguments not being used when we're just
|
||||
// compiling and not linking.
|
||||
args.push_back("-Wno-unused-command-line-argument");
|
||||
|
||||
args.push_back("--sysroot");
|
||||
args.push_back(WRAPPER_SDK_PATH);
|
||||
|
||||
// Causes clang to pass -demangle, -lto_library, -no_deduplicate, and other
|
||||
// options that could be useful. Version 274.2 is the version number used here:
|
||||
// https://github.com/tpoechtrager/osxcross/blob/474f359/build.sh#L140
|
||||
if (WRAPPER_LINKER_VERSION[0])
|
||||
{
|
||||
args.push_back("-mlinker-version=" WRAPPER_LINKER_VERSION);
|
||||
}
|
||||
|
||||
if (compiler_name == "clang++")
|
||||
{
|
||||
args.push_back("-stdlib=libc++");
|
||||
args.push_back("-cxx-isystem");
|
||||
args.push_back(WRAPPER_SDK_PATH "/usr/include/c++/v1");
|
||||
}
|
||||
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
args.push_back(argv[i]);
|
||||
}
|
||||
|
||||
return do_exec(compiler_name, args);
|
||||
}
|
||||
|
||||
int c_compiler_main(int argc, char ** argv)
|
||||
{
|
||||
return compiler_main(argc, argv, "clang");
|
||||
}
|
||||
|
||||
int cxx_compiler_main(int argc, char ** argv)
|
||||
{
|
||||
return compiler_main(argc, argv, "clang++");
|
||||
}
|
||||
|
||||
int wrapper_main(int argc, char ** argv)
|
||||
{
|
||||
std::cout <<
|
||||
"host: " WRAPPER_HOST "\n"
|
||||
"path: " WRAPPER_PATH "\n"
|
||||
"sdk_path: " WRAPPER_SDK_PATH "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct {
|
||||
const char * name;
|
||||
int (*main_func)(int argc, char ** argv);
|
||||
} prgms[] = {
|
||||
{ WRAPPER_HOST "-gcc", c_compiler_main },
|
||||
{ WRAPPER_HOST "-cc", c_compiler_main },
|
||||
{ WRAPPER_HOST "-clang", c_compiler_main },
|
||||
{ WRAPPER_HOST "-g++", cxx_compiler_main },
|
||||
{ WRAPPER_HOST "-c++", cxx_compiler_main },
|
||||
{ WRAPPER_HOST "-clang++", cxx_compiler_main },
|
||||
{ WRAPPER_HOST "-wrapper", wrapper_main },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
const char * get_program_name(const char * path)
|
||||
{
|
||||
const char * p = strrchr(path, '/');
|
||||
if (p) { path = p + 1; }
|
||||
return path;
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
// We only want this wrapper and the compiler it invokes to access a certain
|
||||
// set of tools that are determined at build time. Ignore whatever is on the
|
||||
// user's path and use the path specified by our Nix expression instead.
|
||||
int result = setenv("PATH", WRAPPER_PATH, 1);
|
||||
if (result)
|
||||
{
|
||||
std::cerr << "wrapper failed to set PATH" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string program_name = get_program_name(argv[0]);
|
||||
|
||||
for (auto * p = prgms; p->name; p++)
|
||||
{
|
||||
if (program_name == p->name)
|
||||
{
|
||||
return p->main_func(argc, argv);
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << "compiler wrapper invoked with unknown program name: "
|
||||
<< argv[0] << std::endl;
|
||||
return 1;
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
env: attrs:
|
||||
|
||||
let
|
||||
nixpkgs = env.nixpkgs;
|
||||
|
||||
native_inputs =
|
||||
(attrs.native_inputs or [])
|
||||
++ env.default_native_inputs;
|
||||
|
||||
cross_inputs = (attrs.cross_inputs or []);
|
||||
|
||||
path_join = builtins.concatStringsSep ":";
|
||||
|
||||
path_map = dir: inputs: (map (i: "${i}" + dir) inputs);
|
||||
|
||||
# We can't just set PATH in our derivation because nix-shell will make the
|
||||
# derivation's PATH override the system PATH, meaning we can't use utilities
|
||||
# like "git" or "which" form the host system. So we set _PATH instead, and we
|
||||
# use a setup script ($setup) that copies _PATH to PATH. And we provide
|
||||
# $stdenv/setup so that nix-shell can find our setup script.
|
||||
#
|
||||
# nixcrpkgs does not expose its users to this mess. The user can specify a
|
||||
# PATH if they want, and it will be automatically moved to _PATH in the
|
||||
# derivation.
|
||||
filtered_attrs = nixpkgs.lib.filterAttrs (n: v: n != "PATH") attrs;
|
||||
|
||||
path_attrs = {
|
||||
_PATH = path_join (
|
||||
(if attrs ? PATH then [attrs.PATH] else []) ++
|
||||
(path_map "/bin" native_inputs)
|
||||
);
|
||||
};
|
||||
|
||||
default_attrs = {
|
||||
system = builtins.currentSystem;
|
||||
|
||||
SHELL = "${nixpkgs.bashInteractive}/bin/bash";
|
||||
|
||||
setup = ./pretend_stdenv/setup;
|
||||
|
||||
# This allows nix-shell to find our setup script.
|
||||
stdenv = ./pretend_stdenv;
|
||||
|
||||
PKG_CONFIG_PATH = path_join (
|
||||
(if attrs ? PKG_CONFIG_PATH then [attrs.PKG_CONFIG_PATH] else []) ++
|
||||
(path_map "/lib/pkgconfig" native_inputs)
|
||||
);
|
||||
};
|
||||
|
||||
cross_attrs = if !env.is_cross then {} else {
|
||||
NIXCRPKGS = true;
|
||||
|
||||
inherit (env) host arch os exe_suffix;
|
||||
inherit (env) cmake_toolchain;
|
||||
|
||||
PKG_CONFIG_CROSS_PATH = path_join (
|
||||
(if attrs ? PKG_CONFIG_CROSS_PATH then [attrs.PKG_CONFIG_CROSS_PATH] else []) ++
|
||||
(path_map "/lib/pkgconfig" cross_inputs)
|
||||
);
|
||||
|
||||
CMAKE_CROSS_PREFIX_PATH = path_join (
|
||||
(if attrs ? CMAKE_CROSS_PREFIX_PATH then [attrs.CMAKE_CROSS_PREFIX_PATH] else []) ++
|
||||
cross_inputs
|
||||
);
|
||||
};
|
||||
|
||||
name_attrs = {
|
||||
name = (attrs.name or "package")
|
||||
+ (if env.is_cross then "-${env.host}" else "");
|
||||
};
|
||||
|
||||
builder_attrs =
|
||||
if builtins.isAttrs attrs.builder then
|
||||
if attrs.builder ? ruby then
|
||||
{
|
||||
builder = "${nixpkgs.ruby}/bin/ruby";
|
||||
args = [attrs.builder.ruby];
|
||||
}
|
||||
else
|
||||
attrs.builder
|
||||
else
|
||||
rec {
|
||||
builder = "${nixpkgs.bashInteractive}/bin/bash";
|
||||
args = ["-ue" attrs.builder];
|
||||
};
|
||||
|
||||
drv_attrs = default_attrs // cross_attrs
|
||||
// filtered_attrs // name_attrs // builder_attrs // path_attrs;
|
||||
|
||||
in
|
||||
derivation drv_attrs
|
@ -1,26 +0,0 @@
|
||||
source $stdenv/setup
|
||||
|
||||
unset CC CXX CFLAGS LDFLAGS LD AR AS RANLIB SIZE STRINGS NM STRIP OBJCOPY
|
||||
|
||||
tar -xf $src
|
||||
|
||||
cd binutils-$version
|
||||
for patch in $patches; do
|
||||
echo applying patch $patch
|
||||
patch -p1 -i $patch
|
||||
done
|
||||
|
||||
# Clear the default library search path (noSysDirs)
|
||||
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
|
||||
|
||||
cd ..
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
../binutils-$version/configure --prefix=$out $configure_flags
|
||||
|
||||
make
|
||||
|
||||
make install
|
||||
|
@ -1,26 +0,0 @@
|
||||
{ native, host }:
|
||||
|
||||
native.make_derivation rec {
|
||||
name = "binutils-${version}-${host}";
|
||||
|
||||
version = "2.27";
|
||||
|
||||
src = native.nixpkgs.fetchurl {
|
||||
url = "mirror://gnu/binutils/binutils-${version}.tar.bz2";
|
||||
sha256 = "125clslv17xh1sab74343fg6v31msavpmaa1c1394zsqa773g5rn";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./deterministic.patch
|
||||
];
|
||||
|
||||
build_inputs = [ native.nixpkgs.bison native.nixpkgs.zlib ];
|
||||
|
||||
configure_flags =
|
||||
"--target=${host} " +
|
||||
"--enable-shared " +
|
||||
"--enable-deterministic-archives " +
|
||||
"--disable-werror ";
|
||||
|
||||
builder = ./builder.sh;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user