This repository has been archived by the owner on Jan 27, 2020. It is now read-only.
forked from a-m-s/syncthing-inotify
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added XGO cross compilation support for Darwin
- Loading branch information
Showing
2 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env ruby | ||
|
||
targets = "darwin/amd64, | ||
dragonfly/amd64, | ||
freebsd/*, | ||
linux/*, | ||
netbsd/*, | ||
openbsd/*, | ||
windows/*" | ||
|
||
targets.gsub!(" ","").gsub!("\n","") | ||
|
||
version = `git describe --abbrev=0 --tags`.chomp | ||
diff = `git diff`.chomp | ||
|
||
#unless diff.empty? | ||
# puts "Forgot to git reset --hard?" | ||
# exit if gets.chomp != "n" | ||
#end | ||
|
||
vars = "GO386=387" | ||
ldflags = "-w -X main.Version=#{version}" | ||
build = "#{vars} xgo -v --targets=#{targets} -ldflags '#{ldflags}' ." | ||
puts "Running #{build}" | ||
#`#{build}` | ||
|
||
Dir.glob("syncthing-inotify-*").each do |file| | ||
next unless File.file?(file) | ||
next if file.include?(".tar.gz") | ||
name = "syncthing-inotify" | ||
if file.include?("windows") | ||
name = "syncthing-inotify.exe" | ||
end | ||
move = "cp #{file} #{name}" | ||
package = "tar -czf #{file}-#{version}.tar.gz #{name}" | ||
rm = "rm -f syncthing-inotify" | ||
#rm = "rm -f syncthing-inotify #{name}" | ||
puts "Packaging #{file}" | ||
`#{move} && #{package} | ||
& #{rm}` | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters