Re: [PATCH] buildsys: resurrect PLATFORM_LINUX and depend on it for linux-specific applets

2023-10-07 Thread Michael Tokarev

Another ping 1.5 hours later?

Thanks,

/mjt
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] buildsys: resurrect PLATFORM_LINUX and depend on it for linux-specific applets

2023-04-01 Thread Michael Tokarev

Friendly ping #2.

Is something like this not welcomed at all, or is okay generally but
done in a wrong way, or maybe something else entirely?

The change is relatively large and the code is bit-rotting slowly..

Thanks,

/mjt

04.11.2022 19:49, Michael Tokarev wrote:

This effectively reverts the following two commits:

   commit e3b1a1fd28558f7a1b3c0ec33313bedb675be8a1
   Author: Denys Vlasenko 
   Date:   Sat Feb 26 22:24:08 2011 +0100

 Replace "depends on PLATFORM_LINUX" with "select PLATFORM_LINUX"

and

   commit 5c69ad0ecdc18cf51b312c7c82848f4438fe1c8d
   Author: Ron Yorston 
   Date:   Tue Aug 4 08:24:19 2020 +0100

 build system: drop PLATFORM_LINUX

but does, hopefully, the right thing.

Original complain was that the allnoconfig turns off PLATFORM_LINUX
on which all linux-specific applets depends. Instead of setting this
config option right for linux and non-linux (initially it was just a
regular kconfig symbol, not set depending on the platform), it were
turned into something which made little sense (in the first commit),
and later dropped completely.

So introduce a dynamic kconfig symbol PLATFORM_LINUX with the value
actually depending on the target platform, so that it is not affected
by all{yes|no|whatever}config. This way, it is possible to depend on
it for linux-specific applets without breaking *config anymore.

It is done by creating a small kconfig fragment, .platform.in, to
define just PLATFORM_LINUX symbol. It is created in Makefile if
${CPP} has __linux__ #defined. And include it in the top-level Config.in.

Regenerate default config files with the new symbol.

And mark all the applets which were marked as "select PLATFORM_LINUX"
before the "build system: drop PLATFORM_LINUX" commit, as
"depends on PLATFORM_LINUX".

Also mark 2 other applets, tc and dhcprelay, as linux-only too.

This way, it is finally possible to build busybox on other platforms
without really huge efforts to maintain list of "incompatible" applets
externally, and does not put any pressure on the main development, -
the only thing needed is to keep the existing "depends on PLATFORM_LINUX"
lines.


___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] buildsys: resurrect PLATFORM_LINUX and depend on it for linux-specific applets

2023-01-21 Thread Michael Tokarev

21.01.2023 19:49, Clément Péron пишет:

Hi Michael,

On Sat, 21 Jan 2023 at 16:38, Michael Tokarev  wrote:


A friendly ping?

This patch still applies and works okay with current 1.36 version.


diff --git a/miscutils/lsscsi.c b/miscutils/lsscsi.c
index 8f7eda761..a9d8c3772 100644
--- a/miscutils/lsscsi.c
+++ b/miscutils/lsscsi.c
@@ -9,6 +9,7 @@
  //config:config LSSCSI
  //config:  bool "lsscsi (2.5 kb)"
  //config:  default y
+//config:  #depends on PLATFORM_LINUX
Why is there a '#' here? Should we not drop it?

same for lspci.c /lsusb.c


These has been there before this PLATFORM_LINUX has been dropped.
It is basically a revert of the previous patch (rebased to current
version). To me, it looks like it weren't clear if these applets
are linux-specific or not, so I decided to keep it this way now, -
we'll know it once others will start using this stuff on other
platforms. Think of it as a documentation, - when you grep for
PLATFORM_LINUX you'll see them. It's trivial to drop these though.


Maybe add a small comment in the Makefile about the
.platform.in:


That might be a good idea indeed.

But having in mind the age of this context and the previous attempts
to change it, I'd love to have some feedback for the approach itself,
before adding cosmetics.

I don't like this .platform.in file, - linux-kernel kconfig now has
some variables support so things like that does not require temp
files, but busybox's kconfig is older, so this hack is the only
way to do that which I found. Maybe I'm wrong here.

Either way, this change allowed us to build and use busybox on hurd
and kfreebsd, finally..

/mjt

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] buildsys: resurrect PLATFORM_LINUX and depend on it for linux-specific applets

2023-01-21 Thread Clément Péron
Hi Michael,

