Re: Changing Icon for Standalone Executable
"bubnikv ." <[email protected]> Fri, 20 Jan 2017 20:02:33 +0100
| Newsgroups | gmane.comp.lang.perl.wxperl |
|---|---|
| Message-ID | <CAAE6Juz2iiYE8EVnQ7fiwGGZzkof6gVQCb43vgCUiJ3J0UYzvg@mail.gmail.com> |
--001a114fd330dd084505468b4a45 Content-Type: text/plain; charset=UTF-8 > But you give up the niceness of having a single binary to distribute. Frankly I don't like the 'niceness' of the PAR packer at all. Behind the scenes it unpacks the content of the archive somewhere, where it is cached. So if you install the application into a system install, then there will be a copy created for each and every user, who ever starts your application. On Fri, Jan 20, 2017 at 7:50 PM, Johan Vromans <[email protected]> wrote: > I see. > > But you give up the niceness of having a single binary to distribute. > > -- Johan > > On Fri, 20 Jan 2017 18:15:06 +0100, "bubnikv ." <[email protected]> wrote: > > > you may instruct the PAR packer to create a PAR archive. Just rename it > to > > zip and open it to view the files it collected. > > Or run PAR packer with the -v parameter to let it print out the > > dependencies. > > > > Then you just need to collect the perl.exe, perl.dll, all the referenced > > perl modules and their binary dll counterparts into a similar structure > to > > the perl installation. As the strawberry perl is relocatable, it will > > search for the perl modules and dlls relatively to its installation path. > > > > In regard to the exe you want to create, you need to compile a following > c > > file to produce the exe: > > > > #include <EXTERN.h> // from the Perl distribution > > #include <perl.h> // from the Perl distribution > > > > // Perl win32 specific includes, found in perl\\lib\\CORE\\win32.h > > // Defines the windows specific convenience RunPerl() function, > > // which is not available on other operating systems. > > #include <win32.h> > > // the standard Windows. include > > #include <Windows.h> > > > > int main(int argc, char **argv, char **env) > > { > > char exe_path[MAX_PATH] = {0}; > > char drive[_MAX_DRIVE]; > > char dir[_MAX_DIR]; > > char fname[_MAX_FNAME]; > > char ext[_MAX_EXT]; > > char script_path[MAX_PATH]; > > char** command_line = (char**)malloc(sizeof(char*) * ((++ argc) + > > 1)); > > GetModuleFileNameA(NULL, exe_path, MAX_PATH-1); > > _splitpath(exe_path, drive, dir, fname, ext); > > _makepath(script_path, drive, dir, NULL, NULL); > > SetDllDirectoryA(script_path); > > _makepath(script_path, drive, dir, "your_main_perl_script", > "pl"); > > command_line[0] = exe_path; > > command_line[1] = script_path; > > memcpy(command_line + 2, argv + 1, sizeof(char*) * (argc - 2)); > > command_line[argc] = NULL; > > RunPerl(argc, command_line, NULL); > > free(command_line); > > } > > > > > > On Fri, Jan 20, 2017 at 5:02 PM, Johan Vromans <[email protected]> > > wrote: > > > > > On Fri, 20 Jan 2017 16:42:20 +0100, "bubnikv ." <[email protected]> > > > wrote: > > > > > > > The way I chose is to completely skip the PAR archive, collect the > > > > files manually (maybe use the PAR packer just to discover the > > > > dependencies) and then to compile an exe wrapper over perl.dll. > > > > > > Would you be so kind to explain this approach in a bit more detail? > > > > > > > -- > ------------------------------------------------------------ > ---------------- > Johan Vromans > [email protected] > Squirrel Consultancy Exloo, the > Netherlands > http://www.squirrel.nl > http://johan.vromans.org > PGP Key 1024D/1298C2B4 http://johan.vromans.org/ > pgpkey.html > ----------------------- "Arms are made for hugging" > ------------------------ > --001a114fd330dd084505468b4a45 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div><span style=3D"font-size:12.8px">> But you give up= the niceness of having a single binary to distribute.</span><br></div><div= ><span style=3D"font-size:12.8px"><br></span></div>Frankly I don't like= the 'niceness' of the PAR packer at all. Behind the scenes it unpa= cks the content of the archive somewhere, where it is cached. So if you ins= tall the application into a system install, then there will be a copy creat= ed for each and every user, who ever starts your application.</div><div cla= ss=3D"gmail_extra"><br><div class=3D"gmail_quote">On Fri, Jan 20, 2017 at 7= :50 PM, Johan Vromans <span dir=3D"ltr"><<a href=3D"mailto:jvromans@squi= rrel.nl" target=3D"_blank">[email protected]</a>></span> wrote:<br><b= lockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px = #ccc solid;padding-left:1ex">I see.<br> <br> But you give up the niceness of having a single binary to distribute.<br> <br> -- Johan<br> <div class=3D"HOEnZb"><div class=3D"h5"><br> On Fri, 20 Jan 2017 18:15:06 +0100, "bubnikv ." <<a href=3D"ma= ilto:[email protected]">[email protected]</a>> wrote:<br> <br> > you may instruct the PAR packer to create a PAR archive. Just rename i= t to<br> > zip and open it to view the files it collected.<br> > Or run PAR packer with the -v parameter to let it print out the<br> > dependencies.<br> ><br> > Then you just need to collect the perl.exe, perl.dll, all the referenc= ed<br> > perl modules and their binary dll counterparts into a similar structur= e to<br> > the perl installation. As the strawberry perl is relocatable, it will<= br> > search for the perl modules and dlls relatively to its installation pa= th.<br> ><br> > In regard to the exe you want to create, you need to compile a followi= ng c<br> > file to produce the exe:<br> ><br> > #include <EXTERN.h> // from the Perl distribution<br> > #include <perl.h> // from the Perl distribution<br> ><br> >=C2=A0 =C2=A0 =C2=A0// Perl win32 specific includes, found in perl\\lib= \\CORE\\win32.h<br> >=C2=A0 =C2=A0 =C2=A0// Defines the windows specific convenience RunPerl= () function,<br> >=C2=A0 =C2=A0 =C2=A0// which is not available on other operating system= s.<br> >=C2=A0 =C2=A0 =C2=A0#include <win32.h><br> >=C2=A0 =C2=A0 =C2=A0// the standard Windows. include<br> >=C2=A0 =C2=A0 =C2=A0#include <Windows.h><br> ><br> >=C2=A0 =C2=A0 =C2=A0int main(int argc, char **argv, char **env)<br> >=C2=A0 =C2=A0 =C2=A0{<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0char exe_path[MAX_PATH] =3D {0};<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0char drive[_MAX_DRIVE];<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0char dir[_MAX_DIR];<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0char fname[_MAX_FNAME];<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0char ext[_MAX_EXT];<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0char script_path[MAX_PATH];<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0char** command_line =3D (char**)mallo= c(sizeof(char*) * ((++ argc) +<br> > 1));<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0GetModuleFileNameA(NULL, exe_path, MA= X_PATH-1);<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0_splitpath(exe_path, drive, dir, fnam= e, ext);<br> > _makepath(script_path, drive, dir, NULL, NULL);<br> > SetDllDirectoryA(script_path);<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0_makepath(script_path, drive, dir, &q= uot;your_main_perl_script", "pl");<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0command_line[0] =3D exe_path;<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0command_line[1] =3D script_path;<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0memcpy(command_line + 2, argv + 1, si= zeof(char*) * (argc - 2));<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0command_line[argc] =3D NULL;<br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RunPerl(argc, command_line, NULL);<br= > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0free(command_line);<br> >=C2=A0 =C2=A0 =C2=A0}<br> ><br> ><br> > On Fri, Jan 20, 2017 at 5:02 PM, Johan Vromans <<a href=3D"mailto:j= [email protected]">[email protected]</a>><br> > wrote:<br> ><br> > > On Fri, 20 Jan 2017 16:42:20 +0100, "bubnikv ." <<a = href=3D"mailto:[email protected]">[email protected]</a>><br> > > wrote:<br> > ><br> > > > The way I chose is to completely skip the PAR archive, colle= ct the<br> > > > files manually (maybe use the PAR packer just to discover th= e<br> > > > dependencies) and then to compile an exe wrapper over perl.d= ll.<br> > ><br> > > Would you be so kind to explain this approach in a bit more detai= l?<br> > ><br> <br> <br> <br> </div></div><span class=3D"HOEnZb"><font color=3D"#888888">--<br> ------------------------------<wbr>------------------------------<wbr>-----= -----------<br> Johan Vromans=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0<a href=3D"mailto:[email protected]">jvromans@squirrel.= nl</a><br> Squirrel Consultancy=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Exloo, the = Netherlands<br> <a href=3D"http://www.squirrel.nl" rel=3D"noreferrer" target=3D"_blank">htt= p://www.squirrel.nl</a>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <a href=3D"http://joha= n.vromans.org" rel=3D"noreferrer" target=3D"_blank">http://johan.vromans.or= g</a><br> PGP Key 1024D/1298C2B4=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 <a href=3D"http://johan.vromans.org/pgpkey.html" rel=3D"noreferr= er" target=3D"_blank">http://johan.vromans.org/<wbr>pgpkey.html</a><br> ----------------------- "Arms are made for hugging" -------------= -----------<br> </font></span></blockquote></div><br></div> --001a114fd330dd084505468b4a45--