{"id":18841949,"url":"https://github.com/diskuv/dkml-component-opam","last_synced_at":"2025-04-14T07:31:26.875Z","repository":{"id":41287711,"uuid":"484009212","full_name":"diskuv/dkml-component-opam","owner":"diskuv","description":"DKML component for Opam","archived":false,"fork":false,"pushed_at":"2024-09-12T00:07:12.000Z","size":697,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-12T10:02:04.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diskuv.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-21T10:37:30.000Z","updated_at":"2024-09-12T00:07:15.000Z","dependencies_parsed_at":"2023-11-25T18:29:46.157Z","dependency_job_id":"54beda97-caf5-4050-ad71-b0f259d44b73","html_url":"https://github.com/diskuv/dkml-component-opam","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diskuv%2Fdkml-component-opam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diskuv%2Fdkml-component-opam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diskuv%2Fdkml-component-opam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diskuv%2Fdkml-component-opam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diskuv","download_url":"https://codeload.github.com/diskuv/dkml-component-opam/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223624357,"owners_count":17175195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T02:53:08.508Z","updated_at":"2024-11-08T02:53:09.219Z","avatar_url":"https://github.com/diskuv.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opam components distributed by DkML\n\n## Making a new version\n\n\u003e It is perfectly fine to do all of this on a Unix machine, even if you intend to distribute to Windows users.\n\u003e\n\u003e The following assumes you have a Unix shell. On Windows with DkML installed you can use `with-dkml bash` to get one.\n\n1. Do the following parts of the Prereqs section in [DEVELOPMENT.md](./DEVELOPMENT.md):\n\n   ```sh\n   # On Windows\n   dkml init\n\n   # On Unix\n   opam switch create . --no-install --repos 'default,diskuv-2.1.0=git+https://github.com/diskuv/diskuv-opam-repository.git#2.1.0' --packages dkml-base-compiler.4.14.0~v2.1.0\n   ```\n\n2. Edit the `(version ...)` in [dune-project](./dune-project).\n   There are guidelines in that file, especially about including the date in the version string.\n3. Add an entry to [CHANGES.md](./CHANGES.md).\n4. Add a new opam version inside `extra-source \"dl/opam.tar.gz\"` in [dkml-component-staging-opam64.opam.template](./dkml-component-staging-opam64.opam.template) and [dkml-component-staging-opam32.opam.template](./dkml-component-staging-opam32.opam.template).\n   - Update the `src` and `checksum` fields. The `src` should be the \"Source code (tar.gz)\" asset link for the latest release in \u003chttps://github.com/ocaml/opam/releases\u003e (or better yet use a permanent download link).\n   - **Update the changelog comments in this section.** That means you clone the *new* `src` and `checksum` fields as *comments*.\n5. Do:\n\n   ```sh\n   opam exec -- dune build *.opam\n   git add CHANGES.md dune-project *.opam *.opam.template\n   git commit -m \"Prepare new version (1/2)\"\n\n   opam remove dkml-component-staging-opam64 -y\n   opam install ./dkml-component-staging-opam64.opam --keep-build-dir\n   ```\n\n6. You will need to place the output of the following command into the **BEGIN OPAM ARCHIVES** sections of [dkml-component-staging-opam64.opam.template](./dkml-component-staging-opam64.opam.template) and [dkml-component-staging-opam32.opam.template](./dkml-component-staging-opam32.opam.template):\n\n   ```sh\n   opamdl=\"$(opam var dkml-component-staging-opam64:build)/dl/opam\"\n\n   join \u003c(awk '$1~/^URL_[a-z]/{sub(/URL_/,\"\",$1); print $1,\"URL\",$NF}' \"${opamdl}/src_ext/Makefile\" \"${opamdl}/src_ext/Makefile.sources\") \u003c(awk '$1~/^MD5_[a-z]/{sub(/MD5_/,\"\",$1); print $1,\"MD5\",$NF}' \"${opamdl}/src_ext/Makefile\" \"${opamdl}/src_ext/Makefile.sources\") | awk -v dq='\"' '$2==\"URL\" \u0026\u0026 $4==\"MD5\"{name=$3; sub(\".*/\", \"\",name); printf \"extra-source %sdl/opam/src_ext/archives/%s%s {\\n  src: %s%s%s\\n  checksum: [\\n    %smd5=%s%s\\n  ]\\n}\\n\", dq,name,dq, dq,$3,dq, dq,$5,dq }'\n   ```\n\n7. Do:\n\n   ```sh\n   opam exec -- dune build *.opam\n   git add *.opam *.opam.template\n   git commit -m \"Prepare new version (2/2)\"\n\n   opam install ./dkml-component-common-opam.opam ./dkml-component-staging-opam32.opam ./dkml-component-staging-opam64.opam ./dkml-component-offline-opam.opam --keep-build-dir --yes\n\n   # See some important OS-specific files that will be packaged as part of the installer\n   find \"$(opam var dkml-component-offline-opam:share)/staging-files\"\n   find \"$(opam var dkml-component-staging-opam64:share)/staging-files\"\n   ```\n\n8. Do:\n\n   ```sh\n   # 2.2.0~beta2~20240409 is tagged as 2.2.0-beta2-20240409\n   tagversion=$(awk '/\\(version / { sub(/)/, \"\"); gsub(/~/, \"-\"); print $2 }' dune-project)\n   git tag \"$tagversion\"\n   git push origin \"$tagversion\"\n   ```\n\nThat should kick of GitHub Actions which will build for Windows, macOS and Linux.\n\n**FINALLY**, go to \u003chttps://github.com/diskuv/dkml-component-opam/releases\u003e and download the source `.tar.gz` (which is not immutable), then add it as the `src.tar.gz` asset to make it immutable, and then publish the new version to the DkML opam repository with:\n\n```sh\ntagversion=$(awk '/\\(version / { sub(/)/, \"\"); gsub(/~/, \"-\"); print $2 }' dune-project)\nopam-publish --repo=diskuv/diskuv-opam-repository --target-branch=main \"https://github.com/diskuv/dkml-component-opam/releases/download/$tagversion/src.tar.gz\"\n```\n\n**OPTIONAL BUT DEPRECATED** since `Diskuv.opam` was [removed from winget](https://github.com/microsoft/winget-pkgs/pull/172923). start at step 2 of [dkml-installer-opam's \"Making a new version\"](https://github.com/diskuv/dkml-installer-opam?tab=readme-ov-file#making-a-new-version) to complete the instructions for publishing so `winget install Diskuv.opam` picks up your changes.\n\n## Components: staging-opam32, staging-opam64 and offline-opam\n\nThe `staging-opam32` and `staging-opam64` components make available the Opam binaries (`opam`, `opam-installer`\nand on Windows `opam-putenv`) in the `staging-files` directory.\n\nThe `offline-opam` component will install the Opam binaries from `staging-opam32` on 32-bit machines into\nthe end-user's installation prefix, and from `staging-opam64` on 64-bit machines.\n\nThese are components that can be used with [dkml-install-api](https://diskuv.github.io/dkml-install-api/index.html)\nto generate the `winget` / `setup.exe` installers.\n\n## dkml-component-staging-opam32 and dkml-component-staging-opam64\n\nDkML components vary by whether 32-bit or 64-bit executables are distributed. Sometimes\nwe only distribute 64-bit for a host operating system (ex. macOS).\n\n### Executables\n\n\u003e `%{staging-opam32:share-abi}%/bin/opam`\n\u003e\n\u003e `%{staging-opam32:share-abi}%/bin/opam-installer`\n\u003e\n\u003e `%{staging-opam32:share-abi}%/bin/opam-putenv`\n\u003e\n\u003e `%{staging-opam64:share-abi}%/bin/opam`\n\u003e\n\u003e `%{staging-opam64:share-abi}%/bin/opam-installer`\n\u003e\n\u003e `%{staging-opam64:share-abi}%/bin/opam-putenv`\n\nOn Windows the binaries will end with `.exe`.\n\nFor a given ABI (ex. `darwin_arm64`) only one of opam32 or opam64's bin/opam\nwill be present.\n\nIf you need to copy these from staging to the end-user's installation prefix, you should copy\nthe entire `%{staging-opam32:share-abi}%/bin` and\n`%{staging-opam64:share-abi}%/bin` directories (one will be empty) as they may contain DLLs\nand shared libraries necessary for their operation.\n\n### Documentation\n\n\u003e `%{staging-opam32:share-generic}%/man/man1`\n\u003e\n\u003e `%{staging-opam64:share-generic}%/man/man1`\n\nMan pages. The man pages will only be available if the corresponding executable is available\nin the 32-bit or 64-bit form. If both 32-bit and 64-bit are available, the man pages will\nbe duplicated.\n\n### Usage\n\nFIRST, add a dependency to your .opam file:\n\n```ocaml\ndepends: [\n  \"dkml-component-staging-opam\"   {\u003e= \"2.1.0\"}\n  # ...\n]\n```\n\nSECOND, add the package to your currently selected Opam switch:\n\n```bash\nopam install dkml-component-staging-opam\n# Alternatively, if on Windows and you have Diskuv OCaml, then:\n#   with-dkml opam install dkml-component-staging-opam\n```\n\nBe prepared to **wait several minutes** while one or more Opam is being\ncompiled for your machine.\n\n## Status\n\n[![Syntax check](https://github.com/diskuv/dkml-component-opam/actions/workflows/syntax.yml/badge.svg)](https://github.com/diskuv/dkml-component-opam/actions/workflows/syntax.yml)\n\n| Status                                                                                                                                                                              |\n| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [![Build tests](https://github.com/diskuv/dkml-component-opam/actions/workflows/dkml.yml/badge.svg)](https://github.com/diskuv/dkml-component-opam/actions/workflows/dkml.yml)      |\n| [![Syntax check](https://github.com/diskuv/dkml-component-opam/actions/workflows/syntax.yml/badge.svg)](https://github.com/diskuv/dkml-component-opam/actions/workflows/syntax.yml) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiskuv%2Fdkml-component-opam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiskuv%2Fdkml-component-opam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiskuv%2Fdkml-component-opam/lists"}