patches and low-level development discussion
 help / color / mirror / code / Atom feed
* [PATCH] Allow static building of dtc
@ 2022-05-20  9:52 Tero Tervala
  2022-05-20 12:56 ` Alyssa Ross
  0 siblings, 1 reply; 4+ messages in thread
From: Tero Tervala @ 2022-05-20  9:52 UTC (permalink / raw)
  To: devel; +Cc: Tero Tervala

Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
---
 ...01-Use-libfdt.a-if-building-staticly.patch | 54 +++++++++++++++++++
 pkgs/development/compilers/dtc/default.nix    |  4 ++
 2 files changed, 58 insertions(+)
 create mode 100644 pkgs/development/compilers/dtc/0001-Use-libfdt.a-if-building-staticly.patch

diff --git a/pkgs/development/compilers/dtc/0001-Use-libfdt.a-if-building-staticly.patch b/pkgs/development/compilers/dtc/0001-Use-libfdt.a-if-building-staticly.patch
new file mode 100644
index 00000000000..4f0d6193030
--- /dev/null
+++ b/pkgs/development/compilers/dtc/0001-Use-libfdt.a-if-building-staticly.patch
@@ -0,0 +1,54 @@
+From 59258caa6e02b5a7d5afc0bfde777b250ef74bbb Mon Sep 17 00:00:00 2001
+From: Tero Tervala <tero.tervala@unikie.com>
+Date: Wed, 18 May 2022 11:20:40 +0300
+Subject: [PATCH] Use libfdt.a if building staticly
+
+Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
+---
+ Makefile | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index ea8c659..9474b63 100644
+--- a/Makefile
++++ b/Makefile
+@@ -151,7 +151,7 @@ BIN += fdtoverlay
+ 
+ SCRIPTS = dtdiff
+ 
+-all: $(BIN) libfdt
++all: libfdt $(BIN)
+ 
+ # We need both Python and swig to build/install pylibfdt.
+ # This builds the given make ${target} if those deps are found.
+@@ -198,6 +198,12 @@ LIBFDT_lib = $(LIBFDT_dir)/$(LIBFDT_LIB)
+ LIBFDT_include = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_INCLUDES))
+ LIBFDT_version = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_VERSION))
+ 
++ifneq (,$(findstring -static,$(CFLAGS)))
++	LIBFDT_dep = $(LIBFDT_archive)
++else
++	LIBFDT_dep = $(LIBFDT_lib)
++endif
++
+ include $(LIBFDT_dir)/Makefile.libfdt
+ 
+ .PHONY: libfdt
+@@ -261,11 +267,11 @@ convert-dtsv0: $(CONVERT_OBJS)
+ 
+ fdtdump:	$(FDTDUMP_OBJS)
+ 
+-fdtget:	$(FDTGET_OBJS) $(LIBFDT_lib)
++fdtget:	$(FDTGET_OBJS) $(LIBFDT_dep)
+ 
+-fdtput:	$(FDTPUT_OBJS) $(LIBFDT_lib)
++fdtput:	$(FDTPUT_OBJS) $(LIBFDT_dep)
+ 
+-fdtoverlay: $(FDTOVERLAY_OBJS) $(LIBFDT_lib)
++fdtoverlay: $(FDTOVERLAY_OBJS) $(LIBFDT_dep)
+ 
+ dist:
+ 	git archive --format=tar --prefix=dtc-$(dtc_version)/ HEAD \
+-- 
+2.25.1
+
diff --git a/pkgs/development/compilers/dtc/default.nix b/pkgs/development/compilers/dtc/default.nix
index 04dca4772a9..33369fb1fcc 100644
--- a/pkgs/development/compilers/dtc/default.nix
+++ b/pkgs/development/compilers/dtc/default.nix
@@ -12,6 +12,10 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-gx9LG3U9etWhPxm7Ox7rOu9X5272qGeHqZtOe68zFs4=";
   };
 
+  patches = [
+    ./0001-Use-libfdt.a-if-building-staticly.patch
+  ];
+
   buildInputs = [ libyaml ];
   nativeBuildInputs = [ flex bison pkg-config which ] ++ lib.optionals pythonSupport [ python swig ];
 
-- 
2.33.3



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Allow static building of dtc
  2022-05-20  9:52 [PATCH] Allow static building of dtc Tero Tervala
@ 2022-05-20 12:56 ` Alyssa Ross
  2022-05-25  8:08   ` Tero Tervala
  0 siblings, 1 reply; 4+ messages in thread
From: Alyssa Ross @ 2022-05-20 12:56 UTC (permalink / raw)
  To: Tero Tervala; +Cc: devel

[-- Attachment #1: Type: text/plain, Size: 1314 bytes --]

On Fri, May 20, 2022 at 12:52:57PM +0300, Tero Tervala wrote:
> Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
> ---
>  ...01-Use-libfdt.a-if-building-staticly.patch | 54 +++++++++++++++++++
>  pkgs/development/compilers/dtc/default.nix    |  4 ++
>  2 files changed, 58 insertions(+)
>  create mode 100644 pkgs/development/compilers/dtc/0001-Use-libfdt.a-if-building-staticly.patch

Thanks for the patch!  Since pkgsStatic.dtc is broken in upstream
Nixpkgs, would you mind submitting it there? [1]  It will get us wider
review than on the Spectrum list, and if it's accepted upstream (I
imagine this or a similar fix will be) it'll minimize how much Spectrum
Nixpkgs diverges, which is important for maintainability.  Once it's
accepted upstream (or if it ends up being difficult to upstream), we can
cherry-pick it into Spectrum's nixpkgs, or update Spectrum's nixpkgs to
a version that includes the fix.

When you open the Nixpkgs PR, please CC me.  My GitHub username is
@alyssais.  Nixpkgs is quite picky about commit message format, so make
sure to look at the examples in the documentation linked below.

When I get a chance, I'll update the documentation to recommend
submitting fixes to upstream Nixpkgs first if applicable.

[1]: https://nixos.org/manual/nixpkgs/unstable/#chap-submitting-changes

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Allow static building of dtc
  2022-05-20 12:56 ` Alyssa Ross
@ 2022-05-25  8:08   ` Tero Tervala
  2022-05-25 20:02     ` Alyssa Ross
  0 siblings, 1 reply; 4+ messages in thread
From: Tero Tervala @ 2022-05-25  8:08 UTC (permalink / raw)
  To: Alyssa Ross; +Cc: devel

Hi, there is now PR on the nixpkgs side for this fix.

On 20.5.2022 15.56, Alyssa Ross wrote:
> On Fri, May 20, 2022 at 12:52:57PM +0300, Tero Tervala wrote:
>> Signed-off-by: Tero Tervala <tero.tervala@unikie.com>
>> ---
>>   ...01-Use-libfdt.a-if-building-staticly.patch | 54 +++++++++++++++++++
>>   pkgs/development/compilers/dtc/default.nix    |  4 ++
>>   2 files changed, 58 insertions(+)
>>   create mode 100644 pkgs/development/compilers/dtc/0001-Use-libfdt.a-if-building-staticly.patch
> Thanks for the patch!  Since pkgsStatic.dtc is broken in upstream
> Nixpkgs, would you mind submitting it there? [1]  It will get us wider
> review than on the Spectrum list, and if it's accepted upstream (I
> imagine this or a similar fix will be) it'll minimize how much Spectrum
> Nixpkgs diverges, which is important for maintainability.  Once it's
> accepted upstream (or if it ends up being difficult to upstream), we can
> cherry-pick it into Spectrum's nixpkgs, or update Spectrum's nixpkgs to
> a version that includes the fix.
>
> When you open the Nixpkgs PR, please CC me.  My GitHub username is
> @alyssais.  Nixpkgs is quite picky about commit message format, so make
> sure to look at the examples in the documentation linked below.
>
> When I get a chance, I'll update the documentation to recommend
> submitting fixes to upstream Nixpkgs first if applicable.
>
> [1]: https://nixos.org/manual/nixpkgs/unstable/#chap-submitting-changes



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Allow static building of dtc
  2022-05-25  8:08   ` Tero Tervala
@ 2022-05-25 20:02     ` Alyssa Ross
  0 siblings, 0 replies; 4+ messages in thread
From: Alyssa Ross @ 2022-05-25 20:02 UTC (permalink / raw)
  To: Tero Tervala; +Cc: devel

[-- Attachment #1: Type: text/plain, Size: 241 bytes --]

On Wed, May 25, 2022 at 11:08:06AM +0300, Tero Tervala wrote:
> Hi, there is now PR on the nixpkgs side for this fix.

Thanks a lot!  It might take me a few days to get a chance to review
(but of course somebody else might in the meantime).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-25 20:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20  9:52 [PATCH] Allow static building of dtc Tero Tervala
2022-05-20 12:56 ` Alyssa Ross
2022-05-25  8:08   ` Tero Tervala
2022-05-25 20:02     ` Alyssa Ross

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).