Re: [Lazarus] Deep exe strip :)

2012-10-26 Thread Martin

On 26/10/2012 16:48, Bernd wrote:

[x] ignore "build lazarus"-settings and compile LCL and other
dependent packages with project settings.



You are aware, that not all packages follow the "build lazarus" settings?
Only packages that use (or depend on) $(IDEBuildOptions)

That is usually packages that have $(IDEBuildOptions) in their own 
Other/Custom Options
Or packages that depend an a package that has $(IDEBuildOptions) in 
**Usage**/Custom



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-26 Thread Martin

On 26/10/2012 18:50, Martin wrote:


Put
   $(MyProjectOpts)
in each of your packages "tab: Other" > "Custom Options"

Then in your Project define under "IDE Macro Values" (for the desired 
build mode)

Macro Name: MyProjectOpts
Macro Value: -g- -O3 -XX -CX -Xs



And to clarify.

I an saying:
- It is possible with build modes
- It should be done with buildmodes
- This is one way
- Mos of all: it does not need a chekbox "smallest build" or any check 
box, that is a just a preset for a combination of existing checkboxes


I am **NOT** saying:
- This is the easiest way
- If or if not there is a way, that is wore self explaining.
- If or if not it could or should be made easier by adding other ways of 
forcing settings for packages





--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-26 Thread patspiper

On 26/10/12 17:21, Martin wrote:

On 26/10/2012 15:05, Kostas Michalopoulos wrote:

So all the steps that Krzysztof mentioned in his initial message can
be done in a buildmode?

Yes, or yes they should.

That is, if they can all be set in the options dialog. If any of them 
can not be set there, then that is a different problem. (I believe 
they can, but I have not tested)
That would still NOT mean the need for one checkbox named "create 
smallest executable".
It would mean, that this particular setting would need to be added to 
the project-compiler-settings.


So if we have all the individual settings avail there, then it can be 
done with a build mode.


I have not tested if they are there (note that a lot can be done by 
adding custom compiler options ("other" tab) too.


And there are build macros, which can also be used.  I have in the 
past used them, to use the same package across several projects, but 
build with different settings. This definitely works. (And recompiles 
used packages, if needed)

A more complex situation can arise when cross-compiling:
- Win32 debug
- Win32 release
- Linux debug
- Linux release
and that is assuming default/common widgetsets.

What is needed is something like buildmode modifiers.

Stephano

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-26 Thread Martin

On 26/10/2012 16:48, Bernd wrote:

2012/10/26 Martin :

Changing the buildmode should already rebuild the LCL (if something relevant
changed, compared to the previous buildmode)

Is this in trunk (1.1) because I cannot observe the behavior you
describe in 1.0.3, no matter what compiler or linker settings I set in
my project options, they will only affect the project itself, I could
not find a way to have the LCL compiled with any different settings
than what is defined in the "Build Lazarus" -Settings. I think what
the OP is missing (and I think it would be useful too) would be an
option in the project settings, someting like:

[x] ignore "build lazarus"-settings and compile LCL and other
dependent packages with project settings.



It depends on the setting, I thing it only applies to build macros. But 
they can be used to change settings in other packages.


Anyway, the initial statement (that was even before the question of how 
to recompile packages) was "do we need a checkbox, to build smallest?". 
And I still say no. It can be done via build modes.

- It may not be easy at current.
- And there may be a case for a pre-defined build mode.
- But there is no case for the "build smallest" checkbox.

There may be a need to make certain setup tasks easier or more obvious. 
But that was not part of my original answer.


Put
   $(MyProjectOpts)
in each of your packages "tab: Other" > "Custom Options"

Then in your Project define under "IDE Macro Values" (for the desired 
build mode)

Macro Name: MyProjectOpts
Macro Value: -g- -O3 -XX -CX -Xs

and that should do.











--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-26 Thread Bernd
2012/10/26 Martin :
>
> Changing the buildmode should already rebuild the LCL (if something relevant
> changed, compared to the previous buildmode)

Is this in trunk (1.1) because I cannot observe the behavior you
describe in 1.0.3, no matter what compiler or linker settings I set in
my project options, they will only affect the project itself, I could
not find a way to have the LCL compiled with any different settings
than what is defined in the "Build Lazarus" -Settings. I think what
the OP is missing (and I think it would be useful too) would be an
option in the project settings, someting like:

[x] ignore "build lazarus"-settings and compile LCL and other
dependent packages with project settings.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-26 Thread Martin

On 26/10/2012 15:05, Kostas Michalopoulos wrote:

So all the steps that Krzysztof mentioned in his initial message can
be done in a buildmode?

Yes, or yes they should.

That is, if they can all be set in the options dialog. If any of them 
can not be set there, then that is a different problem. (I believe they 
can, but I have not tested)
That would still NOT mean the need for one checkbox named "create 
smallest executable".
It would mean, that this particular setting would need to be added to 
the project-compiler-settings.


So if we have all the individual settings avail there, then it can be 
done with a build mode.


I have not tested if they are there (note that a lot can be done by 
adding custom compiler options ("other" tab) too.


And there are build macros, which can also be used.  I have in the past 
used them, to use the same package across several projects, but build 
with different settings. This definitely works. (And recompiles used 
packages, if needed)





On Fri, Oct 26, 2012 at 2:25 PM, Martin  wrote:

On 26/10/2012 12:27, Kostas Michalopoulos wrote:

Build modes are something else (groups of option presets). What i'm
talking about would be a checkbox that you check in your "release"
build mode so that it builds the smallest executable using a "release"
build of LCL with no debug info whatsoever and you have unchecked in
"debug" build mode which uses a "normal" build.

I think this also needs LCL to not be rebuilt at the same place so
that changing build mode wont rebuild the whole world.


Changing the buildmode should already rebuild the LCL (if something relevant
changed, compared to the previous buildmode)

So 1 buildmodes "release fastest", "release smallest" should be all you need


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-26 Thread Kostas Michalopoulos
So all the steps that Krzysztof mentioned in his initial message can
be done in a buildmode?

On Fri, Oct 26, 2012 at 2:25 PM, Martin  wrote:
> On 26/10/2012 12:27, Kostas Michalopoulos wrote:
>>
>> Build modes are something else (groups of option presets). What i'm
>> talking about would be a checkbox that you check in your "release"
>> build mode so that it builds the smallest executable using a "release"
>> build of LCL with no debug info whatsoever and you have unchecked in
>> "debug" build mode which uses a "normal" build.
>>
>> I think this also needs LCL to not be rebuilt at the same place so
>> that changing build mode wont rebuild the whole world.
>>
>
> Changing the buildmode should already rebuild the LCL (if something relevant
> changed, compared to the previous buildmode)
>
> So 1 buildmodes "release fastest", "release smallest" should be all you need
>
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-26 Thread Martin

On 26/10/2012 12:27, Kostas Michalopoulos wrote:

Build modes are something else (groups of option presets). What i'm
talking about would be a checkbox that you check in your "release"
build mode so that it builds the smallest executable using a "release"
build of LCL with no debug info whatsoever and you have unchecked in
"debug" build mode which uses a "normal" build.

I think this also needs LCL to not be rebuilt at the same place so
that changing build mode wont rebuild the whole world.



Changing the buildmode should already rebuild the LCL (if something 
relevant changed, compared to the previous buildmode)


So 1 buildmodes "release fastest", "release smallest" should be all you need

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-26 Thread Kostas Michalopoulos
Build modes are something else (groups of option presets). What i'm
talking about would be a checkbox that you check in your "release"
build mode so that it builds the smallest executable using a "release"
build of LCL with no debug info whatsoever and you have unchecked in
"debug" build mode which uses a "normal" build.

I think this also needs LCL to not be rebuilt at the same place so
that changing build mode wont rebuild the whole world.

On Thu, Oct 25, 2012 at 5:54 PM, Martin  wrote:
> On 25/10/2012 14:29, Kostas Michalopoulos wrote:
>>
>> I think there should be a one checkbox solution in project settings
>> that builds (and rebuilds) stuff with the proper settings to make
>> things compact. From what i understand the current situation is way
>> too complex.
>>
> It is possible.
>
> Look on the wiki for build modes.
>
> The only thing missing are preset modes
>
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-25 Thread Martin

On 25/10/2012 14:29, Kostas Michalopoulos wrote:

I think there should be a one checkbox solution in project settings
that builds (and rebuilds) stuff with the proper settings to make
things compact. From what i understand the current situation is way
too complex.


It is possible.

Look on the wiki for build modes.

The only thing missing are preset modes

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-25 Thread leledumbo
> Is exists any global strip to get the smallest possible exe size?

Not to my knowledge, but in my version (1.1 about 1 month ago) if I change
build mode then all dependencies are recompiled, with the same options I
guess, because I got a slightly smaller binary.



--
View this message in context: 
http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Deep-exe-strip-tp4027310p4027367.html
Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-25 Thread Kostas Michalopoulos
I think there should be a one checkbox solution in project settings
that builds (and rebuilds) stuff with the proper settings to make
things compact. From what i understand the current situation is way
too complex.

On Thu, Oct 25, 2012 at 1:35 PM, Martin  wrote:
> On 25/10/2012 11:50, Krzysztof wrote:
>>>
>>> Does the size change if you do a
>>>
>>> strip --strip-all executable
>>>
>>> in one of the large versions down to the small version?
>>
>> With strip-all I can't get the smallest exe which I get with lazarus
>> switchers - 3.7 MB
>>
>
> strip and smart-linking/linkable are not related.
> - strip can and will only remove debug info.
> - Smart link can remove unused code.
>
> And you can go further and try
> http://wiki.freepascal.org/Whole_Program_Optimization
>
>
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-25 Thread Martin

On 25/10/2012 11:50, Krzysztof wrote:

Does the size change if you do a

strip --strip-all executable

in one of the large versions down to the small version?

With strip-all I can't get the smallest exe which I get with lazarus
switchers - 3.7 MB



strip and smart-linking/linkable are not related.
- strip can and will only remove debug info.
- Smart link can remove unused code.

And you can go further and try 
http://wiki.freepascal.org/Whole_Program_Optimization



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-25 Thread Krzysztof
> Does the size change if you do a
>
> strip --strip-all executable
>
> in one of the large versions down to the small version?

With strip-all I can't get the smallest exe which I get with lazarus
switchers - 3.7 MB

> Note that you do not actually need to rebuild the IDE, it is enough to
> just change the IDE build options, save and then rebuild your project.
> It will then rebuild on demand only those parts of the LCL and
> packages for your project that are actually needed by your project and
> not the entire IDE.

Thanks, I didn't know that. But why I must uncheck "create debug info"
in each project required package when I have this option disabled in
project options?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-24 Thread Bernd
2012/10/24 Krzysztof :

>
> 2. Same project options, but IDE rebuild with -CX and -XX options

Note that you do not actually need to rebuild the IDE, it is enough to
just change the IDE build options, save and then rebuild your project.
It will then rebuild on demand only those parts of the LCL and
packages for your project that are actually needed by your project and
not the entire IDE.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-24 Thread Kostas Michalopoulos
Does the size change if you do a

strip --strip-all executable

in one of the large versions down to the small version?

On Wed, Oct 24, 2012 at 3:02 PM, Krzysztof  wrote:
> Hi,
>
> I did some tests with linking options. Tested on CodeTyphon 2.90,
> Linux mint GTK2 64bit. Empty form:
>
> 1. Project options:
>   - smart linking (-CX),
>   - optimization level 3,
>   - unchecked "create debugger information"
>   - clear debug symbolx (-Xs)
>   - smart linking (-XX)
>
> Result: 5 MB
>
>
> 2. Same project options, but IDE rebuild with -CX and -XX options
>
> Result: 2.9 MB
>
> 3. Same options but added VirtualTreeView control from additional package
>
> Result: 3.8 MB
>
> 3. Same options but rebuild VirtualTreeView package with unchecked
> option "create debugger information"
>
> Result: 3.6 MB
>
> My question is: Is exists any global strip to get the smallest
> possible exe size? Why when I have configured "release" build mode in
> my project with all "striping" and smart linking, requied packages
> still have debuger informations and I must uncheck and rebuild it
> manually? I'm not complaining, I'm just curious :) . For example
> rebuild 4 requied packages with unchecked "create debugger info" in my
> project, I get exe smaller by 1MB
>
> Regards.
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Deep exe strip :)

2012-10-24 Thread Krzysztof
Hi,

I did some tests with linking options. Tested on CodeTyphon 2.90,
Linux mint GTK2 64bit. Empty form:

1. Project options:
  - smart linking (-CX),
  - optimization level 3,
  - unchecked "create debugger information"
  - clear debug symbolx (-Xs)
  - smart linking (-XX)

Result: 5 MB


2. Same project options, but IDE rebuild with -CX and -XX options

Result: 2.9 MB

3. Same options but added VirtualTreeView control from additional package

Result: 3.8 MB

3. Same options but rebuild VirtualTreeView package with unchecked
option "create debugger information"

Result: 3.6 MB

My question is: Is exists any global strip to get the smallest
possible exe size? Why when I have configured "release" build mode in
my project with all "striping" and smart linking, requied packages
still have debuger informations and I must uncheck and rebuild it
manually? I'm not complaining, I'm just curious :) . For example
rebuild 4 requied packages with unchecked "create debugger info" in my
project, I get exe smaller by 1MB

Regards.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus