f268f7131b
The Buildroot coding style defines one space around make assignments and does not align the assignment symbols. This patch does a bulk fix of offending packages. The package infrastructures (or more in general assignments to calculated variable names, like $(2)_FOO) are not touched. Alignment of line continuation characters (\) is kept as-is. The sed command used to do this replacement is: find * -name "*.mk" | xargs sed -i \ -e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#' -e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#' -e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#' -e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#' Brief explanation of this command: ^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line \([?:+]\?=\) any assignment character =, :=, ?=, += \([^\\]\+\) any string not containing a line continuation \([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a line continuation character \(\s*\\\) optional whitespace, followed by a line continuation character Hence, the first subexpression handles empty assignments, the second handles regular assignments, the third handles regular assignments with line continuation, and the fourth empty assignments with line continuation. This expression was tested on following test text: (initial tab not included) FOO = spaces before FOO = spaces before and after FOO = tab before FOO = tab and spaces before FOO = tab after FOO = tab and spaces after FOO = spaces and tab after FOO = \ FOO = bar \ FOO = bar space \ FOO = \ GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse FOO += spaces before FOO ?= spaces before and after FOO := FOO = FOO = FOO = FOO = $(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C AT91BOOTSTRAP3_DEFCONFIG = \ AXEL_DISABLE_I18N=--i18n=0 After this bulk change, following manual fixups were done: - fix line continuation alignment in cegui06 and spice (the sed expression leaves the number of whitespace between the value and line continuation character intact, but the whitespace before that could have changed, causing misalignment. - qt5base was reverted, as this package uses extensive alignment which actually makes the code more readable. Finally, the end result was manually reviewed. Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Cc: Yann E. Morin <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
141 lines
4.9 KiB
Makefile
141 lines
4.9 KiB
Makefile
################################################################################
|
|
#
|
|
# perl
|
|
#
|
|
################################################################################
|
|
|
|
PERL_VERSION_MAJOR = 20
|
|
PERL_VERSION = 5.$(PERL_VERSION_MAJOR).1
|
|
PERL_SITE = http://www.cpan.org/src/5.0
|
|
PERL_SOURCE = perl-$(PERL_VERSION).tar.bz2
|
|
PERL_LICENSE = Artistic or GPLv1+
|
|
PERL_LICENSE_FILES = Artistic Copying README
|
|
PERL_INSTALL_STAGING = YES
|
|
|
|
PERL_CROSS_VERSION = 0.9.2
|
|
PERL_CROSS_BASE_VERSION = 5.$(PERL_VERSION_MAJOR).0
|
|
# DO NOT refactor with the github helper (the result is not the same)
|
|
PERL_CROSS_SITE = http://raw.github.com/arsv/perl-cross/releases
|
|
PERL_CROSS_SOURCE = perl-$(PERL_CROSS_BASE_VERSION)-cross-$(PERL_CROSS_VERSION).tar.gz
|
|
PERL_CROSS_OLD_POD = perl$(subst .,,$(PERL_CROSS_BASE_VERSION))delta.pod
|
|
PERL_CROSS_NEW_POD = perl$(subst .,,$(PERL_VERSION))delta.pod
|
|
|
|
# We use the perlcross hack to cross-compile perl. It should
|
|
# be extracted over the perl sources, so we don't define that
|
|
# as a separate package. Instead, it is downloaded and extracted
|
|
# together with perl
|
|
|
|
define PERL_CROSS_DOWNLOAD
|
|
$(call DOWNLOAD,$(PERL_CROSS_SITE:/=)/$(PERL_CROSS_SOURCE))
|
|
endef
|
|
PERL_POST_DOWNLOAD_HOOKS += PERL_CROSS_DOWNLOAD
|
|
|
|
define PERL_CROSS_EXTRACT
|
|
$(call suitable-extractor,$(PERL_CROSS_SOURCE)) $(DL_DIR)/$(PERL_CROSS_SOURCE) | \
|
|
$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) -
|
|
endef
|
|
PERL_POST_EXTRACT_HOOKS += PERL_CROSS_EXTRACT
|
|
|
|
define PERL_CROSS_SET_POD
|
|
$(SED) s/$(PERL_CROSS_OLD_POD)/$(PERL_CROSS_NEW_POD)/g $(@D)/Makefile
|
|
endef
|
|
PERL_POST_PATCH_HOOKS += PERL_CROSS_SET_POD
|
|
|
|
ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
|
|
PERL_DEPENDENCIES += berkeleydb
|
|
endif
|
|
ifeq ($(BR2_PACKAGE_GDBM),y)
|
|
PERL_DEPENDENCIES += gdbm
|
|
endif
|
|
|
|
# We have to override LD, because an external multilib toolchain ld is not
|
|
# wrapped to provide the required sysroot options. We also can't use ccache
|
|
# because the configure script doesn't support it.
|
|
PERL_CONF_OPTS = \
|
|
--target=$(GNU_TARGET_NAME) \
|
|
--target-tools-prefix=$(TARGET_CROSS) \
|
|
--prefix=/usr \
|
|
-Dld="$(TARGET_CC_NOCCACHE)" \
|
|
-Dccflags="$(TARGET_CFLAGS)" \
|
|
-Dldflags="$(TARGET_LDFLAGS) -lm" \
|
|
-Dmultiarch \
|
|
-Dmydomain="" \
|
|
-Dmyhostname="$(BR2_TARGET_GENERIC_HOSTNAME)" \
|
|
-Dmyuname="Buildroot $(BR2_VERSION_FULL)" \
|
|
-Dosname=linux \
|
|
-Dosvers=$(LINUX_VERSION) \
|
|
-Dperladmin=root
|
|
|
|
ifeq ($(shell expr $(PERL_VERSION_MAJOR) % 2), 1)
|
|
PERL_CONF_OPTS += -Dusedevel
|
|
endif
|
|
|
|
ifeq ($(BR2_PREFER_STATIC_LIB),y)
|
|
PERL_CONF_OPTS += --all-static --no-dynaloader
|
|
endif
|
|
|
|
ifneq ($(BR2_LARGEFILE),y)
|
|
PERL_CONF_OPTS += -Uuselargefiles
|
|
endif
|
|
|
|
PERL_MODULES = $(call qstrip,$(BR2_PACKAGE_PERL_MODULES))
|
|
ifneq ($(PERL_MODULES),)
|
|
PERL_CONF_OPTS += --only-mod=$(subst $(space),$(comma),$(PERL_MODULES))
|
|
endif
|
|
|
|
define PERL_CONFIGURE_CMDS
|
|
(cd $(@D); HOSTCC='$(HOSTCC_NOCACHE)' ./configure $(PERL_CONF_OPTS))
|
|
$(SED) 's/UNKNOWN-/Buildroot $(BR2_VERSION_FULL) /' $(@D)/patchlevel.h
|
|
endef
|
|
|
|
define PERL_BUILD_CMDS
|
|
$(MAKE1) -C $(@D) all
|
|
endef
|
|
|
|
define PERL_INSTALL_STAGING_CMDS
|
|
$(MAKE1) -C $(@D) DESTDIR="$(STAGING_DIR)" install.perl
|
|
endef
|
|
|
|
define PERL_INSTALL_TARGET_CMDS
|
|
$(MAKE1) -C $(@D) DESTDIR="$(TARGET_DIR)" install.perl
|
|
endef
|
|
|
|
# perl infra: fix for Perl XS packages configured by Makefile.PL
|
|
#
|
|
# ExtUtils::MakeMaker adds all the header files used by the perl as
|
|
# dependencies to the generated Makefile. This means that the generated
|
|
# Makefile will depend on the system's header files.
|
|
#
|
|
# Usually this is not a problem, because when building the target package,
|
|
# these header files will indeed be found in $(STAGING_DIR). However, some
|
|
# distro's add an extra header file to the system's perl. This header is
|
|
# also included in the generated Makefile, which makes the build fail
|
|
# because it doesn't exist in $(STAGING_DIR).
|
|
#
|
|
# As a work-around, explicitly create this header file in $(STAGING_DIR).
|
|
# It doesn't hurt to create it even if the system perl doesn't need it.
|
|
#
|
|
define PERL_ADD_CORE_H
|
|
touch $(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE/patchlevel-debian.h
|
|
touch $(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE/patchlevel-gentoo.h
|
|
touch $(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE/cc_runtime.h
|
|
touch $(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE/fakethr.h
|
|
touch $(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE/perlsfio.h
|
|
touch $(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE/vutil.h
|
|
endef
|
|
|
|
PERL_POST_INSTALL_STAGING_HOOKS += PERL_ADD_CORE_H
|
|
|
|
$(eval $(generic-package))
|
|
|
|
define PERL_FINALIZE_TARGET
|
|
rm -rf $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/pod
|
|
rm -rf $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE
|
|
find $(TARGET_DIR)/usr/lib/perl5/ -name 'extralibs.ld' -print0 | xargs -0 rm -f
|
|
find $(TARGET_DIR)/usr/lib/perl5/ -name '*.bs' -print0 | xargs -0 rm -f
|
|
find $(TARGET_DIR)/usr/lib/perl5/ -name '.packlist' -print0 | xargs -0 rm -f
|
|
endef
|
|
|
|
TARGET_FINALIZE_HOOKS += PERL_FINALIZE_TARGET
|
|
|