Skip to content

Commit

Permalink
clean up share/ outputs and update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinafyi committed Sep 12, 2023
1 parent 7dd1c87 commit ec7491d
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 16 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ the usual \<nixpkgs\> extended with those from this repo.

For users of tools, the main packages are:
- **[aslp][]**: the ASLp partial evaluator with ARM's MRA,
- **[bap-aslp][]**: a version of BAP with an integrated ASLp plugin, and
- **[bap-aslp][]**: a version of official BAP with a bundled ASLp plugin,
- **[bap-uq-pac][]**: PAC's fork of BAP with the [Primus Lisp PR][] but without ASLp, and
- **[basil][]**: the Basil tool for analysis and transpilation to Boogie code.

[aslp]: https://github.com/UQ-PAC/aslp
[bap-aslp]: https://github.com/UQ-PAC/bap-asli-plugin
[bap-uq-pac]: https://github.com/UQ-PAC/bap/tree/aarch64-pull-request-2
[Primus Lisp PR]: https://github.com/BinaryAnalysisPlatform/bap/pull/1546
[basil]: https://github.com/UQ-PAC/bil-to-boogie-translator

These are each defined in a .nix file of the same name,
Expand Down Expand Up @@ -155,13 +158,13 @@ This involves updating the src attribute with the latest commit hash from each G

Most of this is automated by a script:
```bash
export GITHUB_TOKEN=github_pat_11... # not necessary but avoids rate limiting
./update.sh
export GITHUB_TOKEN=github_... # not necessary but avoids rate limiting
./update.sh upgrade --build # or `./update.sh check` to check only
```
This will update the hash in each Nix file with the latest, then attempt to build the new packages.
This will update the hash in each Nix file with the latest then attempt to build the new packages.
If successful, this will commit the changes.

The basil derivation is more unstable since it relies on SBT to fetch its dependencies.
The basil derivation is most fragile since it relies on SBT to fetch its dependencies.
The depsSha256 will need to be changed manually if the script fails at that point.

## miscellany
Expand Down
4 changes: 2 additions & 2 deletions asli.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ ocamlPackages.buildDunePackage rec {

configurePhase = ''
export ASLI_OTT=${pkgs.ott.out + "/share/ott"}
mkdir -p $out/asl
cp -rv prelude.asl mra_tools tests $out/asl
mkdir -p $out/share/asli
cp -rv prelude.asl mra_tools tests $out/share/asli
'';

outputs = [ "out" ];
Expand Down
2 changes: 1 addition & 1 deletion aslp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
installPhase = ''
mkdir -p $out/bin
ASL_PATH=${asli}/asl
ASL_PATH=${asli}/share/asli
cd ${asli}/bin
makeBinaryWrapper "$(pwd)/asli" $out/bin/aslp \
--append-flags --prelude \
Expand Down
4 changes: 2 additions & 2 deletions bap-asli-plugin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ stdenv.mkDerivation rec {
runHook preBuild
bapbuild -package asli.libASL asli.plugin
mkdir -p $out
cp asli.plugin $out/asli.plugin
mkdir -p $out/share/bap-asli-plugin
cp asli.plugin $out/share/bap-asli-plugin/asli.plugin
runHook postBuild
'';
Expand Down
2 changes: 1 addition & 1 deletion bap-aslp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
installPhase = ''
mkdir -p $out/bin
ASLI_PATH=${asli}/asl
ASLI_PATH=${asli}/share/asli
cd ${_bap}/bin
for b in *; do
makeBinaryWrapper "$(pwd)/$b" $out/bin/$b-aslp \
Expand Down
6 changes: 3 additions & 3 deletions basil.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ mkSbtDerivation rec {

installPhase = ''
mkdir -p $out/bin
mkdir -p $out/share/target
mkdir -p $out/share/basil
JAR=target/scala-3.1.0/wptool-boogie*.jar
# copy jar to output directory
cp -r $JAR $out/share/$(basename $JAR)
cp -r $JAR $out/share/basil/$(basename $JAR)
# make wrapper to run jar with appropriate arguments
makeBinaryWrapper "${jre}/bin/java" $out/bin/basil \
--add-flags -jar \
--add-flags "$out/share/$(basename $JAR)"
--add-flags "$out/share/basil/$(basename $JAR)"
'';

meta = {
Expand Down
7 changes: 5 additions & 2 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ case "$1" in
;;
*)
echo "$0: missing required argument" >&2
echo "Usage: $0 [ check | upgrade ]" >&2
echo "Usage: $0 [ check | upgrade ] [ NIX-UPDATE OPTION ]... " >&2
exit 1
;;
esac

shift
ARGS=("$@")

do-upgrade() {
[[ $MODE == upgrade ]]
}
Expand Down Expand Up @@ -61,7 +64,7 @@ update-github() {
latest=$(curl "$COMMITS_API" | jq -r .sha)

if do-upgrade; then
nix-update -f "$PKGS" $attr --version branch=$branch --commit --build
nix-update -f "$PKGS" $attr --version branch=$branch --commit "${ARGS[@]}"
else
current=$(nix-instantiate --eval -E "(import ./$PKGS {}).$attr.src.rev" | jq -r)
COMPARE="https://api.github.com/repos/$repo/compare/$current...$branch"
Expand Down

0 comments on commit ec7491d

Please sign in to comment.