Skip to content
Snippets Groups Projects
Commit 4b6af89c authored by Ralf Jung's avatar Ralf Jung
Browse files

no more opam.pins

parent 01d4aff9
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -12,3 +12,4 @@ ...@@ -12,3 +12,4 @@
Makefile.coq* Makefile.coq*
*.crashcoqide *.crashcoqide
html/ html/
build-dep/
# Process flags
ifeq ($(Y), 1)
YFLAG=-y
endif
# Forward most targets to Coq makefile (with some trick to make this phony) # Forward most targets to Coq makefile (with some trick to make this phony)
%: Makefile.coq phony %: Makefile.coq phony
+@make -f Makefile.coq $@ +@make -f Makefile.coq $@
...@@ -15,18 +10,27 @@ clean: Makefile.coq ...@@ -15,18 +10,27 @@ clean: Makefile.coq
find theories \( -name "*.v.d" -o -name "*.vo" -o -name "*.aux" -o -name "*.cache" -o -name "*.glob" -o -name "*.vio" \) -print -delete find theories \( -name "*.v.d" -o -name "*.vo" -o -name "*.aux" -o -name "*.cache" -o -name "*.glob" -o -name "*.vio" \) -print -delete
rm -f Makefile.coq rm -f Makefile.coq
# Create Coq Makefile. POSIX awk can't do in-place editing, but coq_makefile wants the real filename, so we do some file gymnastics. # Create Coq Makefile. POSIX awk can't do in-place editing, but coq_makefile wants the real
# filename, so we do some file gymnastics.
Makefile.coq: _CoqProject Makefile awk.Makefile Makefile.coq: _CoqProject Makefile awk.Makefile
coq_makefile -f _CoqProject -o Makefile.coq coq_makefile -f _CoqProject -o Makefile.coq
mv Makefile.coq Makefile.coq.tmp && awk -f awk.Makefile Makefile.coq.tmp > Makefile.coq && rm Makefile.coq.tmp mv Makefile.coq Makefile.coq.tmp && awk -f awk.Makefile Makefile.coq.tmp > Makefile.coq && rm Makefile.coq.tmp
# Install build-dependencies # Install build-dependencies
build-dep: build-dep: phony
build/opam-pins.sh < opam.pins @# We want opam to not just instal the build-deps now, but to also keep satisfying these
opam upgrade $(YFLAG) # it is not nice that we upgrade *all* packages here, but I found no nice way to upgrade only those that we pinned @# constraints. Otherwise, `opam upgrade` may well update some packages to versions
opam pin add opam-builddep-temp "$$(pwd)#HEAD" -k git -n -y @# that are incompatible with our build requirements.
opam install opam-builddep-temp --deps-only $(YFLAG) @# To achieve this, we create a fake opam package that has our build-dependencies as
opam pin remove opam-builddep-temp @# dependencies, but does not actually install anything.
mkdir -p build-dep
# Create the build-dep package, add the pin and (re)install it.
@sed <opam 's/^\(build\|install\|remove\):.*/\1: []/; s/^name: *"\(.*\)" */name: "\1-builddep"/' > build-dep/opam
@fgrep builddep build-dep/opam >/dev/null || (echo "sed failed to fix the package name" && exit 1) # sanity check
@# Reinstallation is needed in case the pin already exists, but the builddep package changed.
@BUILD_DEP_PACKAGE="$$(egrep "^name:" build-dep/opam | sed 's/^name: *"\(.*\)" */\1/')"; \
opam pin add "$$BUILD_DEP_PACKAGE" "$$(pwd)/build-dep" -k path $(OPAMFLAGS) && \
opam reinstall "$$BUILD_DEP_PACKAGE"
# Some files that do *not* need to be forwarded to Makefile.coq # Some files that do *not* need to be forwarded to Makefile.coq
Makefile: ; Makefile: ;
......
#!/bin/bash
set -e
## Process an opam.pins file from stdin: Add all the given pins, but don't install anything.
## Usage:
## ./opam-pins.sh < opam.pins
if ! which curl >/dev/null; then
echo "opam-pins needs curl. Please install curl and try again."
exit 1
fi
# Process stdin
while read PACKAGE URL HASH; do
if echo "$URL" | egrep '^https://gitlab\.mpi-sws\.org' > /dev/null; then
echo "[opam-pins] Recursing into $URL"
# an MPI URL -- try doing recursive pin processing
curl -f "$URL/raw/$HASH/opam.pins" 2>/dev/null | "$0"
fi
if opam pin list | fgrep "$PACKAGE.dev.$HASH " > /dev/null; then
echo "[opam-pins] $PACKAGE already at commit $HASH"
else
echo "[opam-pins] Applying pin: $PACKAGE -> $URL#$HASH"
opam pin add "$PACKAGE.dev.$HASH" "$URL#$HASH" -k git -y -n
echo
fi
done
...@@ -7,9 +7,7 @@ authors: "Robbert Krebbers, Jacques-Henri Jourdan, Ralf Jung" ...@@ -7,9 +7,7 @@ authors: "Robbert Krebbers, Jacques-Henri Jourdan, Ralf Jung"
bug-reports: "https://gitlab.mpi-sws.org/robbertkrebbers/coq-stdpp/issues" bug-reports: "https://gitlab.mpi-sws.org/robbertkrebbers/coq-stdpp/issues"
license: "BSD" license: "BSD"
dev-repo: "https://gitlab.mpi-sws.org/robbertkrebbers/coq-stdpp.git" dev-repo: "https://gitlab.mpi-sws.org/robbertkrebbers/coq-stdpp.git"
build: [ build: [make "-j%{jobs}%"]
[make "-j%{jobs}%"]
]
install: [make "install"] install: [make "install"]
remove: [ "sh" "-c" "rm -rf '%{lib}%/coq/user-contrib/stdpp'" ] remove: [ "sh" "-c" "rm -rf '%{lib}%/coq/user-contrib/stdpp'" ]
depends: [ depends: [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment