summaryrefslogtreecommitdiff
path: root/dev-perl/IO-Compress-Brotli/files/IO-Compress-Brotli-0.010-unbundle.patch
blob: ab0fa2e133d8990405fdb7f75993e77cf9afb74f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
diff --git a/Makefile.PL b/Makefile.PL
index 3c92f12..00ff4e3 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,6 +1,5 @@
 use 5.014000;
 use ExtUtils::MakeMaker;
-use Alien::cmake3;
 use File::Spec::Functions qw/catfile/;
 use Config;
 
@@ -9,6 +8,12 @@ if ($Config{myuname} =~ /strawberry/i) {
     $cmake_options = ($Config{cc} =~ /gcc/i) ? ' -G "MinGW Makefiles" ' : '';
 }
 
+my $bundled = $ENV{IO_COMPRESS_BROTLI_BUNDLED} || 0;
+
+# Avoid unnecessary dependency
+use if $bundled, 'Alien::cmake3';
+
+
 WriteMakefile(
 	NAME             => 'IO::Compress::Brotli',
 	VERSION_FROM     => 'lib/IO/Compress/Brotli.pm',
@@ -23,6 +28,7 @@ WriteMakefile(
 		'Getopt::Long'  => '0',
 		'Time::HiRes'   => '0',
 	},
+  ( $bundled )  ? (
 	CONFIGURE_REQUIRES   => {
 		'Alien::cmake3' => '0',
 	},
@@ -32,6 +38,9 @@ WriteMakefile(
 	INC              => '-Ibrotli/c/include',
 	MYEXTLIB         => 'brotli/libbrotlienc$(LIB_EXT) brotli/libbrotlidec$(LIB_EXT) brotli/libbrotlicommon$(LIB_EXT)',
 	clean            => { FILES => 'brotli/Makefile brotli/libbrotlienc$(LIB_EXT) brotli/libbrotlidec$(LIB_EXT) brotli/libbrotlicommon$(LIB_EXT) brotli/CMakeCache.txt brotli/CMakeFiles/* brotli/CTestTestfile.cmake brotli/DartConfiguration.tcl brotli/brotli brotli/cmake_install.cmake brotli/libbrotlicommon.pc brotli/libbrotlidec.pc brotli/libbrotlienc.pc' },
+  ) : (
+	LIBS => ['-lbrotlienc -lbrotlidec'],
+  ),
 	META_ADD         => {
 		dynamic_config => 0,
 		resources      => {
@@ -41,6 +50,7 @@ WriteMakefile(
 );
 
 sub MY::postamble {
+    return '' unless $bundled;
     my @dirs = Alien::cmake3->bin_dir;
     my $cmake = defined $dirs[0] ? catfile($dirs[0] , Alien::cmake3->exe) : Alien::cmake3->exe;
 '