Commit Graph

32 Commits

Author SHA1 Message Date
Sebastian Lackner
2a010263f6 build.bash: Escape LDFLAGS before passing them to 'go build'.
This ensures that ./build.bash still works when the LDFLAGS environment
variable contains multiple options, e.g., LDFLAGS="-lpthread -lm". The
correct way of passing multiple options is discussed here:
https://github.com/golang/go/issues/6234

For some unknown reason, the method only works when -extldflags is the
last argument - is this a bug in Go?
2018-12-27 15:08:35 +01:00
Jakob Unterwurzacher
3cba378ad5 build.bash: support user-set LDFLAGS
As requested at https://github.com/rfjakob/gocryptfs/pull/280
2018-12-16 21:34:41 +01:00
Jakob Unterwurzacher
bf241ce77e build.bash: use -trimpath for reproducible builds
Support both Go 1.7...1.9 and Go 1.10 by checking the
version and using the appropropriate syntax.

We trim GOPATH/src and use both -gcflags and -asmflags like Debian does in
ab2bbcfc00/lib/Debian/Debhelper/Buildsystem/golang.pm (L465) .
2018-12-16 20:39:01 +01:00
Jakob Unterwurzacher
d32c149266 build.bash: respect SOURCE_DATE_EPOCH
SOURCE_DATE_EPOCH seems to be the standard env variable
for faking a build date for reproducible builds.
2018-12-16 20:16:12 +01:00
Jakob Unterwurzacher
182f4833ee build.bash: handle args containing spaces
Fixes ./build.bash -tags "enable_trezor without_openssl"
2018-08-15 23:17:44 +02:00
Jakob Unterwurzacher
39839ade70 Add source packaging script 2017-11-01 18:58:10 +01:00
Jakob Unterwurzacher
9a3791fbc1 build.bash: support VERSION file and vendored go-fuse
Prepares for the release of all-in-one source tarballs
that include all non-stdlib dependencies.
2017-11-01 16:09:47 +01:00
Jakob Unterwurzacher
830cbb7218 build.bash: make reproduceable builds easier
* Reduce the build time precision from seconds to days
* Allow to specify an arbitrary build date through an
  env variable
2017-09-06 21:41:22 +02:00
Jakob Unterwurzacher
e4fdb42496 build.bash: implement "you need Go 1.5" lockout in pure Go
As noticed by @riking, the logic in the bash script will break
when Go 1 version numbers reach double-digits.

Instead, use a build tag "!go1.5" to cause a syntax error:

  $ /opt/go1.4.3/bin/go build
  can't load package: package github.com/rfjakob/gocryptfs:
  go1.4.go:5:1: expected 'package', found 'STRING' "You need Go 1.5 or higher to compile gocryptfs!"

Fixes https://github.com/rfjakob/gocryptfs/issues/133
2017-08-02 23:41:20 +02:00
Jakob Unterwurzacher
f3965a4e4c build.bash: use plain "git describe" for go-fuse
go-fuse recently added a git tag - let's use it.
2017-06-20 18:59:48 +02:00
Jakob Unterwurzacher
966308eeb7 Drop Go 1.4 compatability code everywhere
Yields a nice reduction in code size.
2017-03-05 17:44:14 +01:00
Jakob Unterwurzacher
166c62fd21 build.bash: use $(go env GOPATH) 2017-02-20 21:26:18 +01:00
Jakob Unterwurzacher
1139c27c36 build.bash: deduplicate build call 2017-02-19 20:27:29 +01:00
Jakob Unterwurzacher
10361a907a build.bash: GOPATH may be unset since Go v1.8. Handle it. 2017-02-19 20:14:46 +01:00
Jakob Unterwurzacher
6c86afb5cd build-without-openssl: compile statically
$ ldd gocryptfs
not a dynamic executable
$ file gocryptfs
gocryptfs: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
2016-12-06 22:47:18 +01:00
Jakob Unterwurzacher
4e95d394cf build.bash: rename "GOPATH2" to "GOPATH1"
It's the 1st component of GOPATH, so call it like that.
2016-10-30 16:17:39 +01:00
Jakob Unterwurzacher
c7385b3681 build.bash: abort if we hit a known-bad go-fuse version
Also, standardize to "if [[ ]] ; then" style.
2016-10-30 16:17:00 +01:00
Jakob Unterwurzacher
56c0b19612 without_openssl: support compiling completely without openssl
Build helper script: build-without-openssl.bash
2016-10-04 09:51:14 +02:00
Jakob Unterwurzacher
3a9bd92754 xray: add "gocryptfs-xray", on-disk-format exploration tool
Example output for a file encrypted in reverse mode:

Header: Version: 2, Id: 0b7f5e2574e4afa859a9bb156a2e7772
Block  0: IV: 0b7f5e2574e4afa859a9bb156a2e7773, Tag: bf39279ac6b1ccd852567aaf26ee386b, Len: 4128
Block  1: IV: 0b7f5e2574e4afa859a9bb156a2e7774, Tag: a4f0f9cde7f70a752254aa8fe7718699, Len: 4128
Block  2: IV: 0b7f5e2574e4afa859a9bb156a2e7775, Tag: b467b153016fc1d531818b65ab9e24f6, Len: 4128
Block  3: IV: 0b7f5e2574e4afa859a9bb156a2e7776, Tag: 1fcb7ffd8f1816fbe807df8148718a5c, Len: 4128
Block  4: IV: 0b7f5e2574e4afa859a9bb156a2e7777, Tag: a217e7933ef434c9f03ad931bb5fde9b, Len: 4128
Block  5: IV: 0b7f5e2574e4afa859a9bb156a2e7778, Tag: f3e6240d75cd66371a0b301111d6f1fc, Len: 4128
Block  6: IV: 0b7f5e2574e4afa859a9bb156a2e7779, Tag: bc85d322ebc7761ae5ef114ea3903a56, Len: 4128
Block  7: IV: 0b7f5e2574e4afa859a9bb156a2e777a, Tag: efda01c6b794690f939a12d6d49ac3af, Len: 4128
Block  8: IV: 0b7f5e2574e4afa859a9bb156a2e777b, Tag: b198329d489d1392080f710206932ff0, Len: 2907
2016-09-25 16:43:17 +02:00
Jakob Unterwurzacher
0d5d6fc99b main: bake build date into version string
$ gocryptfs -version
gocryptfs v0.12-36-ge021b9d-dirty; go-fuse a4c968c; 2016-07-03 go1.6.2
2016-07-03 16:50:52 +02:00
Jakob Unterwurzacher
ffc000943b build.bash: support colon-separated GOPATH variable
Fixes issue #31
https://github.com/rfjakob/gocryptfs/issues/31
2016-06-29 22:27:32 +02:00
Jakob Unterwurzacher
af07866e08 build.bash: check if the go-fuse tree is dirty
If it is, append "-dirty" to the hash.
2016-06-19 20:35:28 +02:00
Jakob Unterwurzacher
1dcafb99ff main: drop "on-disk format" from -version output, add Go version
As v0.4 introduced ext4-style feature flags, the on-disk format version
is unlinkely to change. Drop it from the version output to reduce
clutter. Use "gocryptfs -version -debug" to see it.

Add the Go version string because only Go 1.6 and newer have an optimized
AES-GCM implementation. This will help users to understand the performance
of their build.
2016-06-19 19:33:15 +02:00
Jakob Unterwurzacher
a2c73cfde5 build.bash: fail early if the go binary does not exist
This used to fail in an ugly way:

  $ ./build.bash
  ./build.bash: line 13: go: command not found
  ./build.bash: line 15: [: too many arguments
  ./build.bash: line 20: go: command not found
2016-06-14 22:56:28 +02:00
Jakob Unterwurzacher
bb16f2d565 build.bash: replace "git -C"
"-C" is not supported on older git versions. Instead, just cd into
the directory.

See issue #20.
2016-04-28 08:41:39 +02:00
Jakob Unterwurzacher
36c1039228 build.bash: bake the go-fuse commit hash into the binaries 2016-04-10 23:16:09 +02:00
Jakob Unterwurzacher
f5fe140d5b build.bash: copy binary to $GOPATH/bin 2016-01-09 15:31:34 +01:00
Jakob Unterwurzacher
57b32a0b8b Make build.bash work when called from outside the gocryptfs directory 2015-12-20 17:44:11 +01:00
Jakob Unterwurzacher
38f7dc1a17 Make build.bash version bake-in compatible with Go 1.3 and 1.4 2015-12-20 17:30:10 +01:00
Jakob Unterwurzacher
3f490d4d86 Bake version string into binary, add "--version" switch
Example:

	./gocryptfs -version
	gocryptfs v0.2-20-gabcef9e-dirty; on-disk format 1

Note that you MUST compile using "./build.bash" for this to work.
2015-11-01 14:04:29 +01:00
Jakob Unterwurzacher
5dc7e44aa2 Move main files to top level dir
This is in preparation of getting rid of the shell wrapper
2015-10-11 17:14:18 +02:00
Jakob Unterwurzacher
440abcbac6 Add test.bash
...also adapt the cryptfs tests for 256 bit long keys
2015-10-07 22:09:34 +02:00