@@ -15,7 +15,8 @@ def packages_debianoid(user)
1515 apt-get -y -qq update
1616 apt-get -y -qq dist-upgrade
1717 # for building borgbackup and dependencies:
18- apt install -y libssl-dev libacl1-dev libxxhash-dev liblz4-dev libzstd-dev pkg-config
18+ apt install -y pkg-config
19+ apt install -y libssl-dev libacl1-dev libxxhash-dev liblz4-dev libzstd-dev || true
1920 apt install -y libfuse-dev fuse || true
2021 apt install -y libfuse3-dev fuse3 || true
2122 apt install -y locales || true
@@ -136,9 +137,95 @@ def packages_openindiana
136137 EOF
137138end
138139
140+
141+ # Build and install borg dependencies from source
142+ def install_source_dependencies ( user )
143+ return <<-EOF
144+ set -e -o pipefail
145+
146+ # Install in /usr/local
147+ export PREFIX=/usr/local
148+
149+ # Make PKG_CONFIG_PATH explicit, even if /usr/local/lib/pkgconfig is enabled per default
150+ export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
151+ echo 'export PKG_CONFIG_PATH="'${PKG_CONFIG_PATH}'"' >> ~#{ user } /.bash_profile
152+
153+ # All source packages integrate with pkg-config, remove any previous overrides
154+ sed -i '/BORG_.*_PREFIX/d' ~#{ user } /.bash_profile
155+
156+ # Setup pyenv to pick up the custom openssl version (python >= 3.9 requires openssl >= 1.1.1)
157+ echo 'export PYTHON_CONFIGURE_OPTS="--with-openssl='"${PREFIX}"' --with-openssl-rpath=auto"' >> ~#{ user } /.bash_profile
158+ echo 'export LDFLAGS=-Wl,-rpath,'"${PREFIX}"'/lib' >> ~#{ user } /.bash_profile
159+
160+ # Silence git warning about shallow clones
161+ git config --global advice.detachedHead false
162+
163+ # libattr
164+ VERSION_LIBATTR=2.5.1
165+ curl -s -L https://download.savannah.nongnu.org/releases/attr/attr-${VERSION_LIBATTR}.tar.gz | tar xvz --strip-components=1 --one-top-level=attr -f - -C ${PREFIX}/src
166+ cd ${PREFIX}/src/attr
167+ ./configure --prefix=${PREFIX}
168+ make -j$(nproc) install
169+
170+ # libacl
171+ VERSION_LIBACL=2.3.1
172+ curl -s -L https://download.savannah.nongnu.org/releases/acl/acl-${VERSION_LIBACL}.tar.gz | tar xvz --strip-components=1 --one-top-level=acl -f - -C ${PREFIX}/src
173+ cd ${PREFIX}/src/acl
174+ ./configure --prefix=${PREFIX}
175+ make -j$(nproc) install
176+
177+ # liblz4
178+ VERSION_LIBLZ4=1.9.4
179+ git -C ${PREFIX}/src clone --depth 1 --branch v${VERSION_LIBLZ4} https://github.com/lz4/lz4.git
180+ cd ${PREFIX}/src/lz4
181+ make -j$(nproc) install PREFIX=${PREFIX}
182+
183+ # libzstd
184+ VERSION_LIBZSTD=1.5.4
185+ git -C ${PREFIX}/src clone --depth 1 --branch v${VERSION_LIBZSTD} https://github.com/facebook/zstd.git
186+ cd ${PREFIX}/src/zstd
187+ make -j$(nproc) install PREFIX=${PREFIX}
188+
189+ # xxHash
190+ VERSION_LIBXXHASH=0.8.1
191+ git -C ${PREFIX}/src clone --depth 1 --branch v${VERSION_LIBXXHASH} https://github.com/Cyan4973/xxHash.git
192+ cd ${PREFIX}/src/xxHash
193+ make -j$(nproc) install PREFIX=${PREFIX}
194+
195+ # openssl
196+ VERSION_OPENSSL=1_1_1t
197+ git -C ${PREFIX}/src clone --depth 1 --branch OpenSSL_${VERSION_OPENSSL} https://github.com/openssl/openssl.git
198+ cd ${PREFIX}/src/openssl
199+ ./config --prefix=${PREFIX} --openssldir=${PREFIX}/lib/ssl
200+ make -j$(nproc)
201+ make -j$(nproc) install
202+
203+ # libfuse3 requires ninja
204+ VERSION_NINJA=1.11.1
205+ git -C ${PREFIX}/src clone --depth 1 --branch v${VERSION_NINJA} https://github.com/ninja-build/ninja.git
206+ cd ${PREFIX}/src/ninja
207+ python3 configure.py --bootstrap
208+ install --mode=755 --target-directory=${PREFIX}/bin ninja
209+
210+ # libfuse3 requires meson >= 0.50; python3.5 support is dropped in meson >= 0.57
211+ VERSION_MESON=0.56.2
212+ git -C ${PREFIX}/src clone --depth 1 --branch ${VERSION_MESON} https://github.com/mesonbuild/meson.git
213+ ln -s ${PREFIX}/src/meson/meson.py ${PREFIX}/bin/meson
214+
215+ # libfuse3
216+ VERSION_LIBFUSE=3.14.0
217+ git -C ${PREFIX}/src clone --depth 1 --branch fuse-${VERSION_LIBFUSE} https://github.com/libfuse/libfuse.git
218+ cd ${PREFIX}/src/libfuse
219+ mkdir build; cd build
220+ meson setup --prefix ${PREFIX} --libdir ${PREFIX}/lib ..
221+ ninja
222+ ninja install
223+ EOF
224+ end
225+
139226def install_pyenv ( boxname )
140227 return <<-EOF
141- echo 'export PYTHON_CONFIGURE_OPTS="--enable-shared"' >> ~/.bash_profile
228+ echo 'export PYTHON_CONFIGURE_OPTS="${PYTHON_CONFIGURE_OPTS} --enable-shared"' >> ~/.bash_profile
142229 echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
143230 echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
144231 . ~/.bash_profile
160247def install_pythons ( boxname )
161248 return <<-EOF
162249 . ~/.bash_profile
250+ echo "PYTHON_CONFIGURE_OPTS: ${PYTHON_CONFIGURE_OPTS}"
163251 pyenv install 3.11.2 # tests, binary build
164252 pyenv install 3.10.1 # tests
165253 pyenv install 3.9.1 # tests
@@ -330,6 +418,23 @@ Vagrant.configure(2) do |config|
330418 b . vm . provision "run tests" , :type => :shell , :privileged => false , :inline => run_tests ( "buster64" , ".*none.*" )
331419 end
332420
421+ config . vm . define "stretch64" do |b |
422+ b . vm . box = "debian/stretch64"
423+ b . vm . provider :virtualbox do |v |
424+ v . memory = 1024 + $wmem
425+ end
426+ b . vm . provision "fs init" , :type => :shell , :inline => fs_init ( "vagrant" )
427+ b . vm . provision "packages debianoid" , :type => :shell , :inline => packages_debianoid ( "vagrant" )
428+ b . vm . provision "install source dependencies" , :type => :shell , :privileged => true , :inline => install_source_dependencies ( "vagrant" )
429+ b . vm . provision "install pyenv" , :type => :shell , :privileged => false , :inline => install_pyenv ( "stretch64" )
430+ b . vm . provision "install pythons" , :type => :shell , :privileged => false , :inline => install_pythons ( "stretch64" )
431+ b . vm . provision "build env" , :type => :shell , :privileged => false , :inline => build_pyenv_venv ( "stretch64" )
432+ b . vm . provision "install borg" , :type => :shell , :privileged => false , :inline => install_borg ( "llfuse" )
433+ b . vm . provision "install pyinstaller" , :type => :shell , :privileged => false , :inline => install_pyinstaller ( )
434+ b . vm . provision "build binary with pyinstaller" , :type => :shell , :privileged => false , :inline => build_binary_with_pyinstaller ( "stretch64" )
435+ b . vm . provision "run tests" , :type => :shell , :privileged => false , :inline => run_tests ( "stretch64" , ".*none.*" )
436+ end
437+
333438 config . vm . define "freebsd64" do |b |
334439 b . vm . box = "generic/freebsd13"
335440 b . vm . provider :virtualbox do |v |
0 commit comments