@@ -69,6 +69,20 @@ sub die_with_sample {
69
69
EOF
70
70
chomp $docker_slim_run_purge ;
71
71
72
+ my $docker_rm_sources = <<'OEF' ;
73
+ rm -fr ./cpanm /root/.cpanm /usr/src/perl /usr/src/{{cpanm_dist_name}}* /tmp/*
74
+ OEF
75
+ chomp $docker_rm_sources ;
76
+
77
+ my $docker_rm_sources_install = <<'OEF' ;
78
+ rm -fr ./cpanm /root/.cpanm /tmp/* /usr/src/{{cpanm_dist_name}}* \
79
+ && apt-get update \
80
+ && apt-get install --no-install-recommends -y gdb \
81
+ && rm -fr /var/cache/apt/* /var/lib/apt/lists/*
82
+ OEF
83
+ chomp $docker_rm_sources_install ;
84
+
85
+ chomp $docker_rm_sources ;
72
86
my $config = do {
73
87
open my $fh , ' <' , ' config.yml' or die " Couldn't open config" ;
74
88
local $/ ;
@@ -144,20 +158,22 @@ sub die_with_sample {
144
158
145
159
$release -> {extra_flags } ||= ' ' ;
146
160
$release -> {debian_release } ||= ' stretch' ;
161
+ my $debug_flags = ' ' ;
147
162
148
- if ($build =~ / main/ ) {
163
+ if ($build =~ / ( main|debug) / ) {
149
164
$release -> {image } = ' buildpack-deps' ;
150
165
$release -> {tag } = $release -> {debian_release };
166
+ if ($build =~ / debug/ ) {
167
+ # older versions may required -Doptimise=-g
168
+ $debug_flags = " -Doptimise=-g -DEBUGGING=both" ;
169
+ }
151
170
}
152
171
else {
153
172
$release -> {image } = ' debian' ;
154
173
$release -> {tag } = " @{[ $release ->{debian_release} ]}-slim" ;
155
174
}
156
175
157
176
my $output = $template ;
158
- $output =~ s /\{\{ $_\}\} / $release ->{$_ }/ mg
159
- for (qw( version pause extra_flags sha256 type url image tag cpanm_dist_name cpanm_dist_url cpanm_dist_sha256) );
160
- $output =~ s /\{\{ args\}\} / $builds {$build }/ mg ;
161
177
162
178
if ($build =~ / slim/ ) {
163
179
$output =~ s /\{\{ docker_slim_run_install\}\} / $docker_slim_run_install / mg ;
@@ -168,6 +184,19 @@ sub die_with_sample {
168
184
$output =~ s /\{\{ docker_slim_run_purge\}\} / true/ mg ;
169
185
}
170
186
187
+ if ($build eq ' debug' ) {
188
+ $output =~ s /\{\{ docker_rm_sources\}\} / $docker_rm_sources_install / mg ;
189
+ }
190
+ else {
191
+ $output =~ s /\{\{ docker_rm_sources\}\} / $docker_rm_sources / mg ;
192
+ }
193
+
194
+ $output =~ s /\{\{ $_\}\} / $release ->{$_ }/ mg
195
+ for (qw( version pause extra_flags sha256 type url image tag cpanm_dist_name cpanm_dist_url cpanm_dist_sha256) );
196
+ $output =~ s /\{\{ args\}\} / $builds {$build }/ mg ;
197
+
198
+ $output =~ s / \{\{ debug_flags\}\} / $debug_flags / mg ;
199
+
171
200
my $dir = sprintf " %i .%03i.%03i-%s " , ($release -> {version } =~ / (\d +)\. (\d +)\. (\d +)/ ), $build ;
172
201
173
202
mkdir $dir unless -d $dir ;
@@ -277,7 +306,7 @@ =head1 DESCRIPTION
277
306
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
278
307
&& archBits="$(dpkg-architecture --query DEB_BUILD_ARCH_BITS)" \
279
308
&& archFlag="$([ "$archBits" = '64' ] && echo '-Duse64bitall' || echo '-Duse64bitint')" \
280
- && ./Configure -Darchname="$gnuArch" "$archFlag" {{args}} {{extra_flags}} -des \
309
+ && ./Configure -Darchname="$gnuArch" "$archFlag" {{args}} {{extra_flags}} {{debug_flags}} -des \
281
310
&& make -j$(nproc) \
282
311
&& {{test}} \
283
312
&& make install \
@@ -286,7 +315,7 @@ =head1 DESCRIPTION
286
315
&& echo '{{cpanm_dist_sha256}} *{{cpanm_dist_name}}.tar.gz' | sha256sum -c - \
287
316
&& tar -xzf {{cpanm_dist_name}}.tar.gz && cd {{cpanm_dist_name}} && perl bin/cpanm . && cd /root \
288
317
&& {{docker_slim_run_purge}} \
289
- && rm -fr ./cpanm /root/.cpanm /usr/src/perl /usr/src/{{cpanm_dist_name}}* /tmp/*
318
+ && {{docker_rm_sources}}
290
319
291
320
WORKDIR /root
292
321
0 commit comments