Skip to content

Commit

Permalink
add webos-gmp: gmp 4.2.1 for target only
Browse files Browse the repository at this point in the history
  • Loading branch information
throwaway96 committed Feb 6, 2024
1 parent e71537d commit f681c02
Show file tree
Hide file tree
Showing 25 changed files with 172 additions and 18 deletions.
1 change: 1 addition & 0 deletions package/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -2704,6 +2704,7 @@ menu "WebOS"
source "package/libwebosi18n/Config.in"
source "package/luna-service2/Config.in"
source "package/umediaserver/Config.in"
source "package/webos-gmp/Config.in"
source "package/webos-wayland-extensions/Config.in"
source "package/webos-userland/Config.in"
endmenu
Expand Down
4 changes: 2 additions & 2 deletions package/coreutils/coreutils.mk
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ ifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
COREUTILS_CONF_OPTS += --with-libintl-prefix=$(STAGING_DIR)/usr
endif

ifeq ($(BR2_PACKAGE_GMP),y)
COREUTILS_DEPENDENCIES += gmp
ifneq ($(BR2_PACKAGE_GMP)$(BR2_PACKAGE_WEBOS_GMP),)
COREUTILS_DEPENDENCIES += $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp)
else
COREUTILS_CONF_OPTS += --without-gmp
endif
Expand Down
2 changes: 1 addition & 1 deletion package/dnsmasq/dnsmasq.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ DNSMASQ_COPTS += -DNO_DHCP
endif

ifeq ($(BR2_PACKAGE_DNSMASQ_DNSSEC),y)
DNSMASQ_DEPENDENCIES += gmp nettle
DNSMASQ_DEPENDENCIES += $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp) nettle
DNSMASQ_COPTS += -DHAVE_DNSSEC
endif

Expand Down
2 changes: 1 addition & 1 deletion package/gdb/gdb.mk
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ endif
ifeq ($(BR2_GDB_VERSION_10)$(BR2_arc):$(BR2_PACKAGE_GDB_DEBUGGER),:y)
GDB_CONF_OPTS += \
--with-libgmp-prefix=$(STAGING_DIR)/usr
GDB_DEPENDENCIES += gmp
GDB_DEPENDENCIES += $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp)
endif

ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
Expand Down
4 changes: 4 additions & 0 deletions package/gmp/gmp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@ else
GMP_CONF_OPTS += --disable-cxx
endif

# Don't build for target if using webOS GMP instead
#ifneq ($(BR2_PACKAGE_WEBOS_GMP),y)
$(eval $(autotools-package))
#endif

$(eval $(host-autotools-package))
2 changes: 1 addition & 1 deletion package/gnuradio/gnuradio.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ GNURADIO_DEPENDENCIES = \
host-swig \
boost \
log4cpp \
gmp \
$(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp) \
volk

GNURADIO_CONF_OPTS = \
Expand Down
2 changes: 1 addition & 1 deletion package/guile/guile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ GUILE_LICENSE = LGPL-3.0+
GUILE_LICENSE_FILES = LICENSE COPYING COPYING.LESSER
GUILE_CPE_ID_VENDOR = gnu

GUILE_DEPENDENCIES = host-guile libunistring libffi gmp bdwgc host-pkgconf
GUILE_DEPENDENCIES = host-guile libunistring libffi $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp) bdwgc host-pkgconf
HOST_GUILE_DEPENDENCIES = \
host-libunistring host-libffi host-gmp host-bdwgc host-flex \
host-pkgconf host-gettext host-gperf
Expand Down
2 changes: 1 addition & 1 deletion package/libbytesize/libbytesize.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ LIBBYTESIZE_INSTALL_STAGING = YES
LIBBYTESIZE_DEPENDENCIES = \
host-pkgconf \
host-gettext \
gmp \
$(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp) \
mpfr \
pcre2

Expand Down
2 changes: 1 addition & 1 deletion package/libpbnjson/libpbnjson.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ LIBPBNJSON_DEPENDENCIES = \
host-lemon \
cmake-modules-webos \
boost \
gmp \
$(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp) \
libglib2 \
liburiparser \
yajl
Expand Down
2 changes: 1 addition & 1 deletion package/minetest/minetest.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MINETEST_LICENSE = LGPL-2.1+ (code), CC-BY-SA-3.0 (textures and sounds), Zlib (i
MINETEST_LICENSE_FILES = LICENSE.txt lib/irrlichtmt/doc/irrlicht-license.txt
MINETEST_CPE_ID_VENDOR = minetest

MINETEST_DEPENDENCIES = gmp jsoncpp luajit sqlite zlib zstd
MINETEST_DEPENDENCIES = $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp) jsoncpp luajit sqlite zlib zstd

MINETEST_IRRLICHTMT_VERSION = 1.9.0mt5
MINETEST_EXTRA_DOWNLOADS = $(call github,minetest,irrlicht,$(MINETEST_IRRLICHTMT_VERSION))/irrlicht-$(MINETEST_IRRLICHTMT_VERSION).tar.gz
Expand Down
2 changes: 1 addition & 1 deletion package/mpc/mpc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ MPC_SITE = $(BR2_GNU_MIRROR)/mpc
MPC_LICENSE = LGPL-3.0+
MPC_LICENSE_FILES = COPYING.LESSER
MPC_INSTALL_STAGING = YES
MPC_DEPENDENCIES = gmp mpfr
MPC_DEPENDENCIES = $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp) mpfr
HOST_MPC_DEPENDENCIES = host-gmp host-mpfr

$(eval $(autotools-package))
Expand Down
2 changes: 1 addition & 1 deletion package/mpfr/mpfr.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ MPFR_LICENSE = LGPL-3.0+
MPFR_LICENSE_FILES = COPYING.LESSER
MPFR_CPE_ID_VENDOR = gnu
MPFR_INSTALL_STAGING = YES
MPFR_DEPENDENCIES = gmp
MPFR_DEPENDENCIES = $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp)
HOST_MPFR_DEPENDENCIES = host-gmp
MPFR_MAKE_OPTS = RANLIB=$(TARGET_RANLIB)

Expand Down
2 changes: 1 addition & 1 deletion package/mpir/mpir.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MPIR_SOURCE = mpir-$(MPIR_VERSION).tar.bz2
MPIR_LICENSE = LGPL-3.0+
MPIR_LICENSE_FILES = COPYING.LIB
MPIR_INSTALL_STAGING = YES
MPIR_DEPENDENCIES = gmp host-yasm
MPIR_DEPENDENCIES = $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp) host-yasm

ifeq ($(BR2_MIPS_NABI32),y)
MPIR_CONF_OPTS += ABI=n32
Expand Down
2 changes: 1 addition & 1 deletion package/nettle/nettle.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

NETTLE_VERSION = 2.7.1
NETTLE_SITE = http://www.lysator.liu.se/~nisse/archive
NETTLE_DEPENDENCIES = gmp
NETTLE_DEPENDENCIES = $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp)
NETTLE_INSTALL_STAGING = YES
NETTLE_LICENSE = LGPLv2.1+
NETTLE_LICENSE_FILES = COPYING.LIB
Expand Down
2 changes: 1 addition & 1 deletion package/nftables/nftables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ NFTABLES_CONF_OPTS = --disable-debug --disable-man-doc --disable-pdf-doc
NFTABLES_SELINUX_MODULES = iptables

ifeq ($(BR2_PACKAGE_GMP),y)
NFTABLES_DEPENDENCIES += gmp
NFTABLES_DEPENDENCIES += $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp)
NFTABLES_CONF_OPTS += --without-mini-gmp
else
NFTABLES_CONF_OPTS += --with-mini-gmp
Expand Down
2 changes: 1 addition & 1 deletion package/openldap/openldap.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ OPENLDAP_DEPENDENCIES += openssl
OPENLDAP_CONF_ENV = LIBS="`$(PKG_CONFIG_HOST_BINARY) --libs libssl libcrypto`"
else ifeq ($(BR2_PACKAGE_GMP),y)
OPENLDAP_MP = gmp
OPENLDAP_DEPENDENCIES += gmp
OPENLDAP_DEPENDENCIES += $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp)
else
OPENLDAP_MP = longlong
endif
Expand Down
2 changes: 1 addition & 1 deletion package/openswan/openswan.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ OPENSWAN_LICENSE = GPL-2.0+, BSD-3-Clause
OPENSWAN_LICENSE_FILES = COPYING LICENSE
OPENSWAN_CPE_ID_VENDOR = xelerance

OPENSWAN_DEPENDENCIES = host-bison host-flex gmp iproute2
OPENSWAN_DEPENDENCIES = host-bison host-flex $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp) iproute2
OPENSWAN_MAKE_OPTS = ARCH=$(BR2_ARCH) CC="$(TARGET_CC)" POD2MAN="" XMLTO="" \
USERCOMPILE="$(TARGET_CFLAGS) $(if $(BR2_TOOLCHAIN_SUPPORTS_PIE),-fPIE)" \
USERLINK="$(TARGET_LDFLAGS) $(if $(BR2_TOOLCHAIN_SUPPORTS_PIE),-fPIE)" \
Expand Down
2 changes: 1 addition & 1 deletion package/php/php.mk
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ endif

ifeq ($(BR2_PACKAGE_PHP_EXT_GMP),y)
PHP_CONF_OPTS += --with-gmp=$(STAGING_DIR)/usr
PHP_DEPENDENCIES += gmp
PHP_DEPENDENCIES += $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp)
endif

ifeq ($(BR2_PACKAGE_PHP_EXT_READLINE),y)
Expand Down
2 changes: 1 addition & 1 deletion package/ruby/ruby.mk
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ifeq ($(BR2_PACKAGE_ZLIB),y)
RUBY_DEPENDENCIES += zlib
endif
ifeq ($(BR2_PACKAGE_GMP),y)
RUBY_DEPENDENCIES += gmp
RUBY_DEPENDENCIES += $(if $(BR2_PACKAGE_WEBOS_GMP),webos-gmp,gmp)
RUBY_CONF_OPTS += --with-gmp
else
RUBY_CONF_OPTS += --without-gmp
Expand Down
33 changes: 33 additions & 0 deletions package/webos-gmp/0001-disable-stdc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Upstream-Status: Pending

# "extern inline" in traditional gcc means that the function should be
# inlined wherever it's seen, while in C99, "extern inline" means that i
# the function should only be inlined where the inline definition is
# seen while in other places it's not inlined:
# http://gcc.gnu.org/ml/gcc/2006-11/msg00006.html
#
# gmp checks "--std=gnu99" to use C99 convention however it internally
# defines some "extern inline" functions in gmp.h, which is included
# by mainly .c files and finally lead a flood of redefinition function
# errors when linking objects together.
#
# So disable C99/ANSI detection to stick to tranditional gcc behavior
#
# by Kevin Tian <kevin.tian@intel.com>, 2010-08-13
#
# (this patch is licensed under GPLv2+)

diff --git a/configure.in b/configure.in
index 450cc92..aab0b59 100644
--- a/configure.in
+++ b/configure.in
@@ -1869,9 +1869,7 @@ AC_SUBST(DEFN_LONG_LONG_LIMB)

# The C compiler and preprocessor, put into ANSI mode if possible.
AC_PROG_CC
-AC_PROG_CC_STDC
AC_PROG_CPP
-GMP_H_ANSI


# The C compiler on the build system, and associated tests.
48 changes: 48 additions & 0 deletions package/webos-gmp/0002-gmp_fix_for_automake-1.12.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Upstream-Status: Pending

automake 1.12 has depricated automatic de-ANSI-fication support

this patch avoids these kinds of errors:

| configure.in:2240: error: automatic de-ANSI-fication support has been removed
| Makefile.am:28: error: automatic de-ANSI-fication support has been removed

Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
2012/05/02

Index: gmp-4.2.1/configure.in
===================================================================
--- gmp-4.2.1.orig/configure.in
+++ gmp-4.2.1/configure.in
@@ -67,7 +67,7 @@ dnl
dnl Note that there's a copy of these options in the top-level Makefile.am,
dnl so update there too if changing anything.
dnl
-AM_INIT_AUTOMAKE([1.8 gnu no-dependencies $(top_builddir)/ansi2knr])
+AM_INIT_AUTOMAKE([1.8 gnu no-dependencies])
AM_CONFIG_HEADER(config.h:config.in)
AM_MAINTAINER_MODE

@@ -2022,9 +2022,6 @@ fi
echo " MPN_PATH=\"$path\""


-# Automake ansi2knr support.
-AM_C_PROTOTYPES
-
GMP_PROG_AR
GMP_PROG_NM

Index: gmp-4.2.1/Makefile.am
===================================================================
--- gmp-4.2.1.orig/Makefile.am
+++ gmp-4.2.1/Makefile.am
@@ -27,7 +27,7 @@
# Makefiles in subdirectories, but here we must omit it so automake gives
# the actual ansi2knr build rule, not "cd $(top_builddir) && make ansi2knr".
#
-AUTOMAKE_OPTIONS = 1.8 gnu no-dependencies ansi2knr
+AUTOMAKE_OPTIONS = 1.8 gnu no-dependencies


# Libtool -version-info for libgmp.la and libmp.la. See "Versioning" in the
27 changes: 27 additions & 0 deletions package/webos-gmp/0003-gmp-fix-ansi-c99-webos.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
This change was extracted from gmp 4.2.2 (2007-09-03)

From Richard Guenther:
* gmp-h.in (__GMP_EXTERN_INLINE): Declare conditionally on
__GNUC_STDC_INLINE__.

Index: gmp-4.2.1/gmp-h.in
===================================================================
--- gmp-4.2.1.orig/gmp-h.in 2006-04-11 11:10:15.000000000 -0700
+++ gmp-4.2.1/gmp-h.in 2013-11-24 17:21:12.807735622 -0800
@@ -418,9 +418,15 @@

/* gcc has __inline__ in all modes, including strict ansi. Give a prototype
for an inline too, so as to correctly specify "dllimport" on windows, in
- case the function is called rather than inlined. */
+ case the function is called rather than inlined.
+ GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
+ inline semantics, unless -fgnu89-inline is used. */
#ifdef __GNUC__
+#ifdef __GNUC_STDC_INLINE__
+#define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
+#else
#define __GMP_EXTERN_INLINE extern __inline__
+#endif
#define __GMP_INLINE_PROTOTYPES 1
#endif

10 changes: 10 additions & 0 deletions package/webos-gmp/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
config BR2_PACKAGE_WEBOS_GMP
bool "gmp 4.2.1 (shared only)"
depends on BR2_WEBOS_COMPAT
depends on BR2_PACKAGE_GMP
help
The version of gmp used on webOS (up through at least
webOS 8).

This replaces the normal buildroot gmp on the target (but not
host).
6 changes: 6 additions & 0 deletions package/webos-gmp/webos-gmp.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Locally calculated
sha256 d07ffcb37eecec35c5ec72516d10b35fdf6e6fef1fcf1dcd37e30b8cbf8bf941 gmp-4.2.1.tar.bz2

# Locally calculated
sha256 ddb9db7630752f8fdc6898f7c99a99eaeeac5213627ecb093df9c82f56175dc7 COPYING
sha256 5df07007198989c622f5d41de8d703e7bef3d0e79d62e24332ee739a452af62a COPYING.LIB
25 changes: 25 additions & 0 deletions package/webos-gmp/webos-gmp.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
################################################################################
#
# webos-gmp
#
################################################################################

WEBOS_GMP_VERSION = 4.2.1
WEBOS_GMP_SITE = $(BR2_GNU_MIRROR)/gmp
WEBOS_GMP_SOURCE = gmp-$(WEBOS_GMP_VERSION).tar.bz2
WEBOS_GMP_INSTALL_STAGING = YES
WEBOS_GMP_LICENSE = LGPL-2.1+ or GPL-2.0+
WEBOS_GMP_LICENSE_FILES = COPYING.LIB COPYING
WEBOS_GMP_CPE_ID_VENDOR = gmplib
WEBOS_GMP_DEPENDENCIES = host-m4

# 0001-mpz-inp_raw.c-Avoid-bit-size-overflows.patch
WEBOS_GMP_IGNORE_CVES += CVE-2021-43618

ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
WEBOS_GMP_CONF_OPTS += --enable-cxx
else
WEBOS_GMP_CONF_OPTS += --disable-cxx
endif

$(eval $(autotools-package))

0 comments on commit f681c02

Please sign in to comment.