On Sun, Nov 05, 2023 at 10:09:44AM -0500, James McCoy wrote: > The former is fine with me. I took a quick look at what Fedora is > doing, and it looks like they just patch setup.py to return from > build_static_kittens() just before the “go build -v” line. > > Adding a patch for that and then adapting the rest of the Debian side of > the build to do it seems reasonable.
Right. So I have an update for you. I have attached a patch on top of MR!3 [1] with this mail which gets the go parts (static kitten binary) building for me \o/. I wanted to commit directly but admittedly the non-gbp flow is confusing for me so I left figuring this out for later. I tried testing it locally and so far it does work as I expect it to. I did the following changes: * GO111MODULE should be turned off for debian specific builds otherwise it tries to fetch packages from the internet which is forbiden in build. * Add dh_auto_configure for go counterpart as it'd initialize a _build directory with symlink to all packages. This saves us from some of the manual work which is done for example in[2]. * Added a corresponding clean directive too so as to cleanup _build * I realised using dh_auto_build with go profiles is not something that works smoothly as it expects go files in 'kitty/' and it has none. There are a couple of other caveats too, so using 'go build ....' works better. * Copied some generated header files in python counter part's build to _build directory * Since some files did not get copied by go's dh_auto_configure they have been specified in DH_GOLANG_INSTALL_EXTRA * Added a patch to ignore checking go version from go.mod as go list -m does not work with GO111MODULE set to off. This needs to be adjusted in d/control anyway * Added kitten binary in d/kitten.install * Add a XS-Go-Import-Path field in d/control in accordance with the package name in go.mod * Update build deps and add versioned B-D on exp-dev -> Note that exp-dev needs to be updated in debian. Since this is a key package I have pinged the maintainer (on IRC) to do it. For this build, I locally updated this and a couple other packages in the chain. You can use the .debs for these from here[3] -> I skipped the tests in d/rules as python specific stuff fails. I leave the onus of fixing this on you :) I hope this helps! [1]: https://salsa.debian.org/debian/kitty/-/merge_requests/3 [2]: https://sources.debian.org/src/ncbi-entrez-direct/19.2.20230331+dfsg-3/debian/rules/ [3]: https://people.debian.org/~nilesh/kitty/ Best, Nilesh
commit 281201ccddfee95a606d82e1860fa3ea73d355fd Author: Nilesh Patra <nil...@debian.org> Date: Mon Nov 6 03:05:17 2023 +0530 Changes to get kitten building diff --git a/debian/control b/debian/control index 3258bcc61..66ceda63c 100644 --- a/debian/control +++ b/debian/control @@ -4,6 +4,7 @@ Maintainer: James McCoy <james...@debian.org> Section: x11 Standards-Version: 4.6.2 Rules-Requires-Root: no +XS-Go-Import-Path: kitty Homepage: https://sw.kovidgoyal.net/kitty/ Vcs-Git: https://salsa.debian.org/debian/kitty.git Vcs-Browser: https://salsa.debian.org/debian/kitty @@ -17,7 +18,7 @@ Build-Depends: furo <!nodoc>, golang-any, golang-github-altree-bigfloat-dev, - golang-github-alecthomas-chroma-dev, + golang-github-alecthomas-chroma-v2-dev, golang-github-bmatcuk-doublestar-dev, golang-github-disintegration-imaging-dev, golang-github-dlclark-regexp2-dev, @@ -26,7 +27,7 @@ Build-Depends: golang-github-seancfoley-ipaddress-go-dev, golang-github-shirou-gopsutil-dev, golang-github-zeebo-xxh3-dev, - golang-golang-x-exp-dev, + golang-golang-x-exp-dev (>= 0.0~git20230801), golang-golang-x-image-dev, golang-golang-x-sys-dev, golang-howett-plist-dev, diff --git a/debian/kitty.install b/debian/kitty.install index fe49de93f..63b03ef63 100644 --- a/debian/kitty.install +++ b/debian/kitty.install @@ -1,4 +1,5 @@ debian/tmp/usr/bin/kitty +debian/tmp/usr/bin/kitten debian/tmp/usr/lib/ debian/tmp/usr/share/applications/kitty.desktop debian/tmp/usr/share/icons/ diff --git a/debian/patches/fix-version.patch b/debian/patches/fix-version.patch new file mode 100644 index 000000000..063c9d7d6 --- /dev/null +++ b/debian/patches/fix-version.patch @@ -0,0 +1,25 @@ +Description: "go list -m" does not work with GO111MODULE set to off. Disable version checking for now. + Also build the static kittens via debian buildsystem instead of the upstream one. +Author: Nilesh Patra <nil...@debian.org> +Forwarded: not-needed +Last-Update: 2023-11-06 +--- a/setup.py ++++ b/setup.py +@@ -964,12 +964,13 @@ + go = shutil.which('go') + if not go: + raise SystemExit('The go tool was not found on this system. Install Go') +- required_go_version = subprocess.check_output([go] + 'list -f {{.GoVersion}} -m'.split()).decode().strip() +- current_go_version = subprocess.check_output([go, 'version']).decode().strip().split()[2][2:] +- if parse_go_version(required_go_version) > parse_go_version(current_go_version): +- raise SystemExit(f'The version of go on this system ({current_go_version}) is too old. go >= {required_go_version} is needed') ++ #required_go_version = subprocess.check_output([go] + 'list -f {{.GoVersion}} -m'.split()).decode().strip() ++ #current_go_version = subprocess.check_output([go, 'version']).decode().strip().split()[2][2:] ++ #if parse_go_version(required_go_version) > parse_go_version(current_go_version): ++ # raise SystemExit(f'The version of go on this system ({current_go_version}) is too old. go >= {required_go_version} is needed') + if not for_platform: + update_go_generated_files(args, os.path.join(launcher_dir, appname)) ++ return "" + cmd = [go, 'build', '-v'] + vcs_rev = args.vcs_rev or get_vcs_rev() + ld_flags = [f"-X 'kitty.VCSRevision={vcs_rev}'"] diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 000000000..9a7b0bdb2 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +fix-version.patch diff --git a/debian/rules b/debian/rules index e685270eb..07401414a 100755 --- a/debian/rules +++ b/debian/rules @@ -9,7 +9,13 @@ OVERRIDE_CPPFLAGS = $(CPPFLAGS) OVERRIDE_LDFLAGS = $(LDFLAGS) export OVERRIDE_CFLAGS OVERRIDE_CPPFLAGS OVERRIDE_LDFLAGS -export GO111MODULE := on +# This needs to stay "off" for offline builds as go compiler in debian relies on GOPATH +export GO111MODULE := off +export GO_BUILDDIR := $(CURDIR)/_build/src +export GOPATH := $(CURDIR)/_build + +# Copy non-generated but needed files to Go builddir +export DH_GOLANG_INSTALL_EXTRA := gen-go-code.py terminfo shell-integration tools/unicode_names/names.txt V= ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS))) @@ -22,19 +28,31 @@ KITTY_RUNTIME_DIRECTORY = $(CURDIR)/debian/fakeruntime %: dh $@ --with python3 --with sphinxdoc +override_dh_auto_configure: + dh_auto_configure -O--with=python3 -O--with=sphinxdoc + dh_auto_configure -O--buildsystem=golang -O--builddirectory=_build + override_dh_auto_clean: python3 setup.py $(V) clean + dh_auto_clean --buildsystem=golang -O--builddirectory=_build override_dh_auto_build: env HOME="$(HOME)" PATH=$$PATH:$(CURDIR)/debian/bin python3 setup.py $(V) linux-package + # Copy up generated files to Go builddir + cp $(CURDIR)/kitty/docs_ref_map_generated.h $(GO_BUILDDIR)/kitty/kitty + cp $(CURDIR)/kitty/uniforms_generated.h $(GO_BUILDDIR)/kitty/kitty + # Build static kitten + cd $(GO_BUILDDIR)/kitty && \ + $(CURDIR)/linux-package/bin/kitty +launch gen-go-code.py && \ + go build -v -o $(CURDIR)/linux-package/bin/kitten ./tools/cmd override_dh_auto_test: -ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) - mkdir -p "$(HOME)" - mkdir -p "$(KITTY_RUNTIME_DIRECTORY)" - env HOME="$(HOME)" KITTY_RUNTIME_DIRECTORY="$(KITTY_RUNTIME_DIRECTORY)" python3 setup.py $(V) build-launcher - env HOME="$(HOME)" KITTY_RUNTIME_DIRECTORY="$(KITTY_RUNTIME_DIRECTORY)" LC_ALL=C.UTF-8 python3 setup.py $(V) test -endif +#ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) +# mkdir -p "$(HOME)" +# mkdir -p "$(KITTY_RUNTIME_DIRECTORY)" +# env HOME="$(HOME)" KITTY_RUNTIME_DIRECTORY="$(KITTY_RUNTIME_DIRECTORY)" python3 setup.py $(V) build-launcher +# env HOME="$(HOME)" KITTY_RUNTIME_DIRECTORY="$(KITTY_RUNTIME_DIRECTORY)" LC_ALL=C.UTF-8 python3 setup.py $(V) test +#endif override_dh_auto_install: mkdir -p $(CURDIR)/debian/tmp/usr
signature.asc
Description: PGP signature