Skip to content

Commit da034f6

Browse files
committed
Fix permissions while packaging binaries
1 parent 7966189 commit da034f6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

script/repackage-dylibs.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,25 @@ def repackage_dependency(dep)
7979
note "Packaging #{dep.name}…"
8080

8181
FileUtils.mkdir(TARGET_FRAMEWORKS_PATH) unless Dir.exist?(TARGET_FRAMEWORKS_PATH)
82+
packaged_path = File.join(TARGET_FRAMEWORKS_PATH, dep.name)
8283

8384
case dep.type
8485
when ".dylib"
85-
if File.exist?(File.join(TARGET_FRAMEWORKS_PATH, dep.name))
86+
if File.exist? packaged_path
8687
warn "#{dep.path} already in Frameworks directory, removing"
87-
FileUtils.rm File.join(TARGET_FRAMEWORKS_PATH, dep.name)
88+
FileUtils.rm packaged_path
8889
end
8990

9091
note "Copying #{dep[:path]} to TARGET_FRAMEWORKS_PATH"
9192
FileUtils.cp dep[:path], TARGET_FRAMEWORKS_PATH
93+
FileUtils.chmod "u=rw", packaged_path
9294

9395
out = `install_name_tool -change #{dep.path} "@rpath/#{dep.name}" #{dep.executable}`
9496
if $? != 0
9597
err "install_name_tool failed with error #{$?}:\n#{out}"
9698
end
9799

98-
dep.path = File.join(TARGET_FRAMEWORKS_PATH, dep.name)
100+
dep.path = packaged_path
99101
dep.install_name = "@rpath/#{dep.name}"
100102
dep.is_packaged = true
101103
else

0 commit comments

Comments
 (0)