Skip to content

Commit

Permalink
Update Readme
Browse files Browse the repository at this point in the history
- include information about coq-shell and coq-env (as appropriate per platform)
- improve information for creating custom installers
fixes #224, fixes #216, fixes #149
(together with the preceeding commits implementing the behavior described in the updated readme)
  • Loading branch information
MSoegtropIMC committed Oct 3, 2022
1 parent b279518 commit 71b2e71
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 44 deletions.
31 changes: 3 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ If you want to work with the 32 bit variants, please use these options in your C
**Important note:** CompCert is **not** free / open source software, but may be used for research and evaluation purposes.
Please clarify the license at [CompCert License](https://github.com/AbsInt/CompCert/blob/master/LICENSE).

## Installation of other packages
## Installation of additional packages

- On Windows open a shell with `C:\<your_coq_platform_cygwin_path>\cygwin.bat`.
- On Linux or macOS open a shell in the usual way.
Expand Down Expand Up @@ -262,35 +262,10 @@ Please clarify the license at [CompCert License](https://github.com/AbsInt/CompC

</details>

<details><summary><font size="+1">Creating package pick variants</font></summary>
<details><summary><font size="+1">Creating package pick variants and customized installers</font></summary>

It is an intended use case of the Coq Platform to create custom variants, e.g.
for projects or lectures, by creating additional files in the [package_picks](package_picks)
folder.

The scripts for creating binary packages and installers should be able to
handle such variants, so that it should be easy to create a custom installer
e.g. for a lecture.

A few notes on the process:

- Create a new file in the [package_picks](package_picks) folder by copying one of the existing files as template.
- Add or remove packages or change package versions according to your requirements.
- You should include specific versions for all packages to get a reproducible result.
The opam database changes daily and unless you specify a version for each package you get different results and possibly the build will fail.
- In case you want to include pre release packages, which don't have a published opam package as yet, you can add opam packages in the folders under [opam](opam).
opam packages in thes folder take precedence over packages from the published repositories.
- You can set the variable `COQ_PLATFORM_USE_DEV_REPOSITORY` in the header of the package pick file to `Y` in case you want to include the public and local `extra-dev` opam repositories in the opam package search.
- **Please always change the opam switch name**, that is the variable `COQ_PLATFORM_PACKAGE_PICK_POSTFIX`!
- The scripts for creating binary packages/installers for macOS, Windows and snap are in the specific system sub folders:
- **macOS**: (macos/create_installer_macos.sh)
- **Windows**: (windows/create_installer_windows.sh)
- **snap**: (linux/create_snapcraft_yaml.sh)
- the macOS and Windows script are intended to be run locally and require that the specific Coq Platform version has been installed and that **the opam switch is selected**,
but the CI actions also create the installers for macOS and Windows.
- the snap package is intended to be created via a CI action - see (linux/snap/github_actions/README.md)
- the scripts don't take required parameters (some have debug parameters)

A note on debugging `Sorry, no solution found: there seems to be a problem with your request.`: this happens mostly in a parallel build, when you request e.g. package versions which have incompatible dependencies. The best way to debug this is to set in [coq_platform_make.sh](https://github.com/coq/platform/blob/0895c3cc0d69837ed7a80d882d4348d90e4a609a/coq_platform_make.sh#L22) `export OPAMYES=0` and then do a sequential build (select 's' when the scripts asks). opam will stop then whenever additional dependencies need to be installed and especially if the version of an already installed packages needs to be changed.

If you have issues, please contact us on zulip chat [Coq-Platform & users](https://coq.zulipchat.com/#narrow/stream/250632-Coq-Platform.20devs.20.26.20users)
For details, especially on creating custom installers for MacOS, Linux/Snap and Windows see [Customized Installers](doc/FAQ-customized-installers.md).
83 changes: 83 additions & 0 deletions doc/FAQ-customized-installers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Creating custom package picks and installers

It is an intended use case of the Coq Platform to create custom variants and installers, e.g.
for projects or lectures, by creating additional files in the [package_picks](../package_picks) folder.

The scripts for creating binary packages and installers should be able to
handle such variants, so that it should be easy to create a custom installer
e.g. for a lecture.

## Creating a new package pick file

- Create a new file in the [package_picks](package_picks) folder by copying one of the existing files as template.
- **Please always change the opam switch name**, that is the variable `COQ_PLATFORM_PACKAGE_PICK_POSTFIX`
- Make sure that the value assigned to `COQ_PLATFORM_PACKAGE_PICK_POSTFIX` matches the postfix of the package pick file name.
- Give appropriate values to other variables in the header section of the package pick file, especially `COQ_PLATFORM_VERSION_TITLE` and `COQ_PLATFORM_VERSION_DESCRIPTION`.
- Add or remove packages or change package versions according to your requirements.
- You should include specific versions for all packages to get a reproducible result.
The opam database changes daily and unless you specify a version for each package you get different results and possibly the build will fail.
Opam CI does not test all possible combinations of package versions.
- In case you want to include pre release packages, which don't have a published opam package as yet, you can add opam packages in the folders under [opam](../opam).
opam packages in thes folder take precedence over packages from the published repositories.
- You can set the variable `COQ_PLATFORM_USE_DEV_REPOSITORY` in the header of the package pick file to `Y` in case you want to include the public and local `extra-dev` opam repositories in the opam package search.

As soon as you have created a package pick file, you can create an opam switch from it by running `coq_platform_make.sh/.bat` and selecting the new pick.
You can also give the pick on the command line e.g. by running:
```
./coq_platform_make.sh -packages="my_new_pick" -extent=x -parallel=p -jobs=6 -compcert=y -vst=y -switch=k
```

On Windows you can either create a new cygwin with:
```
CALL coq_platform_make_windows.bat ^
-arch=64 ^
-destcyg=C:\bin\cygwin64_coq_platform_my_new_pick ^
-cygcache=C:\bin\cygwin_cache ^
-cygrepo=https://mirrors.kernel.org/sourceware/cygwin ^
-packages="my_new_pick" -extent=x -parallel=p -jobs=6 -compcert=y -vst=y -switch=k
```
or you can reuse an existing Coq Platform created cygwin and run the same shell script as above.
The Coq Platform cygwin hardly ever changes, so there is no point in creating a new cygwin for each package pick.
In case your pick requires additional cygwin supplied MinGW libraries, this is handled automatically by opam depext - if not it is better to fix the opam package than adding teh package to the cygwin install command line.

### Debugging package picks

Since package picks should specify all versions, it is quite common that opam says: `Sorry, no solution found: there seems to be a problem with your request.` simply because you requested conflicting versions.
There is a script `maintainer_scripts/build_seq.sh` which builds a pick package by package and disables the opam "auto-yes". This way, when you have a conflict, opam will stop and ask you if it should change the package versions. At this point you can exactly see which package (the which shall be installed) requires which versions (the requested recompiles).

If you have issues, please contact us on zulip chat [Coq-Platform & users](https://coq.zulipchat.com/#narrow/stream/250632-Coq-Platform.20devs.20.26.20users)

## Creating a custom installer for MacOS

After you created and built a new package pick, you can create a MacOS DMG installer from it as follows:

- Activate the opam switch with `opam switch __coq-platform.2022.09.0~my_new_pick`
- Navigate to your Coq Platform git folder, e.g. `cd ~/platform`
- Run `macos/create_installer_macos.sh -sign=Y -signcert=path_to_certificate_file -signid=signature_id`
- Above the `path_to_certificate_file` is the path and name of the `.cer` and `.p12` file **without** the file extension. The signature ID is typically the name of the institution to which the certificate is issued.

On recent MacOS one can't start the application - that is CoqIDE - without signing the installer. One can still use the installed tools from the command line, though. One can even start coqide from the command line even without signing.

## Creating a custom installer for Snap

After you created a new package pick, you can create a Snap package from it as follows:

- First note that for snap it is **not** required to build the switch first - the snap building process will build it inside of the snapcraft VM.
- Navigate to your Coq Platform git folder, e.g. `cd ~/platform`
- Run `linux/create_snapcraft_yaml.sh -packages=my_new_pick -extent=x -parallel=p -jobs=6 -vst=y -compcert=y -set-switch=y -switch=k`
- Run `SNAPCRAFT_BUILD_ENVIRONMENT_CPU=12 SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=24G snapcraft snap` - the CPU (thread) count and memory depends on your machine - you should have 2GB per CPU and you should have twice as many CPU threads as the job count you specified initially.
- Building the snap will take a while.
- You can install the snap with `snap install --dangerous coq-prover_2022-09-0_amd64.snap`.
- The snap file name will not depend on your package pick name.
- You can distribute the `.snap` file and people can install it with the above command.

## Creating a custom installer for Windows

After you created and built a new package pick, you can create a Windows installer from it as follows:

- Open the Coq Platform cygwin shell, e.g. `C:\bin\cygwin64_coq_platform\cygwin.bat`.
- Activate the opam switch with `opam switch __coq-platform.2022.09.0~my_new_pick`
- Navigate to the `coq-platform` folder.
- Run `windows/create_installer_windows.sh`

On Windows it depends on the exact version and variant if you need to sign the installer or not.
33 changes: 23 additions & 10 deletions doc/README_Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,39 @@ In case you don't have snap installed yet, please refer to [installing-snapd](ht

The snap URL is https://snapcraft.io/coq-prover.

This install method is maintained by Enrico Tassi.
This install method has been implemented by Enrico Tassi.

**A note to lecturers:** it is easy to create a customized snap packages from an opam switch - see [Customized Installers](FAQ-customized-installers.md)

## Package name

The name of the package is `coq-prover` since `coq` was considered
unacceptable by the Snap Store admins (too short and non informative).

## Aliases

The snap package can install binaries in the path, but they are all called
`coq-prover.something` and `something` cannot contain `_`.
`coq-prover.something` and `something` cannot contain `_`,
but it is possible to request short aliases from the snap team.

As per [request](https://forum.snapcraft.io/t/aliases-request-for-coq-prover/21925)
Coq is granted the `coqide -> coq-prover.coqide` and
`coq_makefile -> coq-prover.coq-makefile` aliases (shorthands generated
on the fly).
Coq is granted these short aliases:
- **coqide -> coq-prover.coqide**
- **coq_makefile -> coq-prover.coq-makefile**
- **coqtop -> coq-prover.coqtop**
- **coqc -> coq-prover.coqc**
- **coqdep -> coq-prover.coqdep**
- **coqidetop.opt -> coq-prover.coqidetop**

## Using non aliased tools from the command line

If you want to use more than the aliased tools from the command line, you have two options:

- Run `eval $(coq-prover.env)` in your shell. This will set the environment variables `$PATH`, `$COQLIB` and `$LD_LIBRARY_PATH` in the current shell.
- Run `/snap/coq-prover/current/coq-platform/bin/coq-shell.sh`. This will start a new shell context (which can be closed with `exit`) in which the above variables are set.

## Channels and updates

Each package is available on a channel, which is a combination of track and
risk level.
A track is something like `latest` (the default one) or, `major-version` (as
Expand All @@ -60,14 +77,10 @@ happy to grant quickly a new track if it follows the same schema of an existing
one.

## See also
- linux/snap/github_actions for a script to trigger a CI build for a platform
branch also uploading to the Snap Store

## Snap doc

- [Channels](https://snapcraft.io/docs/channels)
- [Process for manual store actions (tracks, aliases)](https://forum.snapcraft.io/t/process-for-aliases-auto-connections-and-tracks/455)

- `linux/snap/github_actions` for a script to trigger a CI build for a platform branch also uploading to the Snap Store

# Installation by compiling from sources using opam

Expand Down
5 changes: 4 additions & 1 deletion doc/README_Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ This method is intended for beginners.

- Download the installer from https://github.com/coq/platform/releases (click on "Assets" at the end of a release section)
- Run the installer and follow the instructions
- In case you want to use the installed `coqc` and other tools from the command line, you have two options:
- Use the supplied `coq-shell.bat` command - a short cut is installed in the start menu. This file opens a Windows command interpreter in which the environment variables `$PATH` and `$COQLIB` are set.
- Run `CALL C:\my_coq_install_path\coq-shell.bat` in a command shell to set the above variables in the current command shell.

A note to lecturers: it is easy to create a customized Windows installer from an opam switch - see [Customized Installers](#customized-installers)
**A note to lecturers:** it is easy to create a customized Windows installer from an opam switch - see [Customized Installers](FAQ-customized-installers.md)

# Installation by compiling from sources using opam on cygwin

Expand Down
11 changes: 6 additions & 5 deletions doc/README_macOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ In case you want to use the fast path:
- Open the downloaded DMG package with a double click.
- Drag and drop the "Coq_Platform_2022.01.0.app" icon on the link to the "Applications" folder.
- CoqIDE appears under `/Applications` in Finder and in Launcher.
- Beta releases of Coq Platform might contain unsigned packages, which macOS does not start by default. In case you get an error message
stating "Coq_Platform.app cannot be opened because the developer cannot be verified" either download a release package, or alternatively
right click the `Coq_Platform` app in `/Applications` in Finder and select `open`. You will see the same error message as before, but it will have an `Open` button now.
- In case you want to use the installed `coqc` from the command line, please add the folder `/Applications/Coq-Platform~8.15~2022.04.app/Contents/Resources/bin` to your `$PATH`, e.g. by running `sudo sh -c "echo '/Applications/Coq-Platform~8.15~2022.04.app/Contents/Resources/bin' > /etc/paths.d/coq"`
- The published installers are always signed by INRIA, but no notarized by Apple yet. This means that on first start of the application, you must right click on the Coq application in the `Applications` folder and select `open`. Subsequently this is not required - the application can be started directly.
- In case you want to use the installed `coqc` and other tools from the command line, you have three options:
- Use the supplied `coq-shell.command` file. This file is included in the top level folder of the `.dmg` file and can be dragged e.g. to the desktop and started from there. It opens a terminal window in which the environment variables `$PATH` and `$COQLIB` are set. These `.command` files always refer to a specifc version of Coq, so you can keep multiple of these files for multiple versions of Coq.
- Run `eval $(/Applications/Coq-Platform~8.15~2022.04.app/Contents/Resources/bin/coq-env.sh)` in your shell. This will set the same environment variables as `coq-shell.command` in the current shell.
- Add the folder `/Applications/Coq-Platform~8.15~2022.04.app/Contents/Resources/bin` to your `$PATH`, e.g. by running `sudo sh -c "echo '/Applications/Coq-Platform~8.15~2022.04.app/Contents/Resources/bin' > /etc/paths.d/coq"`. Please note that this method has two disadvantages: first it is difficult to switch between different versions of Coq and second some tools require additional environment variables, e.g. `COQLIB` or `LD_LIBRARY_PATH` to be set.
- If you want to inspect the installed content, right click the `Coq_Platform` app in `/Applications` in Finder and select `Show Package Contents`.

A note to lecturers: it is easy to create a customized Windows installer from an opam switch - see [Customized Installers](#customized-installers)
**A note to lecturers:** it is easy to create a customized Windows installer from an opam switch - see [Customized Installers](FAQ-customized-installers.md)

# Installation by compiling from Sources using opam

Expand Down

0 comments on commit 71b2e71

Please sign in to comment.