Duplicacy is written in Go. If you have Go installed you can run the following command to build from the latest source:
The following information is not currently accurate. See this post from the developer.
go get -u github.com/gilbertchen/duplicacy/...
The executable named duplicacy
will then be created under $GOPATH/bin
.
You can also build the executable manually after running the go get command.
cd $GOPATH/src/github.com/gilbertchen/duplicacy
go build duplicacy/duplicacy_main.go
The executable will be created under $GOPATH/src/github.com/gilbertchen/duplicacy
with the name duplicacy_main
.
To download the pre-built executable, please visit the releases page and select the binary that works for your platform.
Longer explanation of how to build from source
Click here
Buliding from source from a different branch is no easy task, so i think you shouldn’t do it if you don’t know git. Just take my word on it please.
: Note that i’m not giving any tips on how to git. Git is a complex program which can’t be explained in a short tutorial. If you try it you will need help. This tutorial will not teach you git. Git is between you and google – this is why i suggested sourcetree below.
If you just want to build duplicacy without any other bells and whistles (for example just to change 1 or 2 parameters like number of retries) then you don’t need to worry: all is presented below.
-
help:
-
download and install go and git and make them available in
PATH
-
set $GOPATH to whichever directory you want to use as workspace (if you don’t do this, go uses as default location
your_homefolder/go
) -
in cmd run
go get github.com/gilbertchen/duplicacy/duplicacy
3.5 wait until the command finishes (it has to download A LOT) of sources needed for building duplicacy (all the libraries which duplicacy depends on – for each supported storage and so on) -
after the download is finished,
cd
to the folder$GOPATH/src/github.com/gilbertchen/duplicacy
(see the similarity with the above github path? → this is how go manages libraries and dependencies). There are all the sources for duplicacy.- 4.5 if you want to build a different branch from
master
, now it’s the time! you have to pull the remote branch which has the changes you need into local master – I recommend using a good GUI: Sourcetree but you can do it from cmd as well. (you monster). - 4.6 If you want to modify something in the sources, you should do it at this step (eg.: modify the number of retries for some storage)
- 4.5 if you want to build a different branch from
-
now that you have the sources, you have to actually compile duplicacy: again in cmd
go install github.com/gilbertchen/duplicacy/duplicacy
-
compiling should take no more than 10 seconds. You will find the executable file in the folder
$GOPATH/bin/duplicacy.exe
Congratz!
Build on macOS
To build from source on macOS, Xcode must be installed because one of the dependency libraries, github.com/gilbertchen/keyring
requires cgo for security reasons (see #136 for details). If you don’t want to install Xcode, you can switch to github.com/tmc/keyring
(the original library that github.com/gilbertchen/keyring
was forked from) by modifying this line in src/duplicacy_keyring.go
:
"github.com/gilbertchen/keyring"
to
"github.com/twc/keyring"
Build from a fork
If you fork the repository github.com/gilbertchen/duplicacy
and clone the fork locally as github.com/yourusername/duplicacy
,
please remember that duplicacy/duplicacy_main.go
still imports from github.com/gilbertchen/duplicacy/src
,
so any changes you make under github.com/yourusername/duplicacy/src
will have no effect when building the executable.
Option 1
Therefore, the recommended way is to clone your fork into the original namespace:
git clone https://github.com/yourusername/duplicacy $GOPATH/src/github.com/gilbertchen/duplicacy
Option 2
There is one other option when working with a fork which is explained fully here.
The short version is:
- Make a normal github fork of duplicacy (so that you have
github.com/you/duplicacy
); - Clone original duplicacy:
go get github.com/gilbertchen/duplicacy
, and not your fork;- The repository is locally @
cd $GOPATH/src/github.com/gilbertchen/duplicacy
;
- The repository is locally @
- Add a remote to your fork in the cloned repository
git remote add fork https://github.com/you/duplicacy
noted above; - Instead of committing/pushing to
origin
(which is the originalgithub.com/gilbertchen/duplicacy
),
now you usefork
(which is your github repositorygithub.com/you/duplicacy
).
In this way, it is also very easy to test other people’s code: just add a new remote to $GOPATH/src/github.com/gilbertchen/duplicacy
(the original duplicacy clone) like you did in step 3. But just change the name fork
to something else.
Note about the second method: there is no clone of github.com/you/duplicacy
therefore there shouldn’t exist on your disk any folder
$GOPATH/src/github.com/you/duplicacy
.
Cross compile
An example for some NAS boxes - ARM, Debian with 64k pages:
cd $GOPATH/src/github.com/gilbertchen/duplicacy
env GOARCH=arm GOOS=linux go build -o duplicacy_linux64k_arm --ldflags "-R 65536" -v duplicacy/duplicacy_main.go