On Sat, 21 Jan 2023 at 16:38, Michael Tokarev  wrote:
>
> A friendly ping?
>
> This patch still applies and works okay with current 1.36 version.

diff --git a/miscutils/lsscsi.c b/miscutils/lsscsi.c
index 8f7eda761..a9d8c3772 100644
--- a/miscutils/lsscsi.c
+++ b/miscutils/lsscsi.c
@@ -9,6 +9,7 @@
 //config:config LSSCSI
 //config:  bool "lsscsi (2.5 kb)"
 //config:  default y
+//config:  #depends on PLATFORM_LINUX
Why is there a '#' here? Should we not drop it?

same for lspci.c /lsusb.c

Maybe add a small comment in the Makefile about the
.platform.in:

Regards,
Clement


>
> Thanks,
>
> /mjt
>
> 04.11.2022 19:49, Michael Tokarev wrote:
> > This effectively reverts the following two commits:
> >
> >commit e3b1a1fd28558f7a1b3c0ec33313bedb675be8a1
> >Author: Denys Vlasenko 
> >Date:   Sat Feb 26 22:24:08 2011 +0100
> >
> >  Replace "depends on PLATFORM_LINUX" with "select PLATFORM_LINUX"
> >
> > and
> >
> >commit 5c69ad0ecdc18cf51b312c7c82848f4438fe1c8d
> >Author: Ron Yorston 
> >Date:   Tue Aug 4 08:24:19 2020 +0100
> >
> >  build system: drop PLATFORM_LINUX
> >
> > but does, hopefully, the right thing.
> …
>
> ___
> busybox mailing list
> busybox@busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] buildsys: resurrect PLATFORM_LINUX and depend on it for linux-specific applets

2023-01-21 Thread Michael Tokarev

A friendly ping?

This patch still applies and works okay with current 1.36 version.

Thanks,

/mjt

04.11.2022 19:49, Michael Tokarev wrote:

This effectively reverts the following two commits:

   commit e3b1a1fd28558f7a1b3c0ec33313bedb675be8a1
   Author: Denys Vlasenko 
   Date:   Sat Feb 26 22:24:08 2011 +0100

 Replace "depends on PLATFORM_LINUX" with "select PLATFORM_LINUX"

and

   commit 5c69ad0ecdc18cf51b312c7c82848f4438fe1c8d
   Author: Ron Yorston 
   Date:   Tue Aug 4 08:24:19 2020 +0100

 build system: drop PLATFORM_LINUX

but does, hopefully, the right thing.

…

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] buildsys: resurrect PLATFORM_LINUX and depend on it for linux-specific applets

2022-11-06 Thread Michael Tokarev

07.11.2022 08:25, Kang-Che Sung wrote:

On Sat, Nov 5, 2022 at 12:55 AM Michael Tokarev  wrote:


diff --git a/Makefile b/Makefile



+.platform.in:
+   $(Q)printf '#ifndef __linux__\nplatform_is_not_linux\n#endif' \
+   | $(CPP) - | grep -s platform_is_not_linux \
+ && linux=n || linux=y; \
+   printf "config PLATFORM_LINUX\n\tbool\n\tdefault $$linux\n" > $@



What is the reason for preferring #ifndef check rather than #ifdef?
I mean, that would make PLATFORM_LINUX defaults to y if the compiler fails,
and I would expect n in that case.


That's exactly the goal, - to make linux the default, that's the reason
I changed from ifdef linux to ifndef.  The idea is to bring as few burden
to the main authors as possible, - if this doesn't work, their favorite
platform wont be affected.  See the email I referred to in other message -
http://lists.busybox.net/pipermail/busybox/2011-February/074954.html -
from 11 years ago, - this is when "depends on LINUX" were (mistakenly)
changed to "select LINUX" in the first place, making it effectively
impossible to build busybox on non-linux.


And I'm curious. Does Busybox's kconfig system supports macros as described in
 ?
If the system supports macros, we can put this in the Kconfig file and simplify
a lot of things:

config PLATFORM_LINUX
bool
default $(shell, { printf '#ifndef __linux__\n#error \n#endif\n' \
 | $(CPP) - -o /dev/null; } >/dev/null 2>&1 && echo y || echo n)


No, - busybox's kconfig is much simpler than that, as far as I can see,
it is a fork off a much earlier kconfig language.

Thanks,

/mjt
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] buildsys: resurrect PLATFORM_LINUX and depend on it for linux-specific applets

