Skip to content

Commit 945a98a

Browse files
authored
Merge pull request #5494 from kit-ty-kate/rm-unused-vendoring-primitives
src_ext: Remove unused/untested Makefile targets
2 parents 5a817d1 + d5142f8 commit 945a98a

14 files changed

+22
-371
lines changed

.github/scripts/main/hygiene.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,9 @@ esac
7777
###
7878

7979
(set +x ; echo -en "::group::check src_ext patches\r") 2>/dev/null
80-
# Check that the lib-ext/lib-pkg patches are "simple"
80+
# Check that the lib-ext patches are "simple"
8181
make -C src_ext PATCH="busybox patch" clone
82-
make -C src_ext PATCH="busybox patch" clone-pkg
83-
# Check that the lib-ext/lib-pkg patches have been re-packaged
82+
# Check that the lib-ext patches have been re-packaged
8483
cd src_ext
8584
../shell/re-patch.sh
8685
if [[ $(find patches -name \*.old | wc -l) -ne 0 ]] ; then

.github/workflows/ci.ml

-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ let cold_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ?
385385
++ cache Archives
386386
++ run "Cold" [
387387
"make compiler";
388-
"make lib-pkg";
389388
"bash -exu .github/scripts/main/main.sh " ^ host]
390389
++ run "Test (basic)" ["bash -exu .github/scripts/main/test.sh"]
391390
++ end_job f

.github/workflows/main.yml

-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ jobs:
390390
- name: Cold
391391
run: |
392392
make compiler
393-
make lib-pkg
394393
bash -exu .github/scripts/main/main.sh x86_64-pc-linux-gnu
395394
- name: Test (basic)
396395
run: bash -exu .github/scripts/main/test.sh

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ tests/reftests/.merlin
1111
.envrc
1212
src_ext/*.*download
1313
src_ext/*.*stamp
14-
src_ext/*.pkgbuild
1514
src_ext/*.tar.gz
1615
src_ext/*.tbz
1716
src_ext/0install-solver/
1817
src_ext/archives/*
1918
src_ext/base64/
20-
src_ext/camlp4
2119
src_ext/cmdliner/
2220
src_ext/cppo/
2321
src_ext/cudf/
@@ -28,7 +26,6 @@ src_ext/extlib/
2826
src_ext/findlib
2927
src_ext/lib
3028
src_ext/mccs/
31-
src_ext/ocamlbuild
3229
src_ext/ocamlgraph/
3330
src_ext/opam-0install-cudf/
3431
src_ext/jsonm/
@@ -42,7 +39,6 @@ src_ext/sha/
4239
src_ext/spdx_licenses/
4340
src_ext/stdlib-shims/
4441
src_ext/swhid_core/
45-
src_ext/topkg/
4642
Opam.Runtime.*/
4743
*.tar.bz2
4844
*.annot

Makefile

-6
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,9 @@ opam-admin.top: $(DUNE_DEP)
8181
lib-ext:
8282
$(MAKE) -j -C src_ext lib-ext
8383

84-
lib-pkg:
85-
$(MAKE) -j -C src_ext lib-pkg
86-
8784
download-ext:
8885
$(MAKE) -C src_ext cache-archives
8986

90-
download-pkg:
91-
$(MAKE) -C src_ext archives-pkg
92-
9387
clean-ext:
9488
$(MAKE) -C src_ext distclean
9589

Makefile.config.in

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ mandir = @mandir@
44
version = @PACKAGE_VERSION@
55
FETCH = @fetch@
66

7-
PACKS = $(filter-out no,@OCAML_PKG_unix@ @OCAML_PKG_extlib@ @OCAML_PKG_re@ @OCAML_PKG_re_glob@ @OCAML_PKG_cmdliner@ @OCAML_PKG_ocamlgraph@ @OCAML_PKG_cudf@ @OCAML_PKG_dose3_common@ @OCAML_PKG_dose3_algo@ @OCAML_PKG_opam_file_format@ @OCAML_PKG_mccs@)
8-
97
CONF_OCAMLFLAGS = @CONF_OCAMLFLAGS@
108

