Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/oui_lib/makeself_backend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,14 @@ let uninstall_script (ic : Installer_config.t) =
@ notify_uninstall_complete

let add_sos_to_bundle ~bundle_dir binary =
let sos = Ldd.get_sos OpamFilename.Op.(bundle_dir // binary) in
let binary = OpamFilename.Op.(bundle_dir // binary) in
let sos = Ldd.get_sos binary in
match sos with
| [] -> ()
| _ ->
let lib_dir = OpamFilename.Op.(bundle_dir / "lib") in
OpamFilename.mkdir lib_dir;
List.iter (fun so -> OpamFilename.copy_in so lib_dir) sos
let dst_dir = OpamFilename.dirname binary in
List.iter (fun so -> OpamFilename.copy_in so dst_dir) sos;
System.call_unit Patchelf (Set_rpath {rpath = "$ORIGIN"; binary})

let create_installer
~(installer_config : Installer_config.t) ~bundle_dir installer =
Expand Down
6 changes: 6 additions & 0 deletions src/oui_lib/system.ml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ type productbuild_args = {
output : OpamFilename.t;
}

type patchelf_args =
| Set_rpath of {rpath: string; binary: OpamFilename.t}

type _ command =
| Which : string command
| Cygcheck : string command
Expand All @@ -70,6 +73,7 @@ type _ command =
| CodesignVerify : codesign_verify_args command
| Pkgbuild : pkgbuild_args command
| Productbuild : productbuild_args command
| Patchelf : patchelf_args command

exception System_error of string

Expand Down Expand Up @@ -144,6 +148,8 @@ let call_inner : type a. a command -> a -> string * string list =
"--package"; OpamFilename.to_string package;
OpamFilename.to_string output
]
| Patchelf, (Set_rpath {rpath; binary}) ->
"patchelf", ["--set-rpath"; rpath; OpamFilename.to_string binary]

let gen_command_tmp_dir cmd =
Printf.sprintf "%s-%06x" (Filename.basename cmd) (Random.int 0xFFFFFF)
Expand Down
5 changes: 5 additions & 0 deletions src/oui_lib/system.mli
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ type productbuild_args = {
output : OpamFilename.t; (** Output .pkg file *)
}

(** Arguments for patchelf command *)
type patchelf_args =
| Set_rpath of {rpath: string; binary: OpamFilename.t}

(** External commands that could be called and handled by {b oui}. *)
type _ command =
| Which : string command (** {b which} command, to check programs availability *)
Expand All @@ -89,6 +93,7 @@ type _ command =
| CodesignVerify : codesign_verify_args command (** {b codesign --verify} command to verify code signatures *)
| Pkgbuild : pkgbuild_args command (** {b pkgbuild} command to create macOS component packages *)
| Productbuild : productbuild_args command (** {b productbuild} command to create macOS installer packages *)
| Patchelf : patchelf_args command

(** Calls given command with its arguments and parses output, line by line. Raises [System_error]
with command's output when command exits with non-zero exit status. *)
Expand Down
Loading