diff --git a/.gitignore b/.gitignore index 72d6e157..f4b67e2a 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,6 @@ Makefile.config /src/glob_lexer.ml /ocamlbuild.byte /ocamlbuild.native + +# generated from META.in +META diff --git a/Changes b/Changes index 358fbfc8..75b7a73f 100644 --- a/Changes +++ b/Changes @@ -34,6 +34,8 @@ OCamlbuild 0.9.0 is an experimental release designed to help testing OCaml software in preparation for the 4.03 release -- the first one to not include ocamlbuild. +- #44: When ocamlbuild discover a cycle in the dependencies, the + displayed problematic path is now refined to the actual cycle (François Bobot) - MPR#6794, MPR#6809: pass package-specific include flags when building C files (Jérémie Dimino, request by whitequark) - OGPR#208: add "asm" tag to ocamlbuild to enable flag -S diff --git a/META b/META.in similarity index 77% rename from META rename to META.in index 13073b03..6e0e9f06 100644 --- a/META +++ b/META.in @@ -1,6 +1,7 @@ +#%% see META rule in Makefile # Specification for the "ocamlbuild" library requires = "unix" -version = "0.9.0" +version = "%%VERSION%%" description = "ocamlbuild support library" archive(byte) = "ocamlbuildlib.cma" archive(native) = "ocamlbuildlib.cmxa" diff --git a/Makefile b/Makefile index 57335803..cfea3cc1 100644 --- a/Makefile +++ b/Makefile @@ -173,15 +173,28 @@ beforedepend:: src/glob_lexer.ml # The config file -configure: Makefile.config src/ocamlbuild_config.ml - -Makefile.config src/ocamlbuild_config.ml: +# we mark only the 'configure' rule PHONY, +# not individual CONF_FILES, as all OCamlbuild +# sources depend on ocamlbuild_config.ml, +# so it would rebuild from scratch each time. +# +# The reason for marking PHONY is to let the user +# explicitly re-configure; the --version answer +# depends on the state of the git repository, so +# it may change at any time. +.PHONY: configure + +CONF_FILES=Makefile.config src/ocamlbuild_config.ml +configure: + $(MAKE) -f configure.make $(CONF_FILES) + +$(CONF_FILES): $(MAKE) -f configure.make $@ clean:: - rm -f Makefile.config src/ocamlbuild_config.ml + rm -f $(CONF_FILES) -beforedepend:: src/ocamlbuild_config.ml +beforedepend:: Makefile.config # Installation @@ -229,14 +242,22 @@ endif echo ']' >> ocamlbuild.install echo >> ocamlbuild.install -install-lib-basics: +install-lib-basics: META mkdir -p $(INSTALL_LIBDIR)/ocamlbuild $(CP) META src/signatures.mli $(INSTALL_LIBDIR)/ocamlbuild -install-lib-basics-opam: +install-lib-basics-opam: META echo ' "META"' >> ocamlbuild.install echo ' "src/signatures.mli" {"signatures.mli"}' >> ocamlbuild.install +# %%FOO%% are configuration variables (only %%VERSION%% currently), +# and #%% comments are removed before installation +META: META.in VERSION + @cat META.in \ + | sed s/%%VERSION%%/$$(cat VERSION)/ META.in \ + | grep -v "#%%.*" \ + > META + install-lib-byte: mkdir -p $(INSTALL_LIBDIR)/ocamlbuild $(CP) $(INSTALL_LIB) $(INSTALL_LIBDIR)/ocamlbuild @@ -261,7 +282,7 @@ else install-lib: install-lib-basics install-lib-byte endif -install-lib-findlib: +install-lib-findlib: META ifeq ($(OCAML_NATIVE), true) ocamlfind install ocamlbuild \ META src/signatures.mli $(INSTALL_LIB) $(INSTALL_LIB_OPT) @@ -339,6 +360,40 @@ ifeq ($(CHECK_IF_PREINSTALLED), true) fi endif +check-release: + @echo "This Makefile rule checks that:" + @echo "- the VERSION and 'git describe' values are consistent" + @echo "- NEXT_RELEASE does not appear in the sources anymore" + @echo "For any more serious release checking, see howto/release.adoc." + @echo "(We only add output below when a check fails.)" + @echo + @$(MAKE) --silent check-release-VERSION-git-describe + @$(MAKE) --silent check-release-NEXT_RELEASE + +check-release-VERSION-git-describe: +ifeq ($(shell echo $(shell cat VERSION)),\ + $(shell git describe --tags --always --dirty)) + @ +else + @echo "Bad: VERSION ($(shell cat VERSION)) and"\ + "'git describe --tags --always --dirty'"\ + "($(shell git describe --tags --always --dirty))"\ + "disagree." +endif + + +NEXT_RELEASE_EXCLUDE="(Makefile|howto)" +NEXT_RELEASE_FILES=$(shell git grep --files-with-matches "NEXT_RELEASE" \ + | grep -v -E $(NEXT_RELEASE_EXCLUDE)) +check-release-NEXT_RELEASE: +ifeq ($(strip $(NEXT_RELEASE_FILES)),) + @ +else + @echo "The following occurrences of NEXT_RELEASE"\ + "should probably be fixed:" + @git grep "NEXT_RELEASE" -- $(NEXT_RELEASE_FILES) +endif + # The generic rules .SUFFIXES: .ml .mli .cmo .cmi .cmx diff --git a/configure.make b/configure.make index bde5f022..7327952a 100644 --- a/configure.make +++ b/configure.make @@ -45,6 +45,13 @@ OCAMLBUILD_LIBDIR ?= \ # OCAMLBUILD_{PREFIX,BINDIR,LIBDIR}, which are the ones that should # generally be used, as the shorted names {PREFIX,BINDIR,LIBDIR}. +# if run from a git development repository, +# prefer $(git describe --always --dirty) +# to the VERSION file. This trick comes from Daniel Bünzli. +VERSION ?= \ + $(or $(shell git describe --tags --always --dirty 2>/dev/null),\ + $(shell ocaml scripts/cat.ml VERSION)) + ifeq ($(ARCH), none) OCAML_NATIVE ?= false else @@ -76,6 +83,10 @@ Makefile.config: echo "LIBDIR=$(OCAMLBUILD_LIBDIR)"; \ ) > $@ +# the configuration file depends on the git environment, +# so it should be rebuilt each time +.PHONY: src/ocamlbuild_config.ml + src/ocamlbuild_config.ml: (echo "(* This file was generated from ../configure.make *)"; \ echo ;\ @@ -87,5 +98,5 @@ src/ocamlbuild_config.ml: echo 'let so = "$(SO)"'; \ echo 'let ext_dll = "$(EXT_DLL)"'; \ echo 'let exe = "$(EXE)"'; \ - echo 'let version = "$(shell ocaml scripts/cat.ml VERSION)"'; \ + echo 'let version = "$(VERSION)"'; \ ) > $@ diff --git a/howto/release.adoc b/howto/release.adoc index 27ece980..4eae29a6 100644 --- a/howto/release.adoc +++ b/howto/release.adoc @@ -93,21 +93,11 @@ release number, so any occurence of +NEXT_RELEASE+ in the development repository should be replaced by this version number. There is at least one such occurence in the 'Changes' file. -Furthermore, the version coded is hardcoded in some parts of the -codebase and needs to be updated: - -- the 'VERSION' file contains the current version number, with no - ending newline - -- the 'META' file contains the current version number to inform ocamlfind - -You can use +git grep+ to look for all occurrences of +NEXT_RELEASE+ -and a given version number, from the root of the repository: - ----- -git grep NEXT_RELEASE -git grep -F "0.9" ----- +Furthermore, the version number is written in the 'VERSION' file (no +ending newline), and it is used to derive the version number at +installation time -- for example ocamlfind's 'META' file is generated +from the 'META.in' template. This 'VERSION' file should thus be +updated. == Doing the release == @@ -118,18 +108,7 @@ central git repository. Mark the current release day in the Changes file. - -=== Performing the release through github === - -Github's interface allows to create a release tag and publish -a release. From the https://github.com/ocaml/ocamlbuild[github project -page] you can go to the -https://github.com/ocaml/ocamlbuild/releases[release tab] which lists -the current tags and has -a https://github.com/ocaml/ocamlbuild/releases/new[draft a new -release] button. Clicking this button (or the latter link in the -previous sentence) will let you pick a tag name, release title, and -description. +=== Create a git release tag === The tag name should be just the release version number. See +git tag --list+ to see existing tags from a command-line. The release name @@ -137,10 +116,7 @@ should be just +Release +. The description should be the Changes section corresponding to the release (release summary and detailed list of entries). -==== Releasing from the command-line instead ==== - -If you prefer, you can also perform the same steps using the -command-line: +To create the tag, run ---- git tag -a @@ -149,6 +125,29 @@ git tag -a This command should start an editor to ask for a tag message. You can use the <> as the tag message. +As long as you do not <>, you can delete the tag if you find out you made a mistake +and some things still need to be changed before the release. + +---- +git tag --delete +---- + +=== Run +make check-release+ === + +The +check-release+ target automates what little part of the release +checking we could automate. It checks that 'VERSION' and the last git +tag agree, and that no dubious +NEXT_RELEASE+ occurrences persist. + +The script that check for +NEXT_RELEASE+ is somewhat fragile, you may +need to whitelist new files by modifying the 'Makefile' rule. + +[[push-release-tag]] +=== Publish the release upstream === + +You need the commit rights to the upstream repository to run this +command. + ---- git push --tags origin ----