2018-07-23 16:16:55 +02:00
|
|
|
echoed=false
|
|
|
|
|
|
|
|
Vagrant.configure("2") do |config|
|
|
|
|
config.vm.box = "ubuntu/bionic64"
|
|
|
|
#config.disksize.size = "20GB"
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
config.vm.provider "virtualbox" do |v|
|
|
|
|
host = RbConfig::CONFIG['host_os']
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
# Give VM 1/4 system memory & access to all cpu cores on the host
|
|
|
|
if host =~ /darwin/
|
|
|
|
cpus = `sysctl -n hw.ncpu`.to_i
|
|
|
|
# sysctl returns Bytes and we need to convert to MB
|
|
|
|
mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
|
|
|
|
elsif host =~ /linux/
|
|
|
|
cpus = `nproc`.to_i
|
|
|
|
# meminfo shows KB and we need to convert to MB
|
|
|
|
mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
|
|
|
|
else
|
|
|
|
cpus = `wmic cpu get NumberOfCores`.split("\n")[2].to_i
|
|
|
|
mem = `wmic OS get TotalVisibleMemorySize`.split("\n")[2].to_i / 1024 /4
|
|
|
|
end
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
mem = mem / 1024 / 4
|
|
|
|
mem = [mem, 2048].max # Minimum 2048
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
if echoed === false
|
|
|
|
echoed=true
|
|
|
|
puts("Memory", mem)
|
|
|
|
puts("CPUs", cpus)
|
|
|
|
end
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
#v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/home_vagrant_lbry-android", "1"]
|
|
|
|
#v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
|
|
|
|
v.customize ["modifyvm", :id, "--memory", mem]
|
|
|
|
v.customize ["modifyvm", :id, "--cpus", cpus]
|
|
|
|
end
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
config.vm.synced_folder "./", "/home/vagrant/lbry-android"
|
2018-08-06 12:51:55 +02:00
|
|
|
|
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
config.vm.provision "shell", inline: <<-SHELL
|
|
|
|
dpkg --add-architecture i386
|
|
|
|
apt-get update
|
|
|
|
apt-get install -y libssl-dev
|
|
|
|
apt-get install -y autoconf libffi-dev pkg-config libtool build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 python-pip
|
|
|
|
pip install -f --upgrade setuptools pyopenssl
|
|
|
|
git clone https://github.com/lbryio/buildozer.git
|
|
|
|
cd buildozer
|
|
|
|
python2.7 setup.py install
|
|
|
|
cd ../
|
|
|
|
rm -rf ./buildozer
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
# Install additonal buildozer dependencies
|
|
|
|
sudo apt-get install cython
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
# Install node
|
|
|
|
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
|
|
|
|
sudo apt-get install -y nodejs
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
export HOME=/home/vagrant
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
cp $HOME/lbry-android/buildozer.spec.vagrant $HOME/lbry-android/buildozer.spec
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
mkdir -p cd $HOME/.buildozer/android/platform/
|
|
|
|
wget -q 'https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip' -P $HOME/.buildozer/android/platform/
|
|
|
|
wget -q 'https://dl.google.com/android/android-sdk_r23-linux.tgz' -P $HOME/.buildozer/android/platform/
|
2018-08-11 21:48:54 +02:00
|
|
|
wget -q 'https://dl.google.com/android/repository/platform-27_r01.zip' -P $HOME/.buildozer/android/platform/
|
2018-07-23 16:16:55 +02:00
|
|
|
wget -q 'https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip' -P $HOME/.buildozer/android/platform/
|
|
|
|
unzip -qq $HOME/.buildozer/android/platform/android-ndk-r13b-linux-x86_64.zip -d $HOME/.buildozer/android/platform/
|
|
|
|
rm $HOME/.buildozer/android/platform/android-ndk-r13b-linux-x86_64.zip
|
|
|
|
tar -xf $HOME/.buildozer/android/platform/android-sdk_r23-linux.tgz -C $HOME/.buildozer/android/platform/
|
|
|
|
rm $HOME/.buildozer/android/platform/android-sdk_r23-linux.tgz
|
|
|
|
mv $HOME/.buildozer/android/platform/android-sdk-linux $HOME/.buildozer/android/platform/android-sdk-23
|
|
|
|
unzip -qq $HOME/.buildozer/android/platform/android-23_r02.zip -d $HOME/.buildozer/android/platform/android-sdk-23/platforms
|
2018-08-11 21:48:54 +02:00
|
|
|
rm $HOME/.buildozer/android/platform/platform-27_r01.zip
|
|
|
|
mv $HOME/.buildozer/android/platform/android-sdk-23/platforms/android-8.1.0 $HOME/.buildozer/android/platform/android-sdk-23/platforms/android-27
|
2018-07-23 16:16:55 +02:00
|
|
|
mkdir -p $HOME/.buildozer/android/platform/android-sdk-23/build-tools
|
|
|
|
unzip -qq $HOME/.buildozer/android/platform/build-tools_r26.0.1-linux.zip -d $HOME/.buildozer/android/platform/android-sdk-23/build-tools
|
|
|
|
rm $HOME/.buildozer/android/platform/build-tools_r26.0.1-linux.zip
|
|
|
|
mv $HOME/.buildozer/android/platform/android-sdk-23/build-tools/android-8.0.0 $HOME/.buildozer/android/platform/android-sdk-23/build-tools/26.0.1
|
|
|
|
mkdir -p $HOME/.buildozer/android/platform/android-sdk-23/licenses
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
rm -rf $HOME/.buildozer/android/platform/android-sdk-23/tools
|
|
|
|
# https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
|
|
|
|
wget -q https://dl.google.com/android/repository/tools_r25.2.5-linux.zip
|
|
|
|
unzip -o -q ./tools_r25.2.5-linux.zip -d $HOME/.buildozer/android/platform/android-sdk-23/
|
|
|
|
rm sdk-tools-linux-3859397.zip
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > $HOME/.buildozer/android/platform/android-sdk-23/licenses/android-sdk-license
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
sudo chown -r vagrant $HOME
|
2018-08-06 12:51:55 +02:00
|
|
|
|
2018-07-23 16:16:55 +02:00
|
|
|
echo "Installing React Native via NPM..."
|
|
|
|
sudo npm install -g react-native-cli
|
|
|
|
SHELL
|
2018-08-06 12:51:55 +02:00
|
|
|
end
|