2022-11-06 Thread Kang-Che Sung
On Sat, Nov 5, 2022 at 12:55 AM Michael Tokarev  wrote:

> diff --git a/Makefile b/Makefile
> index 503475fe9..ad780c261 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -361,9 +361,16 @@ scripts/basic/%: scripts_basic ;
>
>  # This target generates Kbuild's and Config.in's from *.c files
>  PHONY += gen_build_files
> -gen_build_files: $(wildcard $(srctree)/*/*.c) $(wildcard $(srctree)/*/*/*.c) 
> $(wildcard $(srctree)/embed/*)
> +gen_build_files: $(wildcard $(srctree)/*/*.c) $(wildcard $(srctree)/*/*/*.c) 
> $(wildcard $(srctree)/embed/*) .platform.in
> $(Q)$(srctree)/scripts/gen_build_files.sh $(srctree) $(objtree)
>
> +.platform.in:
> +   $(Q)printf '#ifndef __linux__\nplatform_is_not_linux\n#endif' \
> +   | $(CPP) - | grep -s platform_is_not_linux \
> + && linux=n || linux=y; \
> +   printf "config PLATFORM_LINUX\n\tbool\n\tdefault $$linux\n" > $@
> +MRPROPER_FILES += .platform.in
> +
>  # bbox: we have helpers in applets/
>  # we depend on scripts_basic, since scripts/basic/fixdep
>  # must be built before any other host prog

What is the reason for preferring #ifndef check rather than #ifdef?
I mean, that would make PLATFORM_LINUX defaults to y if the compiler fails,
and I would expect n in that case.

And I'm curious. Does Busybox's kconfig system supports macros as described in
 ?
If the system supports macros, we can put this in the Kconfig file and simplify
a lot of things:

config PLATFORM_LINUX
bool
default $(shell, { printf '#ifndef __linux__\n#error \n#endif\n' \
| $(CPP) - -o /dev/null; } >/dev/null 2>&1 && echo y || echo n)
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] buildsys: resurrect PLATFORM_LINUX and depend on it for linux-specific applets

2022-11-04 Thread Michael Tokarev

Just a bit of context I failed to add.

I'm aware of the previous issues there,

http://lists.busybox.net/pipermail/busybox/2011-February/074954.html

was the reason it was changed from "depends on linux" to "select linux".
It was a wrong thing to do, instead, PLATFORM_LINUX should have been
made a non-user-selectable symbol whith automatic value depending on
the actual platform in question.

This is an attempt to do just that.

Thanks,

/mjt

04.11.2022 19:49, Michael Tokarev wrote:

This effectively reverts the following two commits:

   commit e3b1a1fd28558f7a1b3c0ec33313bedb675be8a1
   Author: Denys Vlasenko 
   Date:   Sat Feb 26 22:24:08 2011 +0100

 Replace "depends on PLATFORM_LINUX" with "select PLATFORM_LINUX"

and

   commit 5c69ad0ecdc18cf51b312c7c82848f4438fe1c8d
   Author: Ron Yorston 
   Date:   Tue Aug 4 08:24:19 2020 +0100

 build system: drop PLATFORM_LINUX

but does, hopefully, the right thing.

Original complain was that the allnoconfig turns off PLATFORM_LINUX
on which all linux-specific applets depends. Instead of setting this
config option right for linux and non-linux (initially it was just a
regular kconfig symbol, not set depending on the platform), it were
turned into something which made little sense (in the first commit),
and later dropped completely.

So introduce a dynamic kconfig symbol PLATFORM_LINUX with the value
actually depending on the target platform, so that it is not affected
by all{yes|no|whatever}config. This way, it is possible to depend on
it for linux-specific applets without breaking *config anymore.

It is done by creating a small kconfig fragment, .platform.in, to
define just PLATFORM_LINUX symbol. It is created in Makefile if
${CPP} has __linux__ #defined. And include it in the top-level Config.in.

Regenerate default config files with the new symbol.

And mark all the applets which were marked as "select PLATFORM_LINUX"
before the "build system: drop PLATFORM_LINUX" commit, as
"depends on PLATFORM_LINUX".

Also mark 2 other applets, tc and dhcprelay, as linux-only too.

This way, it is finally possible to build busybox on other platforms
without really huge efforts to maintain list of "incompatible" applets
externally, and does not put any pressure on the main development, -
the only thing needed is to keep the existing "depends on PLATFORM_LINUX"
lines.

Signed-off-by: Michael Tokarev 
---

...

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox