Opened 5 years ago

Closed 3 years ago

#677 closed enhancement (fixed)

Win32 launcher: embed Perl

Reported by: dolmen Owned by: azawawi
Priority: minor Milestone:
Component: editor Version: trunk
Keywords: win32 launcher Cc: azawawi, Sewi

Description

The current launcher runs WPerl.exe with the 'padre' script as an argument. This launcher has the current flaws:

  • the Padre process is "wperl.exe" in the task list
  • 2 processes are used to

Merging WPerl.exe in Padre.exe would fix those flaws. This is done by embedding Perl.

The launcher source is linked to the perl interpreter, so for maximum compatibility with the perl used on the user platform, the padre.exe would be compiled at install time. The old launcher would be still distributed in binary form as a fallback if build fails.
For ActivePerl?, distribution would be as PPM, so pre-built.

I'm working on this feature.

Attachments (5)

padre.c (2.6 KB) - added by dolmen 5 years ago.
Main launcher source, with embeded Perl.
build.PL (291 bytes) - added by dolmen 5 years ago.
Build script
padre.2.c (3.7 KB) - added by dolmen 4 years ago.
Unfinished launcher (need binding of $X to swWPerlExe)
677-win32-launcher.patch (12.5 KB) - added by dolmen 4 years ago.
Patch with the great new Padre launcher ($X issue fixed, build improved)
677-win32-launcher-2.patch (14.2 KB) - added by dolmen 4 years ago.
Updated patch : fixed manifest res id, improved build, added README update

Download all attachments as: .zip

Change History (18)

Changed 5 years ago by dolmen

Main launcher source, with embeded Perl.

Changed 5 years ago by dolmen

Build script

comment:1 Changed 5 years ago by dolmen

  • Priority changed from major to minor

Here is a prototype to get early feedback.

The build.PL is for the moment too simple (but enough for testing) and would have to be called from the main Padre install script.

The other files required (padre-rc.rc, padre-rc.h) are still the ones committed in [8690].

comment:2 Changed 5 years ago by Sewi

Committed r8701

comment:3 Changed 5 years ago by dolmen

Hum, hum...

As I wrote, it is a "prototype". It is a bit early to commit it. Also I wrote above that the previous launcher should be preserved.

This bug is a place to follow my work on this matter until it is ready.

So it would be better to revert the commit for the moment.

comment:4 Changed 5 years ago by azawawi

Any update on this one?

comment:5 Changed 5 years ago by azawawi

  • Owner changed from dolmen to azawawi
  • Status changed from new to assigned

comment:6 Changed 4 years ago by dolmen

  • Version changed from 0.47 to trunk

My main concern at the time was that the Padre.exe was not built at install time.
But this has been fixed since.

The other concern with the current code is that in the Padre environment $X will be padre.exe (currently it is wperl.exe). But as I'm faking the perl environment command line ([ "padre.exe", @ARGV ] is transformed into [ "padre.exe", "--", "padre", @ARGV ]), any call to $X will relaunch the padre script and open the argument instead of running the script.
So we have to fix $X to point to perl.exe or wperl.exe.
I think we could find where wperl.exe is by finding where the perlxxx.dll has been loaded from by the system linker.

Changed 4 years ago by dolmen

Unfinished launcher (need binding of $X to swWPerlExe)

comment:7 Changed 4 years ago by dolmen

Here is an improved version, but still incomplete.

I need help from someone that knows more about embedding Perl: the code lacks the binding of $X to szWPerlExe.

comment:8 Changed 4 years ago by dolmen

According to Vincent Pit, here is how to set $^X:

SV *sv = GvSV(gv_fetchpvs("\030", GV_ADD|GV_NOTQUAL, SVt_PV)); sv_setpvs(sv, "wut"); SvSETMAGIC(sv);

comment:9 Changed 4 years ago by dolmen

Eureka! The $X issue is fixed!

Here is the final patch:

  • New launcher which embed Perl, so the Padre process appears as Padre.exe instead of wperl.exe
  • Manifest file is now embeded as a resource in the executable (padre.exe.manifest replaces wperl.exe.manifest), so less impact of other applications using wperl.exe
  • The executable is now built using the same flags as Perl.exe using ExtUtils::Embed

Changed 4 years ago by dolmen

Patch with the great new Padre launcher ($X issue fixed, build improved)

comment:10 Changed 4 years ago by CSJewell

Thanks, dolmen!

comment:11 Changed 4 years ago by dolmen

Here is an improved version of the patch:

  • generates the xs_init() function using ExtUtils::Embed::xsinit (see perlembed)
  • updates win32/README to describe the new launcher
  • resource file (padre-rc.rc) is now compiled as a COFF file (.res) which is a step towards compatibility with MSVC
  • fixed the manifest resource ID to really enable Vista/7 styles (verified on Win7)

Note that the win32/wperl.exe.manifest must be renamed (svn move) to padre.exe.manifest before applying the patch as 'svn diff' doesn't report renames.

Changed 4 years ago by dolmen

Updated patch : fixed manifest res id, improved build, added README update

comment:12 Changed 4 years ago by dolmen

Committed by myself in r11150. Thanks for the commit bit.

comment:13 Changed 3 years ago by azawawi

  • Resolution set to fixed
  • Status changed from assigned to closed

dolmen++ # for the great commit :)

Closing bug after 18 months :)

Note: See TracTickets for help on using tickets.