119
MCCS_ENABLED = @MCCS_ENABLED@

README.md

+2-10
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,9 @@ The `OCAML_PORT` variable determines which flavour of Windows OCaml is compiled;
116116
(i.e., the native C compiler *for Cygwin*), `OCAML_PORT` does not need to be
117117
specified and `auto` will be assumed. Once the compiler is built, you may run:
118118
```
119-
make lib-pkg
119+
./configure --with-vendored-deps
120120
```
121-
to install the dependencies as `findlib` packages to the compiler. Building `lib-pkg`
122-
requires the ability to create native symbolic links (and the `CYGWIN` variable
123-
*must* include `winsymlinks:native`). This means that either Cygwin must be run
124-
elevated from an account with administrative privileges, or your user account must be
125-
granted the _SeCreateSymbolicLinkPrivilege_ either by enabling Developer mode on
126-
Windows 10 or using Local Security Policy on earlier versions of Windows.
127-
Alternatively, you may run `configure` and use vendored deps, as advised.
128-
129-
You can then `configure` and build opam as above.
121+
and build opam as above.
130122

131123
## Compiling Without OCaml
132124

master_changes.md

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ users)
9696

9797
## Build
9898
* Upgrade vendored cmdliner to 1.3.0 [#5970 @kit-ty-kate]
99+
* Remove unused/untested Makefile targets lib-pkg [#5494 @kit-ty-kate]
99100

100101
## Infrastructure
101102
* Ensure GNU coreutils available on the macOS 14 CI runners [#5938 @dra27]

shell/re-patch.sh

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ for package in $(cd patches ; find . -maxdepth 1 -mindepth 1 -type d | sed -e 's
1818

1919
# Determine which directories contain patches and which modes to test (lib-pkg/lib-ext)
2020
locs=''
21-
if [[ -d patches/$package.common ]] ; then
22-
locs="../patches/$package.common/*.patch"
23-
modes="stamp pkgstamp"
24-
fi
2521
if [[ -d patches/$package ]] ; then
2622
modes=${modes:-stamp}
2723
libext_locs="../patches/$package/*.patch"

src_ext/HACKING.md

+10-13
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,33 @@ Files related to the dependency vendoring are kept in the `src_ext` directory. T
66
- `shell/bootstrap-ocaml.sh` - assembles an OCaml compiler in `bootstrap/`
77
- `shell/re-patch.sh` - when run from the `src_ext/` directory, normalises all the patch files (eliminating git-specific features, etc.)
88

9-
## lib-ext and lib-pkg
9+
## Mode of operation
1010

11-
There are two modes of operation. `lib-ext` uses Dune vendoring and assembles the dependencies of opam in subdirectories of `src_ext/`, allowing Dune to build them with opam. In this mode, only the `opam` binary can then be installed: the libraries are not installable (as with all Dune vendoring with libraries). `lib-pkg` installs the libraries to a given compiler using either `dune install` (for dependencies which use Dune) or `ocamlfind install` for any others. This mode is typically used to install dependencies to the compiler built in `bootstrap/` by `shell/bootstrap-ocaml.sh`. In `lib-pkg`, the dependency's preferred build system is used, in `lib-ext`, the package must use Dune.
11+
We use Dune vendoring and assembles the dependencies of opam in subdirectories of `src_ext/`, allowing Dune to build them with opam. Only the `opam` binary can then be installed: the libraries are not installable (as with all Dune vendoring with libraries).
1212

1313
## Patching
1414

15-
Package sources have patches applied from two places. For package `foo`, the patches in `src_ext/foo.common` and then patches in `src_ext/foo` (for `lib-ext` mode) or `src_ext/foo.pkg` (for `lib-pkg` mode) are applied (within those directories, patches apply in the order returned by shell globbing). Patches placed here are either to back-port the package to an older version of OCaml than upstream supports, or to back-port a fix from an unreleased version of package.
15+
Package sources have patches applied from two places. For package `foo`, the patches in `src_ext/foo` are applied (within those directories, patches apply in the order returned by shell globbing). Patches placed here are either to back-port the package to an older version of OCaml than upstream supports, or to back-port a fix from an unreleased version of package.
1616

17-
In `lib-ext` mode, `dune` files can be dropped into the extracted package sources, after patching, by creating a file named `src_ext/dune-foo`. If the package needs dropping in a subdirectory, then these can be appended to the filename, using `-` instead of `/`. For example, `src_ext/dune-foo-src-lib` will be copied to `src/lib/dune` when package `foo` is extracted.
17+
`dune` files can be dropped into the extracted package sources, after patching, by creating a file named `src_ext/dune-foo`. If the package needs dropping in a subdirectory, then these can be appended to the filename, using `-` instead of `/`. For example, `src_ext/dune-foo-src-lib` will be copied to `src/lib/dune` when package `foo` is extracted.
1818

1919
Finally, `src_ext/Makefile` provides an opportunity for package-specific commands to be run by adding specific commands to the `.stamp` targets. See, for example, the horrors in [f721385](https://github.com/ocaml/opam/commit/f721385).
2020

2121
## Updating the dependencies
2222

23-
`src_ext/update-sources.sh` will attempt to use repository data from your current opam switch to automatically update `src_ext/Makefile.sources`. For some packages, the script may make the wrong determination (e.g. cudf 0.9, where opam's sources stick with the original gforge source archive), so the changes suggested should be reviewed carefully! After updating the dependencies, it's important to check that the patches still work. These can be triggered manually with `make clone` (for `lib-ext`) or `make clone-pkg` (for `lib-pkg`). If a patch no longer applies, it needs to be updated or replaced (e.g. by rebasing a git commit and using `git format-patch` or by manually applying the changes to a clean worktree and using `diff -Naur`, etc.). Once the patches are correct and `make clone` is working, run `../shell/re-patch.sh` to normalise the patches. This script will apply the patches as given and then regenerate them using `diff`.
23+
`src_ext/update-sources.sh` will attempt to use repository data from your current opam switch to automatically update `src_ext/Makefile.sources`. For some packages, the script may make the wrong determination (e.g. cudf 0.9, where opam's sources stick with the original gforge source archive), so the changes suggested should be reviewed carefully! After updating the dependencies, it's important to check that the patches still work. These can be triggered manually with `make clone`. If a patch no longer applies, it needs to be updated or replaced (e.g. by rebasing a git commit and using `git format-patch` or by manually applying the changes to a clean worktree and using `diff -Naur`, etc.). Once the patches are correct and `make clone` is working, run `../shell/re-patch.sh` to normalise the patches. This script will apply the patches as given and then regenerate them using `diff`.
2424

2525
## Dune and mccs
2626

27-
The Dune vendored dependency is a special case: firstly, in lib-ext mode it's optional and secondly the package is called `dune-local`. The name avoids conflict with a directory called `dune` (which Dune itself can't cope with). mccs is also a special case, because it's optional in lib-ext mode.
27+
The Dune vendored dependency is a special case: firstly, it's optional and secondly the package is called `dune-local`. The name avoids conflict with a directory called `dune` (which Dune itself can't cope with). mccs is also a special case, because it's optional.
2828

2929
## Adding a new dependency
3030

31-
1. Add the tarball information to `src_ext/Makefile.sources`. If the package is used in `lib-ext` mode, define `URL_package` and `MD5_package`. If the same package is used in `lib-pkg` mode, add `$(call PKG_SAME,package)`, otherwise define `URL_PKG_package` and `MD5_PKG_package`. If a package is only used in `lib-pkg` mode, don't define `URL_package` and `MD5_package`.
32-
2. Add `package` to `SRC_EXTS` or `PKG_EXTS in `src_ext/Makefile`.
33-
3. Put any requires patches in `src_ext/patches/` (in `package.common/` for both modes, `package/` for `lib-ext` mode and `package.pkg/` for `lib-pkg` mode).
31+
1. Add the tarball information to `src_ext/Makefile.sources`. Define `URL_package` and `MD5_package`.
32+
2. Add `package` to `SRC_EXTS` in `src_ext/Makefile`.
33+
3. Put any requires patches in `src_ext/patches/` (in `package/`).
3434
4. If the package's build system is not Dune, create `src_ext/dune-package`. The build system `touch`es `package.opam` when assembling the sources.
35-
5. Add a `package.pkgbuild:` entry to `src_ext/Makefile.packages` containing the dependencies of `package`.
36-
6. Add a `package-pkg-build:` target with the build steps for building and installing `package`. Various utility variables are available in `src_ext/Makefile.packages`, in particular `$(OCAMLBIN)` is the compiler's `bin` directory and `$(SITELIB)` is the ocamlfind library root (effectively `%{lib}%` in opam) and `$(OCAMLROOT)` is the actual prefix of the compiler's installation.
3735

3836
## Testing
3937

40-
* For `lib-pkg` mode: run `make compiler`, backup `bootstrap` directory, and run `make lib-pkg`
41-
* For `lib-ext` mode: run `./configure --with-vendored-deps`, then `make`
38+
run `./configure --with-vendored-deps`, then `make`

src_ext/Makefile

+7-104
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
ifneq ($(wildcard ../Makefile.config)$(filter-out archives cache-archives lib-pkg,$(MAKECMDGOALS)),)
1+
ifneq ($(wildcard ../Makefile.config)$(filter-out archives cache-archives,$(MAKECMDGOALS)),)
22
-include ../Makefile.config
33
endif
44

55
ifneq ($(wildcard Makefile.config),)
66
include Makefile.config
7-
CAN_PKG=1
8-
else
9-
CAN_PKG=0
107
endif
118

129
PATCH ?= patch
@@ -25,32 +22,18 @@ ifndef FETCH
2522
endif
2623
endif
2724

28-
# Shorthand for designating that lib-ext and lib-pkg use the same version of a library
29-
PKG_SAME = $(eval $(call PKG_SAME_DEFS,$(1)))
30-
define PKG_SAME_DEFS
31-
URL_PKG_$(1) = $(URL_$(1))
32-
MD5_PKG_$(1) = $(MD5_$(1))
33-
endef
34-
3525
SRC_EXTS = cppo base64 extlib re cmdliner ocamlgraph cudf dose3 opam-file-format seq stdlib-shims spdx_licenses opam-0install-cudf 0install-solver uutf jsonm sha swhid_core
36-
PKG_EXTS = $(SRC_EXTS) dune-local findlib ocamlbuild topkg mccs
3726

3827
ifeq ($(MCCS_ENABLED),true)
3928
SRC_EXTS := $(SRC_EXTS) mccs
4029
endif
4130

4231
include Makefile.sources
43-
ifneq ($(shell PATH="$(PATH)" command -v ocamlc 2>/dev/null),)
44-
include Makefile.packages
45-
endif
4632

4733
ARCHIVES = $(foreach lib,$(SRC_EXTS),$(notdir $(URL_$(lib))))
4834
lib_of = $(foreach lib,$(SRC_EXTS),$(if $(findstring $(1),$(URL_$(lib))),$(lib),,))
4935

5036
ARCHIVE_FILE = $(1)$(patsubst %.tbz,.tbz,$(patsubst %.tar.gz,.tar.gz,$(URL_$(2)$(1))))
51-
DOWNLOAD_COOKIE = touch $(1).$(4)download && \
52-
$(if $(filter $(MD5_$(2)$(1)),$(MD5_$(3)$(1))),touch,rm -f) $(1).$(5)download && \
53-
rm -f $(call ARCHIVE_FILE,$(1),$(2)) $(1).stamp $(1).pkgbuild
5437

5538
SILENT ?=
5639

@@ -82,25 +65,6 @@ else
8265
$(error Re-run configure --with-vendored-deps)
8366
endif
8467

85-
ifeq ($(CAN_PKG),1)
86-
lib-pkg: clone-pkg build-pkg
87-
@
88-
else
89-
lib-pkg:
90-
@echo "Installation of packages is only permitted for the bootstrap compiler"
91-
@echo "Run $(MAKE) [OCAML_PORT=auto|msvc|msvc64|mingw|mingw64] compiler first"
92-
@false
93-
endif
94-
95-
.PHONY: lib-pkg-urls
96-
lib-pkg-urls:
97-
@$(foreach i,$(PKG_EXTS),$(info $i $(URL_PKG_$i)))
98-
@find patches -type f | grep '\.\(pkg\|common\)/' | xargs sha1sum
99-
100-
reset-lib-pkg:
101-
@rm -f ../bootstrap/ocaml/bin/ocamlbuild* ../bootstrap/ocaml/bin/ocamlfind* `ls ../bootstrap/ocaml/bin/* | grep -v "flexlink\|\/ocaml[^\/]*$$"` ../bootstrap/ocaml/lib/topfind
102-
@rm -rf ../bootstrap/ocaml/lib/ocaml/site-lib ../bootstrap/ocaml/etc *.pkgbuild
103-
10468
ifeq ($(DUNE),)
10569
DUNE_DEP=dune-local/_boot/dune$(EXE)
10670
DUNE_CLONE=dune-local.stamp
@@ -117,47 +81,24 @@ endif
11781
dune-local/_boot/dune$(EXE): $(DUNE_CLONE)
11882
cd dune-local && ocaml boot/bootstrap.ml
11983

120-
build-pkg: clone-pkg $(PKG_EXTS:=.pkgbuild)
121-
@
122-
123-
%.pkgbuild: | %.pkgstamp
124-
@rm -f $*.pkgstamp
125-
$(MAKE) MAKEFLAGS= -f ../Makefile.packages -C $* $*-pkg-build && touch $@
126-
127-
.PHONY: def-ignore
128-
def-ignore:
129-
@echo "; This file is automatically generated" > dune
130-
@echo "(dirs :standard \ $(SRC_EXTS),$(PKG_EXTS))" >> dune
131-
13284
.PHONY: ext-ignore
13385
ext-ignore:
13486
@echo "; This file is automatically generated" > dune
135-
@echo "(dirs :standard \ dune-local $(filter-out dune-local $(SRC_EXTS),$(PKG_EXTS)))" >> dune
87+
@echo "(dirs :standard \ dune-local)" >> dune
13688
@echo "(vendored_dirs $(SRC_EXTS))" >> dune
13789

13890
.PHONY: clone
13991
clone: $(DUNE_CLONE) $(SRC_EXTS:=.stamp) | ext-ignore
14092
@true
14193

142-
.PHONY: pkg-ignore
143-
pkg-ignore:
144-
@echo "; This file is automatically generated" > dune
145-
@echo "(dirs :standard \ $(PKG_EXTS))" >> dune
146-
147-
clone-pkg: $(PKG_EXTS:=.pkgstamp) | pkg-ignore
148-
@
149-
15094
.PHONY: archives
15195
archives: $(DUNE_CLONE:.stamp=.download) $(SRC_EXTS:=.download)
15296
@true
15397

154-
archives-pkg: $(PKG_EXTS:=.pkgdownload)
98+
cache-archives: $(SRC_EXTS:=.cache) ocaml.cache flexdll.cache
15599
@
156100

157-
cache-archives: $(SRC_EXTS:=.cache) $(PKG_EXTS:=.pkgcache) ocaml.cache flexdll.cache
158-
@
159-
160-
has-archives: $(addprefix archives/, $(notdir $(URL_ocaml)) $(notdir $(URL_flexdll)) $(ARCHIVES) $(filter-out $(ARCHIVES), $(foreach pkg,$(PKG_EXTS), $(notdir $(URL_PKG_$(pkg))))))
101+
has-archives: $(addprefix archives/, $(notdir $(URL_ocaml)) $(notdir $(URL_flexdll)) $(ARCHIVES))
161102
@
162103

163104
define cache_url
@@ -176,34 +117,17 @@ GET_ARCHIVE=\
176117
@test -e archives/$(notdir $(URL_$*)) || \
177118
{ $(call GET_ARCHIVE,$*) && mv $(call ARCHIVE_FILE,$*) archives/$(notdir $(URL_$*)); }
178119

179-
%.pkgcache:
180-
@mkdir -p archives
181-
@test -e archives/$(notdir $(URL_PKG_$*)) || \
182-
{ $(call GET_ARCHIVE,$*,PKG_) && mv $(call ARCHIVE_FILE,$*,PKG_) archives/$(notdir $(URL_PKG_$*)); }
183-
184120
.PRECIOUS: %.download
185121
%.download: Makefile.sources
186-
@$(call DOWNLOAD_COOKIE,$*,,PKG_,,pkg)
187122
$(SILENT)[ -e $(call ARCHIVE_FILE,$*) ] || \
188123
cp archives/$(notdir $(URL_$*)) $(call ARCHIVE_FILE,$*) 2>/dev/null || $(call GET_ARCHIVE,$*)
189124

190-
%.pkgdownload: Makefile.sources
191-
@$(call DOWNLOAD_COOKIE,$*,PKG_,,pkg)
192-
[ -e $(call ARCHIVE_FILE,$*,PKG_) ] || \
193-
cp archives/$(notdir $(URL_PKG_$*)) $(call ARCHIVE_FILE,$*,PKG_) 2>/dev/null || $(call GET_ARCHIVE,$*,PKG_)
194-
195125
%.stamp: %.download
196126
$(SILENT)mkdir -p tmp-$*
197127
$(SILENT)cd tmp-$* && $(if $(patsubst %.tar.gz,,$(URL_$*)),bunzip2,gunzip) -c ../$(call ARCHIVE_FILE,$*) | tar xf -
198128
$(SILENT)rm -rf $*
199129
@for ii in tmp-$*/*; do if [ -d $${ii} ]; then mv $${ii} $*; fi; done; \
200130
rm -rf tmp-$*
201-
@if [ -d patches/$*.common ]; then \
202-
cd $* && \
203-
for p in ../patches/$*.common/*.patch; do \
204-
$(PATCH) -p1 < $$p $(if $(SILENT),> /dev/null); \
205-
done; \
206-
fi
207131
@if [ -d patches/$* ]; then \
208132
cd $* && \
209133
for p in ../patches/$*/*.patch; do \
@@ -218,34 +142,13 @@ GET_ARCHIVE=\
218142
touch $*/$*.opam; \
219143
done; \
220144
fi
221-
@touch $@ && rm -f $*.pkgstamp $*.pkgbuild
222-
223-
%.pkgstamp: %.pkgdownload
224-
mkdir -p tmp-$*
225-
cd tmp-$* && tar xf$(if $(patsubst %.tar.gz,,$(call ARCHIVE_FILE,$*,PKG_)),j,z) ../$(call ARCHIVE_FILE,$*,PKG_)
226-
rm -rf $*
227-
# On Cygwin, the mv has a tedious habit of sometimes failing, hence the slightly odd repetition
228-
@for ii in tmp-$*/*; do if [ -d $${ii} ]; then mv $${ii} $* || mv $${ii} $*; fi; done; \
229-
rm -rf tmp-$*
230-
@if [ -d patches/$*.common ]; then \
231-
cd $* && \
232-
for p in ../patches/$*.common/*.patch; do \
233-
$(PATCH) -p1 < $$p; \
234-
done; \
235-
fi
236-
@if [ -d patches/$*.pkg ]; then \
237-
cd $* && \
238-
for p in ../patches/$*.pkg/*.patch; do \
239-
$(PATCH) -p1 < $$p; \
240-
done; \
241-
fi
242-
@touch $@ && rm -f $*.stamp
145+
@touch $@
243146

244147
clean:
245148
@
246149

247150
distclean: clean
248-
rm -rf dune-local secondary $(SRC_EXTS) $(PKG_EXTS)
249-
rm -f *.tar.gz *.tbz *.*stamp *.*download *.pkgbuild dune \
151+
rm -rf dune-local secondary $(SRC_EXTS)
152+
rm -f *.tar.gz *.tbz *.*stamp *.*download dune \
250153
Makefile.config
251154
[ -d archives ] && ([ "$$(find archives -maxdepth 0 -type d -empty)" != "" ] && rmdir archives || echo "WARNING! $$(pwd)/archives/ not empty so left") || true

0 commit comments

Comments
 (0)