develooper Front page | perl.wxperl.users | Postings from November 2017

RE: [rt.cpan.org #99325] DLLs not stripped under Windows

From:
Neubauer, Ralf via RT
Date:
November 3, 2017 18:06
Subject:
RE: [rt.cpan.org #99325] DLLs not stripped under Windows
Message ID:
rt-4.0.18-5820-1509732413-39.99325-15-0@rt.cpan.org
Fri Nov 03 14:06:52 2017: Request 99325 was acted upon.
Transaction: Correspondence added by Ralf.Neubauer@wido.bv.aok.de
       Queue: Alien-wxWidgets
     Subject: RE: [rt.cpan.org #99325] DLLs not stripped under Windows
   Broken in: (no value)
    Severity: (no value)
       Owner: MDOOTSON
  Requestors: Ralf.Neubauer@wido.bv.aok.de
      Status: open
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=99325 >


Hi,

because the filesizes of our PAR::Packer-packed executables (many different programs in a zip file) i finally came around to implement a-posteriori stripping in a nightly refreshed directory of PPM::Make-generated PPMs.

To spare others the effort, here is my Batch-File:


setlocal enabledelayedexpansion

set TARGET=%1

for /F "usebackq" %%v in (`perl -e "$^V =~ /(\d+)\.(\d+)\.(\d+)/ and print qq{$1.$2}"`) do set PERLREV=%%v
for /F %%a in ('perl -e "use Config; print $Config{archname}"') do set PERLARCH=%%a

set WORK=%TEMP%\strip-dlls-%PERLARCH%-%PERLREV%-%RANDOM%-%RANDOM%

mkdir %WORK%
cd /d %WORK%

if !CD! neq !WORK! exit /b

for %%P in (%TARGET%\Alien-wxWidgets-*.ppd) do (
	set BASE=%%~dpnP
	set PPD=!BASE!.ppd
	set ARCH=!BASE!.tar.gz
	set ARCH_STAMP=!ARCH!.timestamp
	set ARCH_OUT=!BASE!-out.tar.gz
	set ARCH_BAK=!BASE!-orig.tar.gz

	set OLD_STAMP=no old file
	for /F "usebackq tokens=*" %%L in (!ARCH_STAMP!) do set OLD_STAMP=%%L
	echo OLD_STAMP=_!OLD_STAMP!_

	set NEW_STAMP=no new file
	for %%F in (!ARCH!) do set NEW_STAMP=%%~tzF
	echo NEW_STAMP=_!NEW_STAMP!_

	if !OLD_STAMP! neq !NEW_STAMP! (
		call ptar -xzf !ARCH!

		for /R . %%D in (*.dll) do (
			attrib -r %%D
			strip %%D
			attrib +r %%D
		)

		call ptar -czCf !ARCH_OUT! blib

		rem del /S /Q /F blib

		rem Löscht alle Dateien, aber nur eine Verzeichnisebene
		rmdir /S /Q blib
		if exist blib rmdir /S /Q blib
		if exist blib rmdir /S /Q blib
		if exist blib rmdir /S /Q blib
		if exist blib rmdir /S /Q blib
		if exist blib rmdir /S /Q blib

		move /Y !ARCH! !ARCH_BAK!
		move /Y !ARCH_OUT! !ARCH!
		for %%F in (!ARCH!) do (
			rem Vor dem Größerzeichen darf kein Blank sein
			echo %%~tzF> !ARCH_STAMP!
		)
	)
)

rem Free in-use reference
cd \

rmdir %WORK%



Ralf



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About