[Buildroot] [PATCH] package: add smpq and stormlib

Yann E. MORIN yann.morin.1998 at free.fr
Sun Oct 10 21:07:36 UTC 2021


Gleb, All,

On 2021-10-10 18:09 +0100, Gleb Mazovetskiy spake thusly:
> SMPQ is a utility for working with Blizzard MPQ archives and StormLib is
> the library for doing this that it depends on.
> 
> SMPQ/StormLib is a runtime and/or build-time dependency of several
> source ports / reimplementations of Blizzard games, such as DevilutionX.
> 
> These packages are already available in other distros, such as Debian.

Please, provide you patch per package.

> Signed-off-by: Gleb Mazovetskiy <glex.spb at gmail.com>
> ---
>  package/Config.in              |  2 ++
>  package/smpq/Config.in         | 11 ++++++++++
>  package/smpq/smpq.hash         |  3 +++
>  package/smpq/smpq.mk           | 37 ++++++++++++++++++++++++++++++++++
>  package/stormlib/Config.in     |  8 ++++++++
>  package/stormlib/stormlib.hash |  3 +++
>  package/stormlib/stormlib.mk   | 16 +++++++++++++++
>  7 files changed, 80 insertions(+)
>  create mode 100644 package/smpq/Config.in
>  create mode 100644 package/smpq/smpq.hash
>  create mode 100644 package/smpq/smpq.mk
>  create mode 100644 package/stormlib/Config.in
>  create mode 100644 package/stormlib/stormlib.hash
>  create mode 100644 package/stormlib/stormlib.mk
> 
> diff --git a/package/Config.in b/package/Config.in
> index 9fed0ab4cb..890a6be135 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -74,6 +74,7 @@ menu "Compressors and decompressors"
>  	source "package/p7zip/Config.in"
>  	source "package/pigz/Config.in"
>  	source "package/pixz/Config.in"
> +	source "package/smpq/Config.in"
>  	source "package/unrar/Config.in"
>  	source "package/unzip/Config.in"
>  	source "package/xz/Config.in"
> @@ -1360,6 +1361,7 @@ menu "Compression and decompression"
>  	source "package/lzo/Config.in"
>  	source "package/minizip/Config.in"
>  	source "package/snappy/Config.in"
> +	source "package/stormlib/Config.in"
>  	source "package/szip/Config.in"
>  	source "package/zlib/Config.in"
>  	source "package/zziplib/Config.in"
> diff --git a/package/smpq/Config.in b/package/smpq/Config.in
> new file mode 100644
> index 0000000000..589f5cf834
> --- /dev/null
> +++ b/package/smpq/Config.in
> @@ -0,0 +1,11 @@
> +config BR2_PACKAGE_SMPQ
> +	bool "smpq"
> +	select BR2_PACKAGE_SMPQ
> +	help
> +	  StormLib MPQ archiving utility
> +
> +	  This utility manipulates Blizzard MPQ archives.
> +	  It supports extracting, appending, renaming and deleting files
> +	  in MPQ archives, and creating new MPQ archives.
> +
> +	  https://launchpad.net/smpq
> diff --git a/package/smpq/smpq.hash b/package/smpq/smpq.hash
> new file mode 100644
> index 0000000000..f14eaef49b
> --- /dev/null
> +++ b/package/smpq/smpq.hash
> @@ -0,0 +1,3 @@
> +# Locally calculated
> +sha256  b5d2dc8a5de8629b71ee5d3612b6e84d88418b86c5cd39ba315e9eb0462f18cb  smpq_1.6.orig.tar.gz
> +sha256  8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903  COPYING
> diff --git a/package/smpq/smpq.mk b/package/smpq/smpq.mk
> new file mode 100644
> index 0000000000..6696c88f9c
> --- /dev/null
> +++ b/package/smpq/smpq.mk
> @@ -0,0 +1,37 @@
> +################################################################################
> +#
> +# smpq
> +#
> +################################################################################
> +
> +SMPQ_VERSION = 1.6
> +SMPQ_SOURCE = smpq_$(SMPQ_VERSION).orig.tar.gz
> +SMPQ_SITE = https://launchpad.net/smpq/trunk/$(SMPQ_VERSION)/+download
> +SMPQ_DEPENDENCIES = stormlib
> +HOST_SMPQ_DEPENDENCIES = host-stormlib
> +SMPQ_LICENSE = GPL-3.0+
> +SMPQ_LICENSE_FILES = LICENSE
> +SMPQ_INSTALL_STAGING = YES
> +SMPQ_CONF_OPTS += -DWITH_KDE=OFF
> +HOST_SMPQ_CONF_OPTS += -DWITH_KDE=OFF

