Browse Source

perl: Add new CONFIG_PERL_THREADS option for enabling threading support

Signed-off-by: Marcel Denia <naoir@gmx.net>
Marcel Denia 10 years ago
parent
commit
4248b8b72d
2 changed files with 23 additions and 2 deletions
  1. 5
    0
      lang/perl/Config.in
  2. 18
    2
      lang/perl/Makefile

+ 5
- 0
lang/perl/Config.in View File

@@ -1,6 +1,11 @@
1 1
 menu "Configuration"
2 2
 	depends on PACKAGE_perl
3 3
 
4
+config PERL_THREADS
5
+    bool "Enable threading support"
6
+    default y if (mips || mipsel || x86 || x86_64 || armeb || arm) && (USE_UCLIBC || USE_EGLIBC)
7
+    default n
8
+
4 9
 config PERL_TESTS
5 10
 	bool "Include perl tests"
6 11
 	default n

+ 18
- 2
lang/perl/Makefile View File

@@ -44,6 +44,20 @@ endif
44 44
 TARGET_CFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CFLAGS))
45 45
 TARGET_CPPFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CPPFLAGS))
46 46
 
47
+# Handle threading
48
+ifdef CONFIG_PERL_THREADS
49
+	PERL_CONFIG_SUFFIX:=-mt
50
+
51
+	# uclibc doesn't provide crypt_r(). Enable crypt() usage for glibc builds only
52
+	ifdef CONFIG_USE_EGLIBC
53
+		CRYPT_R_PROTO:=REENTRANT_PROTO_B_CCS
54
+		CRYPT:=define
55
+	else
56
+		CRYPT_R_PROTO:=0
57
+		CRYPT:=undef
58
+	endif
59
+endif
60
+
47 61
 # A list of disabled testss
48 62
 # ExtUtils tests are disabled for now as we don't support building
49 63
 # native extensions on the target machine at the moment
@@ -64,7 +78,7 @@ define Package/perl
64 78
   CATEGORY:=Languages
65 79
   TITLE:=The Perl intepreter
66 80
   URL:=http://www.perl.com/
67
-  DEPENDS:=+USE_EGLIBC:libbsd
81
+  DEPENDS:=+USE_EGLIBC:libbsd +PERL_THREADS:libpthread
68 82
 endef
69 83
 
70 84
 define Package/perl/description
@@ -108,8 +122,10 @@ define Build/Configure
108 122
 		-e 's!%%EXTRA_PERLLIBDIRS%%!$(EXTRA_LIBDIRS:%=-L%)!g' \
109 123
 		-e 's!%%IPV6%%!$(if $($(CONFIG_IPV6)),define,undef)!g' \
110 124
 		-e 's!%%HOSTMINIPERL%%!$(HOST_PERL_PREFIX)/bin/perl!g' \
125
+		-e 's!%%CRYPT_R_PROTO%%!$(CRYPT_R_PROTO)!g' \
126
+		-e 's!%%CRYPT%%!$(CRYPT)!g' \
111 127
 		-e 's!%%HOSTGENERATE%%!$(HOST_PERL_PREFIX)/bin/generate_uudmap!g' \
112
-		files/config.sh-$(patsubst i386,i486,$(ARCH)).in \
128
+		files/config.sh-$(patsubst i386,i486,$(ARCH))$(PERL_CONFIG_SUFFIX).in \
113 129
 		> $(PKG_BUILD_DIR)/config.sh
114 130
 	(cd $(PKG_BUILD_DIR) && ./Configure -S)
115 131
 	install -m 0644 $(PKG_BUILD_DIR)/config.h $(PKG_BUILD_DIR)/xconfig.h