Skip to content

Commit

Permalink
Merge branches 'refactor/binstall', 'refactor/clean-extract', 'update…
Browse files Browse the repository at this point in the history
…/git', 'update/github-release', 'update/openssl', 'update/nethack', 'refactor/install.sh', 'refactor/xz-mt', 'update/binaries', 'fp/xproto', 'fp/libx11', 'update/sshfs-fuse', 'refactor/install.sh-var', 'update/perl', 'update/glib' and 'update/bc' into work
  • Loading branch information
jam7 committed Jul 27, 2017
Show file tree
Hide file tree
Showing 55 changed files with 867 additions and 26 deletions.
51 changes: 50 additions & 1 deletion crew
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CREW_NOT_STRIP = ENV["CREW_NOT_STRIP"]
# Set XZ_OPT environment variable for build command.
# If CREW_XZ_OPT is defined, use it by default. Use `-7e`, otherwise.
if ENV["CREW_XZ_OPT"].to_s == ''
ENV["XZ_OPT"] = "-7e"
ENV["XZ_OPT"] = "-7e -T #{CREW_NPROC}"
else
ENV["XZ_OPT"] = ENV["CREW_XZ_OPT"]
end
Expand Down Expand Up @@ -188,6 +188,10 @@ def help (pkgName)
puts "Build a package."
puts "Usage: crew build [package]"
puts "Build [package] from source and place the archive and checksum in the current working directory."
when "binstall"
puts "Build and install a package."
puts "Usage: crew binstall [package]"
puts "Build and install [package] from source and place the archive and checksum in the current working directory."
when "download"
puts "Download a package."
puts "Usage: crew download [package]"
Expand Down Expand Up @@ -383,6 +387,7 @@ def unpack (meta)
target_dir = nil
Dir.chdir CREW_BREW_DIR do
puts "Unpacking archive, this may take a while..."
system "rm", "-rf", "#{extract_dir}"
Dir.mkdir("#{extract_dir}") unless Dir.exist?("#{extract_dir}")
if meta[:filename][-4,4] == ".zip"
system "unzip", "-qq", "-d", "#{extract_dir}", meta[:filename]
Expand Down Expand Up @@ -640,6 +645,43 @@ def resolve_dependencies_and_build
end
end

def resolve_dependencies_and_build_and_install
begin
origin = @pkg.name

# mark current package as which is required to compile from source
@pkg.build_from_source = true
resolve_dependencies

search origin, true
build_package Dir.pwd
if @device[:installed_packages].any? { |pkg| pkg[:name] == @pkg.name }
puts "Removing since forcing install..."
remove @pkg.name
end
puts "Installing..."
install_package CREW_DEST_DIR

#add to installed packages
@device[:installed_packages].push(name: @pkg.name, version: @pkg.version)
File.open(CREW_CONFIG_PATH + 'device.json', 'w') do |file|
output = JSON.parse @device.to_json
file.write JSON.pretty_generate(output)
end
puts "#{@pkg.name.capitalize} installed!"
rescue InstallError => e
abort "#{@pkg.name} failed to build: #{e.to_s}"
ensure
#cleanup
unless ARGV[2] == 'keep'
Dir.chdir CREW_BREW_DIR do
system "rm -rf *"
system "mkdir dest" #this is a little ugly, feel free to find a better way
end
end
end
end

def build_package (pwd)
abort "It is not possible to build fake package".lightred if @pkg.is_fake?
abort "It is not possible to build without source".lightred if !@pkg.is_source?(@device[:architecture])
Expand Down Expand Up @@ -774,6 +816,13 @@ when "build"
else
help "build"
end
when "binstall"
if @pkgName
search @pkgName
resolve_dependencies_and_build_and_install
else
help "binstall"
end
when "remove"
if @pkgName
remove @pkgName
Expand Down
16 changes: 15 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ case "$architecture" in
exit 1;;
esac

