Files
chromebrew/packages/git.rb
Satadru Pramanik, DO, MPH, MEng 9ce8a50720 qt => qt5_, add package rename and old package deletion functionality. (#8803)
* qt => qt5 renames

* update qt5 => qt5_

* update packages

* change more deps

* change gstreamer deps

* more name changes and cleanups

* add binaries for qt5_declarative

* fixup qtfm

* add qt5_wayland binary

* cleanup

* add some binaries

* add qt5_base binary

* add binaries

* add logic for reporting packages needing cleanup

* add color

* update qt5_webengine package file

* add more qt5 binaries

* Add back qtcreator

* add binaries for qt5_wayland

* update version of qtcreator

* Use CREW_LINKER during qmake

* mold, fileutils adjustments

* Add initial code for renaming packages

* more verbose messages

* add help comment

* testing writing fixed up device.json

* more fixup adjustments, remove gnome_icon_theme dep... this takes forever to install

* suggested changes

* suggested changes

* update adwaita_icon_theme

* add x86_64 binary for qt5_webengine

* add jellyfin_media_player build

* Add comments field to pkg fixup data array

* Add deprecated package removal code

* use pkgName not @pkg.name in remove

* capitalize and adjust rescue code

* fix pkg deprecation check logic

* add qt rename message

* print comment for renaming

* adjust coloring, move rename message to after rename succeeds

* add spacing

* use lightcyan

* use lightpurple

* bumping major version

* add other qbittorrent deps

* add arm binaries for qt5_webengine

* adjust some deps

* add jellyfin_media_player build

* suggested changes

* suggested changes, add qmake to buildsystems
2023-10-23 16:28:32 -05:00

95 lines
4.6 KiB
Ruby

require 'package'
class Git < Package
description 'Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.'
homepage 'https://git-scm.com/'
version '2.42.0' # Do not use @_ver here, it will break the installer.
license 'GPL-2'
compatibility 'all'
source_url 'https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.42.0.tar.xz'
source_sha256 '3278210e9fd2994b8484dd7e3ddd9ea8b940ef52170cdb606daa94d887c93b0d'
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/git/2.42.0_armv7l/git-2.42.0-chromeos-armv7l.tar.zst',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/git/2.42.0_armv7l/git-2.42.0-chromeos-armv7l.tar.zst',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/git/2.42.0_i686/git-2.42.0-chromeos-i686.tar.zst',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/git/2.42.0_x86_64/git-2.42.0-chromeos-x86_64.tar.zst'
})
binary_sha256({
aarch64: '56b4f6bae6c88f53ef6931aeb31551acb3ef58015c35a95be1b1fb9ba9c7a286',
armv7l: '56b4f6bae6c88f53ef6931aeb31551acb3ef58015c35a95be1b1fb9ba9c7a286',
i686: '12af2f3039f871e4b76cb9b91d9f1027974f36dabe99a15ac758610af9aff12e',
x86_64: 'db1dd6dd3356b30dd619d75b9fa100756094a96a7dedf2e9b77a99c012469e35'
})
depends_on 'ca_certificates' => :build
depends_on 'curl' # R
depends_on 'expat' # R
depends_on 'glibc' # R
depends_on 'libunistring' # R
depends_on 'pcre2' # R
depends_on 'zlibpkg' # R
def self.patch
# Patch to prevent error function conflict with libidn2
# By replacing all calls to error with git_error.
system "sed -i 's,^#undef error$,#undef git_error,' usage.c"
sedcmd = 's/\([[:blank:]]\)error(/\1git_error(/'.dump
system "grep -rl '[[:space:]]error(' . | xargs sed -i #{sedcmd}"
sedcmd2 = 's/\([[:blank:]]\)error (/\1git_error (/'.dump
system "grep -rl '[[:space:]]error (' . | xargs sed -i #{sedcmd2}"
system "grep -rl ' !!error(' . | xargs sed -i 's/ !!error(/ !!git_error(/g'"
system "sed -i 's/#define git_error(...) (error(__VA_ARGS__), const_error())/#define git_error(...) (git_error(__VA_ARGS__), const_error())/' git-compat-util.h"
# CMake patches.
# Avoid undefined reference to `trace2_collect_process_info' & `obstack_free'
system "sed -i 's,compat_SOURCES unix-socket.c unix-stream-server.c,compat_SOURCES unix-socket.c unix-stream-server.c compat/linux/procinfo.c compat/obstack.c,g' contrib/buildsystems/CMakeLists.txt"
# The VCPKG optout in this CmakeLists.txt file is quite broken.
system "sed -i 's/set(USE_VCPKG/#set(USE_VCPKG/g' contrib/buildsystems/CMakeLists.txt"
system "sed -i 's,set(PERL_PATH /usr/bin/perl),set(PERL_PATH #{CREW_PREFIX}/bin/perl),g' contrib/buildsystems/CMakeLists.txt"
system "sed -i 's,#!/usr/bin,#!#{CREW_PREFIX}/bin,g' contrib/buildsystems/CMakeLists.txt"
# Without the following DESTDIR doesn't work.
system "sed -i 's,${CMAKE_INSTALL_PREFIX}/bin/git,${CMAKE_BINARY_DIR}/git,g' contrib/buildsystems/CMakeLists.txt"
system "sed -i 's,${CMAKE_INSTALL_PREFIX}/bin/git,\\\\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/git,g' contrib/buildsystems/CMakeLists.txt"
system "sed -i 's,${CMAKE_INSTALL_PREFIX},\\\\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX},g' contrib/buildsystems/CMakeLists.txt"
end
def self.build
system "mold -run cmake -B builddir \
#{CREW_CMAKE_OPTIONS} \
-DUSE_VCPKG=FALSE \
-Wdev \
-G Ninja \
contrib/buildsystems"
system "#{CREW_NINJA} -C builddir"
end
def self.install
system "DESTDIR=#{CREW_DEST_DIR} #{CREW_NINJA} -C builddir install"
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/share/git-completion"
FileUtils.cp_r Dir.glob('contrib/completion/.'), "#{CREW_DEST_PREFIX}/share/git-completion/"
File.write 'git_bashd_env', <<~GIT_BASHD_EOF
# git bash completion
source #{CREW_PREFIX}/share/git-completion/git-completion.bash
GIT_BASHD_EOF
FileUtils.install 'git_bashd_env', "#{CREW_DEST_PREFIX}/etc/bash.d/git", mode: 0o644
end
def self.check
# Check to see if linking libcurl worked, which means
# git-remote-https should exist
unless File.symlink?("#{CREW_DEST_PREFIX}/libexec/git-core/git-remote-https") ||
File.exist?("#{CREW_DEST_PREFIX}/libexec/git-core/git-remote-https")
abort 'git-remote-https is broken'.lightred
end
end
def self.postinstall
return unless File.directory?("#{CREW_PREFIX}/lib/crew/.git")
puts 'Running git garbage collection...'.lightblue
system 'git gc', chdir: "#{CREW_PREFIX}/lib/crew", exception: false
end
end