12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061(**************************************************************************)(* *)(* Copyright 2025 OCamlPro *)(* *)(* All rights reserved. This file is distributed under the terms of the *)(* GNU Lesser General Public License version 2.1, with the special *)(* exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)typesigning_identity=|AdHoc|DeveloperIDofstringtypesign_options={force:bool;timestamp:bool;entitlements:stringoption;}letdefault_sign_options={force=false;timestamp=false;entitlements=None;}letsign_binary?(options=default_sign_options)~identitybinary=tryletidentity_str=matchidentitywith|AdHoc->"-"|DeveloperIDcert_name->cert_nameinletargs:System.codesign_args={binary;identity=identity_str;force=options.force;timestamp=options.timestamp;entitlements=options.entitlements;}inSystem.call_unitSystem.CodesignargswithSystem.System_errore->OpamConsole.warning"codesign failed: %s"eletsign_binary_adhoc?(force=true)binary=letoptions={default_sign_optionswithforce}insign_binary~options~identity:AdHocbinaryletsign_binary_with_dev_id?(force=true)?(timestamp=true)~cert_namebinary=letoptions={default_sign_optionswithforce;timestamp}insign_binary~options~identity:(DeveloperIDcert_name)binaryletverify_signaturebinary=tryletargs:System.codesign_verify_args={binary;verbose=false;}inSystem.call_unitSystem.CodesignVerifyargs;truewithSystem.System_error_->false