#This will allow things to work without sudo
# This will allow things to work without sudo
sudo chown -R `id -u`:`id -g` /usr/local

# On chromiumos/cloudready there is unnecessary symbolic link, so remove it.
if [ -L /usr/local/var ]; then sudo rm /usr/local/var; fi

#prepare directories
for dir in $CREW_LIB_PATH $CREW_CONFIG_PATH $CREW_CONFIG_PATH/meta $CREW_BREW_DIR $CREW_DEST_DIR $CREW_PACKAGES_PATH; do
mkdir -p $dir
Expand Down Expand Up @@ -182,3 +185,14 @@ echo crew >> .git/info/sparse-checkout
git fetch origin master
git reset --hard origin/master
echo "Chromebrew installed successfully and package lists updated."

#check LD_LIBRARY_PATH on x86_64
case "$architecture" in
"x86_64")
(echo $LD_LIBRARY_PATH | grep '/usr/local/lib[^6]\|/usr/local/lib$' > /dev/null) || cat << EOF
Several packages may install their libraries into $CREW_PREFIX/lib, so adding below to your ~/.bash_profile is recommended.
export LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
EOF
;;
esac
17 changes: 17 additions & 0 deletions packages/applewmproto.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'package'

class Applewmproto < Package
description 'The protocols for the X window system provide extended functionality for communication between a X client and the server.'
homepage 'https://x.org'
version '1.4.2'
source_url 'https://www.x.org/archive/individual/proto/applewmproto-1.4.2.tar.gz'
source_sha256 'ff8ac07d263a23357af2d6ff0cca3c1d56b043ddf7797a5a92ec624f4704df2e'

def self.build
system "./configure"
end

def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
1 change: 1 addition & 0 deletions packages/bc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Bc < Package
depends_on 'readline'
depends_on 'flex' => :build
depends_on 'ed' => :build
depends_on 'texinfo' => :build

def self.build
system "./configure", "--with-readline"
Expand Down
17 changes: 17 additions & 0 deletions packages/bigreqsproto.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'package'

class Bigreqsproto < Package
description 'The protocols for the X window system provide extended functionality for communication between a X client and the server.'
homepage 'https://x.org'
version '1.1.2'
source_url 'https://www.x.org/archive/individual/proto/bigreqsproto-1.1.2.tar.gz'
source_sha256 'de68a1a9dd1a1219ad73531bff9f662bc62fcd777387549c43cd282399f4a6ea'

def self.build
system "./configure"
end

def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
17 changes: 17 additions & 0 deletions packages/compositeproto.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'package'

class Compositeproto < Package
description 'The protocols for the X window system provide extended functionality for communication between a X client and the server.'
homepage 'https://x.org'
version '0.4'
source_url 'https://www.x.org/archive/individual/proto/compositeproto-0.4.tar.gz'
source_sha256 '1607f58409185203077de59801970b07a36f41e586a499918284c8d768d870cc'

def self.build
system "./configure"
end

def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
12 changes: 12 additions & 0 deletions packages/curl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ class Curl < Package
version '7.54.1'
source_url 'https://curl.haxx.se/download/curl-7.54.1.tar.bz2'
source_sha256 'fdfc4df2d001ee0c44ec071186e770046249263c491fcae48df0e1a3ca8f25a0'
binary_url ({
aarch64: 'https://github.com/jam7/chrome-cross/releases/download/v1.8/curl-7.54.1-chromeos-armv7l.tar.xz',
armv7l: 'https://github.com/jam7/chrome-cross/releases/download/v1.8/curl-7.54.1-chromeos-armv7l.tar.xz',
i686: 'https://github.com/jam7/chrome-cross/releases/download/v1.8/curl-7.54.1-chromeos-i686.tar.xz',
x86_64: 'https://github.com/jam7/chrome-cross/releases/download/v1.8/curl-7.54.1-chromeos-x86_64.tar.xz',
})
binary_sha256 ({
aarch64: 'a4e20f96eb21adf6acfcacffa5ea6cf30765e3146cb6326660a1e1a40c25381f',
armv7l: 'a4e20f96eb21adf6acfcacffa5ea6cf30765e3146cb6326660a1e1a40c25381f',
i686: 'e25ef8822c7d5d2a58ef22f7130c348e152e6cec4a6a0512ad4a38a31ef1d07c',
x86_64: '9840d2be7063109cc854296db2bfde63b6777d50016f50a5fb029bb6c685f0bd',
})

depends_on 'openssl' => :build
depends_on 'zlibpkg' => :build
Expand Down
17 changes: 17 additions & 0 deletions packages/damageproto.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'package'

class Damageproto < Package
description 'The protocols for the X window system provide extended functionality for communication between a X client and the server.'
homepage 'https://x.org'
version '1.2.1'
source_url 'https://www.x.org/archive/individual/proto/damageproto-1.2.1.tar.gz'
source_sha256 'f65ccbf1de9750a527ea6e85694085b179f2d06495cbdb742b3edb2149fef303'

def self.build
system "./configure"
end

def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
17 changes: 17 additions & 0 deletions packages/dmxproto.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'package'

class Dmxproto < Package
description 'The protocols for the X window system provide extended functionality for communication between a X client and the server.'
homepage 'https://x.org'
version '2.3'
source_url 'https://www.x.org/archive/individual/proto/dmxproto-2.3.tar.gz'
source_sha256 'a911a086a61c1bb16d35f70b391f167744ee721b5e2a7f22c00bc5a2c1ecb242'

def self.build
system "./configure"
end

def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
17 changes: 17 additions & 0 deletions packages/dri2proto.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'package'

class Dri2proto < Package
description 'The protocols for the X window system provide extended functionality for communication between a X client and the server.'
homepage 'https://x.org'
version '2.8'
source_url 'https://www.x.org/archive/individual/proto/dri2proto-2.8.tar.gz'
source_sha256 '7e65b031eaa6ebe23c75583d4abd993ded7add8009b4200a4db7aa10728b0f61'

def self.build
system "./configure"
end

def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
17 changes: 17 additions & 0 deletions packages/dri3proto.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'package'

class Dri3proto < Package
description 'The protocols for the X window system provide extended functionality for communication between a X client and the server.'
homepage 'https://x.org'
version '1.0'
source_url 'https://www.x.org/archive/individual/proto/dri3proto-1.0.tar.gz'
source_sha256 'e1a0dad3009ecde52c0bf44187df5f95cc9a7cc0e76dfc2f2bbf3e909fe03fa9'

def self.build
system "./configure"
end

def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
17 changes: 17 additions & 0 deletions packages/fixesproto.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'package'

class Fixesproto < Package
description 'The protocols for the X window system provide extended functionality for communication between a X client and the server.'
homepage 'https://x.org'
version '5.0'
source_url 'https://www.x.org/archive/individual/proto/fixesproto-5.0.tar.gz'
source_sha256 '67865a0e3cdc7dec1fd676f0927f7011ad4036c18eb320a2b41dbd56282f33b8'

def self.build
system "./configure"
end

def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
17 changes: 17 additions & 0 deletions packages/fontcacheproto.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'package'

class Fontcacheproto < Package
description 'The protocols for the X window system provide extended functionality for communication between a X client and the server.'
homepage 'https://x.org'
version '0.13'
source_url 'https://www.x.org/archive/individual/proto/fontcacheproto-0.1.3.tar.gz'
source_sha256 '759b4863b55a25bfc8f977d8ed969da0b99b3c823f33c674d6da5825f9df9a79'

def self.build
system "./configure"
end

def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
17 changes: 17 additions & 0 deletions packages/fontsproto.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'package'