Although there is nothing written black-on-white about this, I prefer
that the variables be ordered in a logical order, and semantically
grouped together:

 1. download metadata: VERSION, SOURCE, SITE
 2. legal info: LICENSE, LICENSE_FILES
 3. if available, CPE info
 4. DEPENDENCIES
 5. CONF_ENV and CONF_OPTS
 6. and so on...

I have no strong preference about where to set the host varaibles vs.
the target ones; intersperesed like you did, of all the host ones after
the target variant. I would slightly favour the latter, but I'm OK with
anything as long as it is consistent.

> +# The StormLib version check in SMPQ CMake is broken. Disable it.
> +define SMPQ_DISABLE_VERSION_CHECK
> +	$(SED) 's/try_compile(CHECK.*/set(CHECK ON)/' $(@D)/CMakeLists.txt
> +endef
> +
> +define SMPQ_DISABLE_MANUAL
> +	$(SED) 's|if(NOT CMAKE_CROSSCOMPILING)|if(FALSE)|' $(@D)/CMakeLists.txt
> +endef
> +
> +# StormLib is C++ and must be linked with a C++ linker (e.g. via g++ instead of gcc).
> +define SMPQ_SET_LANG_TO_CXX
> +	$(SED) '/^project/a file(GLOB_RECURSE CFILES "$${CMAKE_SOURCE_DIR}/*.c")\$(NEWLINE)
> +SET_SOURCE_FILES_PROPERTIES($${CFILES} PROPERTIES LANGUAGE CXX)' $(@D)/CMakeLists.txt
> +endef
> +
> +SMPQ_POST_PATCH_HOOKS += SMPQ_DISABLE_VERSION_CHECK SMPQ_DISABLE_MANUAL SMPQ_SET_LANG_TO_CXX
> +HOST_SMPQ_POST_PATCH_HOOKS += SMPQ_DISABLE_VERSION_CHECK SMPQ_DISABLE_MANUAL SMPQ_SET_LANG_TO_CXX

We try not to unconditionally patch code from the .mk files; instead,
bundle three patches, to fix each of those three issues.

Bonus point if you can make those patches acceptable upstream.
Extra-bonus point if you push those patches upstream, and they get
applied! ;-)

Regards,
Yann E. MORIN.

> +$(eval $(cmake-package))
> +$(eval $(host-cmake-package))
> diff --git a/package/stormlib/Config.in b/package/stormlib/Config.in
> new file mode 100644
> index 0000000000..b2e4df3c62
> --- /dev/null
> +++ b/package/stormlib/Config.in
> @@ -0,0 +1,8 @@
> +config BR2_PACKAGE_STORMLIB
> +	bool "stormlib"
> +	select BR2_PACKAGE_BZIP2
> +	select BR2_PACKAGE_ZLIB
> +	help
> +	  StormLib is a library that reads and writes Blizzard MPQ archives.
> +
> +	  https://github.com/ladislav-zezula/StormLib
> diff --git a/package/stormlib/stormlib.hash b/package/stormlib/stormlib.hash
> new file mode 100644
> index 0000000000..dc5370b03d
> --- /dev/null
> +++ b/package/stormlib/stormlib.hash
> @@ -0,0 +1,3 @@
> +# Locally calculated
> +sha256  53b8befda3855a922e57a27f78c36feba7e9a32804da4b6592a3670c4e9cec98  stormlib-5ab093b7a57b8779dff06a08fac19d46c40b3329.tar.gz
> +sha256  50b128e6750ed9d887e7a5748a6021238bb2f3bf34a5dd2768c410d932069e35  LICENSE
> diff --git a/package/stormlib/stormlib.mk b/package/stormlib/stormlib.mk
> new file mode 100644
> index 0000000000..a2e58aa983
> --- /dev/null
> +++ b/package/stormlib/stormlib.mk
> @@ -0,0 +1,16 @@
> +################################################################################
> +#
> +# stormlib
> +#
> +################################################################################
> +
> +STORMLIB_VERSION = 5ab093b7a57b8779dff06a08fac19d46c40b3329
> +STORMLIB_SITE = $(call github,ladislav-zezula,StormLib,$(STORMLIB_VERSION))
> +STORMLIB_DEPENDENCIES = zlib bzip2
> +HOST_STORMLIB_DEPENDENCIES = host-zlib host-bzip2
> +STORMLIB_LICENSE = MIT
> +STORMLIB_LICENSE_FILES = LICENSE
> +STORMLIB_INSTALL_STAGING = YES
> +
> +$(eval $(cmake-package))
> +$(eval $(host-cmake-package))
> -- 
> 2.30.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'


More information about the buildroot mailing list