class Fontsproto < Package
description 'The protocols for the X window system provide extended functionality for communication between a X client and the server.'
homepage 'https://x.org'
version '2.1.3'
source_url 'https://www.x.org/archive/individual/proto/fontsproto-2.1.3.tar.gz'
source_sha256 '72c44e63044b2b66f6fa112921621ecc20c71193982de4f198d9a29cda385c5e'

def self.build
system "./configure"
end

def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
15 changes: 11 additions & 4 deletions packages/fuse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
class Fuse < Package
description 'The reference implementation of the Linux FUSE (Filesystem in Userspace) interface.'
homepage 'https://github.com/libfuse/libfuse'
version '2.9.7'
source_url 'https://github.com/libfuse/libfuse/releases/download/fuse-2.9.7/fuse-2.9.7.tar.gz'
source_sha256 '832432d1ad4f833c20e13b57cf40ce5277a9d33e483205fc63c78111b3358874'
# The version of libfuse need to be matched with ChromeOS /usr/lib/libfuse.so since we must use
# /sbin/mount.fuse which is not possible to be overwritten. If we use different version of
# libfuse, it may cause errors. Chrome OS 59 and 60 use libfuse 2.8.6.
version '2.8.6'
source_url 'https://github.com/libfuse/libfuse/releases/download/fuse_2_9_4/fuse-2.8.6.tar.gz'
source_sha256 '1ec1913e38f09b2a9ec1579e1800805b5e2c747d1dce515e316dbb665ca139d6'

def self.build
system "./configure"
# Disable util since we must use pre-installed /sbin/mount.fuse
system "./configure", "--libdir=#{CREW_LIB_PREFIX}", "--enable-shared", "--disable-static", "--with-pic", "--disable-util"
# A workaround to "'CLONE_NEWNS' undeclared" error. See below for details.
# https://github.com/libfuse/libfuse/commit/ae43094c13ecf49e0b738bbda633cf193c7b3670
system "sed -i util/fusermount.c -e '1i#define _GNU_SOURCE'"
system "make"
end

Expand Down
2 changes: 1 addition & 1 deletion packages/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Git < Package
depends_on 'python27' => :build # requires python2

# need to build using single core
@make_cmd = "make -j1 prefix=/usr/local CC=gcc PERL_PATH=/usr/local/bin/perl PYTHON_PATH=/usr/local/bin/python2"
@make_cmd = "make -j1 prefix=/usr/local CC=gcc PERL_PATH=/usr/local/bin/perl PYTHON_PATH=/usr/local/bin/python2 NO_PTHREADS="

def self.build
system "#{@make_cmd} all"
Expand Down
2 changes: 2 additions & 0 deletions packages/glib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class Glib < Package

depends_on 'libffi'
depends_on 'gettext'
depends_on 'zlibpkg'
depends_on 'python27'

def self.build
system "./configure"
Expand Down
17 changes: 17 additions & 0 deletions packages/glproto.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'package'

class Glproto < Package
description 'The protocols for the X window system provide extended functionality for communication between a X client and the server.'
homepage 'https://x.org'
version '1.4.17'
source_url 'https://www.x.org/archive/individual/proto/glproto-1.4.17.tar.gz'
source_sha256 '9d8130fec2b98bd032db7730fa092dd9dec39f3de34f4bb03ceb43b9903dbc96'

def self.build
system "./configure"
end

def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
17 changes: 17 additions & 0 deletions packages/inputproto.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'package'

class Inputproto < Package
description 'The protocols for the X window system provide extended functionality for communication between a X client and the server.'
homepage 'https://x.org'
version '2.3'
source_url 'https://www.x.org/archive/individual/proto/inputproto-2.3.tar.gz'
source_sha256 '98e8ab87fb71080b28536d749aa942bdad13d860d5eb3e1271084906cda711e9'

def self.build
system "./configure"
end

def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
Loading

0 comments on commit eefc758

Please sign in to comment.