Menu

[r2010]: / trunk / Build.html  Maximize  Restore  History

Download this file

1039 lines (884 with data), 28.6 kB

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
* Build.html
*
* Instructions for building CodeSnip.
*
* $Rev$
* $Date$
*
* ***** BEGIN LICENSE BLOCK *****
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* The Original Code is Build.html
*
* The Initial Developer of the Original Code is Peter Johnson
* (http://www.delphidabbler.com/).
*
* Portions created by the Initial Developer are Copyright (C) 2009-2012 Peter
* Johnson. All Rights Reserved.
*
* Contributors:
* NONE
*
* ***** END LICENSE BLOCK *****
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>
Building CodeSnip
</title>
<style type="text/css">
body {
font-family: sans-serif;
}
dt.spaced {
margin-top: 0.5em;
}
h1 {
text-align: center;
}
h2 {
padding-bottom: 0.25em;
border-bottom: 1px silver solid;
}
.indent {
margin-left: 2em;
}
ul.spaced li,
ol.spaced li {
margin-top: 0.5em;
}
p, div.spaced {
padding: 0;
margin: 0.5em 0;
}
.box, .cmd {
padding: 0.25em;
background-color: #eef;
border: 1px solid silver;
}
.cmd {
margin-left: 2em;
margin-right: 2em;
font-weight: bold;
}
.prompt {
color: blue;
}
</style>
</head>
<body>
<h1>
CodeSnip Build Instructions
</h1>
<h2>
Introduction
</h2>
<p>
<em>CodeSnip</em> is written in Object Pascal and is targeted at Delphi
2010. It requires some language features introduced in this version so will
not compile with any earlier compilers. The code <em>may</em> compile with
Delphi XE or as a 32 bit application on Delphi XE2 but neither have been
tested.
</p>
<p>
The Delphi 2010 IDE can be used to modify the source and to perform test
builds. Final builds should be built using the provided makefile, but you
can get away with using the IDE if you don't change any resources or the
type library.
</p>
<p>
<em>If you want to compile with an earlier Delphi, </em>CodeSnip<em> was
compatible with Delphi 2006 and later up to and including v3.5.4. You could
fetch the source for an earlier version from the repository. If you do this
you should refer to the version of this file that accompanied the chosen
version.</em>
</p>
<h2>
Dependencies
</h2>
<p>
Several DelphiDabbler and other 3rd party libraries and components are
required to compile <em>CodeSnip</em>, most of which are included in the
code repository in the <code>Src/3rdParty</code> directory. Code not
included in the repository is noted below.
</p>
<h3>
Indy libraries v10
</h3>
<p>
The Indy 10 Internet components ship with Delphi 2010.
If you prefer to work with the latest release you can download it from <a
href="http://www.indyproject.org/"
>http://www.indyproject.org/</a>. If you download a copy of Indy 10 you
should compile the source code separately with the same version of Delphi
that is being used to compile <em>CodeSnip</em>.
</p>
<p>
Regardless of whether you are using the version of Indy 10 supplied with
Delphi or if you have downloaded and compiled your own version, you must set
the <code>INDY10</code> environment variable to the directory where you
placed the compiled code.
</p>
<h4 id="indychanges">
Changes between different Indy 10 releases
</h4>
<p>
Changes were made to the parameter lists of the <var>TWorkBeginEvent</var>
and <var>TWorkEvent</var> events between early and later releases of Indy
10. Specifically, earlier versions use type <var>Integer</var> for the
<var>AWorkCount</var> parameter of <var>TWorkEvent</var> and the
<var>AWorkCountMax</var> parameter of <var>TWorkBeginEvent</var>, while
later versions use <var>Int64</var>.
<p>
<p>
<em>CodeSnip</em>'s source code uses conditional compilation to provide the
correct event handler signatures &ndash; and it makes an intelligent guess
at which signature to use depending on the version number provided by the
Indy library code. Should the program fail to compile with an error in the
<var>UDownloadMonitor</var> unit, you should check the event signatures in
your Indy <var>IdComponent</var> unit and then define the
<code>INDY_WORKEVENT_INT64</code> environment variable if <var>Int64</var>
parameters are required or <code>INDY_WORKEVENT_INT32</code> if
<var>Integer</var> parameters are used.
</p>
<h3>
Delphi RTL &amp; VCL
</h3>
<p>
Goes without saying really, but you need the RTL and VCL that ships with
Delphi.
</p>
<h2>
Build Tools
</h2>
<p>
The following tools are required to build <em>CodeSnip</em>.
</p>
<h3>
Delphi
</h3>
<p>
A copy of the Delphi 2010 command line compiler is required to build the
object Pascal code from the provided makefile.
</p>
<p>
You can use the Delphi IDE to edit the code and test compile it, but final
builds should be created using the makefile, which requires the following
tools that are supplied with Delphi:
</p>
<dl>
<dt class="spaced">
<code>DCC32</code>
</dt>
<dd>
The Delphi command line compiler.
</dd>
<dt class="spaced">
<code>BRCC32</code>
</dt>
<dd>
The Borland resource compiler. Used to compile various resource source
(<code>.rc</code>) files.
</dd>
<dt class="spaced">
<code>TLibImpl</code>
</dt>
<dd>
Type library importer tool. Used to create a Pascal unit that describes
code contained in <code>ExternalObj.idl</code>.
</dd>
</dl>
<p>
The following environment variables are associated with these tools:
</p>
<dl>
<dt class="spaced">
<code>DELPHIROOT</code> - required unless <code>DELPHI2010</code> is
set.
</dt>
<dd>
Should be set to the install directory of the version of Delphi being
used. <code>DCC32</code>, <code>BRCC32</code> and <code>TLibImpl</code>
are expected to be in the <code>Bin</code> sub-directory of
<code>DELPHIROOT</code>.
</dd>
<dt class="spaced">
<code>DELPHI2010</code> - optional
</dt>
<dd>
This environment variable can be set to the Delphi 2010 install
directory. When <code>DELPHI2010</code> is defined
<code>DELPHIROOT</code> will be set to the value of
<code>DELPHI2010</code>.
</dd>
<dt class="spaced">
<code>INDY10</code> - required
</dt>
<dd>
Must be set to the directory where the Indy 10 components are installed.
The code must have been built with the same version of Delphi used to
compile <em>CodeSnip</em>.
</dd>
<dt class="spaced">
<code>INDY_WORKEVENT_INT64</code> <strong>or</strong>
<code>INDY_WORKEVENT_INT32</code> - optional
</dt>
<dd>
<a href="#indychanges">See above</a> for details. If used, only one of
the environment variables may be defined. Defining both causes
compilation to fail.
</dd>
</dl>
<h3>
Borland MAKE
</h3>
<p>
This is the make tool that ships with Delphi. You can use any version that
works.
</p>
<h3 id="mssdk">
Microsoft Software Development Kit
</h3>
<p>
The MIDL IDL compiler that ships with the MS SDK is required to build
<code>ExternalObj.tlb</code> from <code>ExternalObj.idl</code>.
</p>
<p>
MIDL requires the use of Microsoft's <code>CL.exe</code> C Pre-processor
which in turn requires <code>mspdb**.dll</code>, where ** is a number that
depends on the version of Visual Studio used. I use MIDL v7 and
<code>mspdb80.dll</code> from the Windows 2008 (v6.1) platform SDK. So that
MIDL can find these files you need to update your system PATH to include:
</p>
<ul class="spaced">
<li>
The path to <code>CL.exe</code>. This will probably be in a sub folder
of a MS Visual Studio installation folder. For example
<code>C:\Program Files\Microsoft Visual Studio 9.0\VC\bin</code>.
</li>
<li>
The Common Visual studio binary directory where <code>mspdb**.dll</code>
is located. For example
<code>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE</code>.
</li>
</ul>
<p>
The <code>MSSDK</code> environment variable must be set and contain the
MS SDK install directory. <code>MIDL.exe</code> must be in the
<code>Bin</code> sub-directory of <code>MSSDK</code> and the required
include files must be in the <code>Include</code> sub-directory.
</p>
<p>
You can use a batch file with contents similar to the following to set the
path and the <code>MSSDK</code> environment variable before building
<em>CodeSnip</em>:
</p>
<pre class="indent">if not "%PATHSET%" == "" goto end
set MSSDK=C:\Program Files\Microsoft SDKs\Windows\v6.1
set PATH=%PATH%;C:\Program Files\Microsoft Visual Studio 9.0\VC\bin
set PATH=%PATH%;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
set PATHSET=1
:end</pre>
<p>
<strong>Note:</strong> You do not need a copy of Visual Studio for this
&ndash; the required directories and files are created when the SDK is
installed.
</p>
<h4>
Build Without MIDL or the MS SDK
</h4>
<p>
If you don't already have the MS SDK it's a big job to download and install
it just to compile one <code>.tlb</code> file. Therefore there's an
alternative that means you can compile without the SDK. This is described
in the section
<a
href="#nomidl"
>Editing and Compiling Without MIDL</a> below.
</p>
<p>
If you take this route, there's no need to set <code>MSSDK</code> or modify
the path.
</p>
<h3>
DelphiDabbler Version Information Editor (VIEd)
</h3>
<p>
This tool is used to compile version information (<code>.vi</code>) files
into intermediate resource source (<code>.rc</code>) files. Version 2.11.2
or later is required.
Version Information Editor can be obtained from
<a
href="http://www.delphidabbler.com/software/vied"
>http://www.delphidabbler.com/software/vied</a>.
</p>
<p>
The program is expected to be on the path unless its install directory is
specified by the <code>VIEDROOT</code> environment variable.
</p>
<h3>
DelphiDabbler HTML Resource Compiler (HTMLRes)
</h3>
<p>
HTMLRes is used to compile <code>HTML.hrc</code> which stores various
HTML, JavaScript, CSS and images into HTML resources. Version 1.1 or later
is required.
The HTML Resource Compiler can be obtained from
<a
href="http://www.delphidabbler.com/software/htmlres"
>http://www.delphidabbler.com/software/htmlres</a>.
</p>
<p>
The program is expected to be on the path unless its install directory is
specified by the <code>HTMLRESROOT</code> environment variable.
</p>
<h3>
Inno Setup
</h3>
<p>
The Unicode version on the Inno setup command line compiler is needed to
create <em>CodeSnip</em>'s install program. v5.4.0 (u) or later is required as
is a compatible version of the ISPP pre-processor. You can get Inno Setup with
ISPP at <a
href="http://www.jrsoftware.org/isinfo.php"
>http://www.jrsoftware.org/isinfo.php</a>. Choose the Unicode version. If you
already have the ANSI version the Unicode version can be installed alongside
it - just use a different install directory and program group name.
</p>
<p>
The program is expected to be on the path unless its install directory is
specified by the <code>INNOSETUP</code> environment variable.
</p>
<h3>
Microsoft HTML Help Compiler (HHC)
</h3>
<p>
This command line compiler is supplied with Microsoft HTML Help Workshop. It
is used to compile the <em>CodeSnip</em> help file.
</p>
<p>
The program is expected to be on the path unless its install directory is
specified by the <code>HHCROOT</code> environment variable.
</p>
<h3>
Zip
</h3>
<p>
This program is used to create <em>CodeSnip</em>'s release file.
You can get a Windows command line version at
<a
href="http://stahlforce.com/dev/index.php?tool=zipunzip"
>http://stahlforce.com/dev/index.php?tool=zipunzip</a>.
</p>
<p>
The program is expected to be on the path unless its install directory is
specified by the <code>ZIPROOT</code> environment variable.
</p>
<h2>
Preparation
</h2>
<h3>
Configure the environment.
</h3>
<p>
You can configure environment variables either by modifying your system
environment variables or by creating a batch file that you run before
performing the build.
</p>
<h4>
Step 1
</h4>
<p>
Configure the required environment variables. Compilation will fail if these
environment variables are not set:
</p>
<ul>
<li>
<code>DELPHIROOT</code> <strong>or</strong> <code>DELPHI2010</code>
</li>
<li>
<code>INDY10</code>
</li>
<li>
<code>MSSDK</code> (if using MIDL - see step 2)
</li>
</ul>
<h4>
Step 2
</h4>
<p>
Update the <code>PATH</code> environment variable to include the paths that
MIDL needs (explained <a
href="#mssdk"
>above</a>).
</p>
<p>
If you are not using MIDL then there is no need to modify the
<code>PATH</code> variable or set <code>MSSDK</code>. Instead you can
define <code>IGNOREMIDL</code> by setting it to some value, e.g.
<code>set IGNOREMIDL=1</code>.
</p>
<h4>
Step 3
</h4>
<p>
Set any of the following environment variables that are needed to specify
the path to any tools that cannot be found on the path:
</p>
<ul>
<li>
<code>VIEDROOT</code>
</li>
<li>
<code>HTMLRESROOT</code>
</li>
<li>
<code>INNOSETUP</code>
</li>
<li>
<code>HHCROOT</code>
</li>
<li>
<code>ZIPROOT</code>
</li>
</ul>
<h4>
Step 4
</h4>
<p>
Set <code>INDY_WORKEVENT_INT64</code> or <code>INDY_WORKEVENT_INT32</code>
if necessary (explained <a
href="#indychanges"
>above</a>).
</p>
<h3>
Get the Source Code
</h3>
<p>
If you don't already have it, download or checkout the <em>CodeSnip</em>
source code. There are several options:
</p>
<ol class="spaced">
<li>
<div>
If you are a Subversion user you can:
</div>
<ul class="spaced">
<li>
<div>
Check out the source using the following command:
</div>
<pre class="cmd"><span class="prompt">&gt;</span> svn co https://codesnip.svn.sourceforge.net/svnroot/codesnip/trunk PATH</pre>
<div>
Where <code>PATH</code> is the directory where you want to
place the working copy. You will not be able to commit
changes unless you join the project as a contributor.
</div>
</li>
<li>
<div>
Export the code using this command:
</div>
<pre class="cmd"><span class="prompt">&gt;</span>svn export https://codesnip.svn.sourceforge.net/svnroot/codesnip/trunk PATH</pre>
<div>
where <code>PATH</code> is the directory where you wish to
store the code.
</div>
</li>
</ul>
<div class="spaced">
These commands get code from the current development tree. To get
the code of a suitable stable release replace <code>trunk</code>
with <code>tags/XXXX</code> where <code>XXX</code> specifies the
version.
</div>
</li>
<li>
Download a suitable source tarball from the SourceForge repo. To get the
current development tree go to <a
href="http://codesnip.svn.sourceforge.net/viewvc/codesnip/trunk/"
>http://codesnip.svn.sourceforge.net/viewvc/codesnip/trunk/</a> and
click the <em>Download GNU tarball</em> link.
</li>
<li>
Download source files for the current many older releases from the <a
href="https://sourceforge.net/projects/codesnip/files/"
>CodeSnip SourceForge Files Page</a>.
</li>
<li>
Grab the source code of the latest release from <a
href="http://www.delphidabbler.com/software/codesnip/download"
>DelphiDabbler.com</a>.
</li>
</ol>
<h3>
Configure the Source Tree
</h3>
<p>
After checking out or downloading and extracting the source code you should
have the following directory structure:
</p>
<pre>./
|
+-- Docs - documentation
| |
| +-- Design - documents concerning design
|
+-- Src - main CodeSnip source code
|
+-- 3rdParty - third party &amp; DelphiDabbler library source code
|
+-- AutoGen - receives automatically generated code
|
+-- Help - help source files
| |
| +-- CSS - CSS code for help files
| |
| +-- HTML - HTML files included in help file
| |
| +-- Images - images included in help file
|
+-- Install - setup script and support code
|
+-- InstallHelper - source for install helper program
| |
| +-- Res - resources for install helper program
|
+-- Res - container for various types of resources
|
+-- HTML - html, css, js and images included in resources
|
+-- Img - images included in resources
|
+-- Misc - other resources</pre>
<p>
If, by chance you also have a <code>Bin</code>, <code>Exe</code> and
<code>Release</code> directory don't worry - all will become clear.
Subversion users may also see the usual <code>.svn</code> hidden
directories. If you have done some editing you may also see occasional
hidden <code>__history</code> folders.
</p>
<p>
Before you can get hacking, you need to prepare the code tree. Open a
command console and navigate into the <code>Src</code> sub-folder. Run any
script you have created to set the required environment variables then do:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make config</pre>
<p>
You may need to replace <code>Make</code> with the full path to
<code>Make</code> if it isn't on the path, or if the <code>Make</code> that
runs isn't the Borland / CodeGear version. If this is the case try:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> %DELPHIROOT%\Bin\Make config</pre>
<p>
or
</p>
<pre class="cmd"><span class="prompt">&gt;</span> %DELPHI2010%\Bin\Make config</pre>
<p>
depending on which environment variable you have set.
</p>
<p>
Once <code>Make config</code> has completed your folder structure should
have acquired the following new folders:
</p>
<pre>./
|
+-- Bin - receives object files for CodeSnip
| |
| +-- InstallHelper - receives object files for CSSetupHelper
|
...
|
+-- Exe - receives executable code and compiled help file
|
+-- Release - receives release files
|
...</pre>
<p>
If the <code>Bin</code>, <code>Exe</code> and <code>Release</code> folders
already existed they will have been emptied.
In addition, <code>Make</code> will have created <code>.cfg</code> files from
templates in the <code>Src</code> and <code>Src\InstallHelper</code> folders.
<code>.cfg</code> files are needed for DCC32 to run correctly. These files
will be ignored by Subversion.
</p>
<p>
If you are intending to use the Delphi IDE to compile code, you should also
do:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make resources
<span class="prompt">&gt;</span> Make typelib
<span class="prompt">&gt;</span> Make autogen</pre>
<p>
This compiles the resource files that the IDE needs to link into compiled
executables, compiles the type library from IDL code and generates the
Pascal file that provides an interface to the type library.
</p>
<p>
You are now ready to build the source. If you want to modify the source
now's the time to do it.
</p>
<h3 id="nomidl">
Editing and Compiling without MIDL
</h3>
<p>
If you don't have the MIDL compiler you need to get hold of a pre-compiled
copy of the <code>ExternalObj.tlb</code> type library and tell Make to skip
the MIDL compiling stage.
</p>
<h4>
Getting The Type Library
</h4>
<ol class="spaced">
<li>
If necessary download a resource file editor. XN Resource Editor will
do the job. You can get that from
<a
href="http://www.wilsonc.demon.co.uk/d10resourceeditor.htm"
>http://www.wilsonc.demon.co.uk/d10resourceeditor.htm</a>.
</li>
<li>
Get a suitable copy of the <em>CodeSnip</em> executable. This must have
been compiled from the same version of <code>ExternalObj.idl</code> as
that included in the source tree.
</li>
<li>
Load <code>CodeSnip.exe</code> into the resource file editor (Use
<em>File | Open</em> in XN Resource Editor). You need to
find the TYPELIB resource type. There should only be one, language
neutral, TYPELIB resource. Select this and export it as
<code>ExternalObj.tlb</code> in the <code>Bin</code> folder in your
configured source tree. (Use <em>Resource | Export</em> Resource in XN
Resource Editor).
</li>
</ol>
<p>
If you are working on the latest development tree from the code repository
you should get <code>ExternalObj.tlb</code> from the latest release of
<em>CodeSnip</em>, <strong>unless</strong> <code>ExternalObj.idl</code>
has been changed since the last release. In this case you
<strong>must</strong> use MIDL to build the <code>.idl</code> file, because
a suitable <code>.tlb</code> file won't be available.
</p>
<h4>
Editing the Type Library
</h4>
<p>
You can edit the type library from the Delphi IDE. Start the IDE, select
File | Open, change the file type to Type Library and navigate to
<code>ExternalObj.tlb</code>. This opens the type library. Edit as required
then save the changes. Delete any <code>*_TLB</code> files that appear.
</p>
<p>
If you do make changes you should also use the type library editor's
<em>Export to IDL</em> button to save a copy of the IDL in
<code>ExternalObj.idl</code> in the <code>Src</code> folder. The license in
the original code must be restored and you can add yourself as a
contributor, so take a copy of the license from <code>ExternalObj.idl</code>
before saving!
</p>
<p>
You must regenerate the associated Pascal file. Do this by running:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make autogen</pre>
<h4>
Telling Make to Ignore MIDL
</h4>
<p>
You now need to prevent Make from trying to compile the <code>.idl</code>
file in the absence of MIDL. Do this by defining an environment variable
called <code>IGNOREMIDL</code>. This can be done from the command line or
a batch file by doing:
</p>
<pre class="cmd">
<span class="prompt">&gt;</span> set IGNOREMIDL=1</pre>
<p>
Alternatively, call Make with the <code>-DIGNOREMIDL</code> switch.
</p>
<h2>
Building CodeSnip
</h2>
<p>
You have several options:
</p>
<ul>
<li>
Build the <em>CodeSnip</em> Executable
</li>
<li>
Build the Help File.
</li>
<li>
Build the Setup Program.
</li>
<li>
Build the Release Zip File.
</li>
<li>
Build and Release Everything.
</li>
<li>
Clean Up.
</li>
</ul>
<p>
Each of these options is described below. All except the last assume that
<code>Make config</code> has been run.
</p>
<h3>
Build the CodeSnip Executable
</h3>
<p>
This is the most common build and has a simple command:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make codesnip</pre>
<p>
This is the same as doing this sequence of commands:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make typelib
<span class="prompt">&gt;</span> Make resources
<span class="prompt">&gt;</span> Make autogen
<span class="prompt">&gt;</span> Make pascal</pre>
<p>
The <em>CodeSnip</em> executable will be placed in the <code>Exe</code>
folder.
</p>
<p>
If you are building without MIDL, and have a suitable copy of
<code>ExternalObj.tlb</code> already in the <code>Bin</code> directory you
must either have defined the <code>IGNOREMIDL</code> environment variable or
you must do:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make -DIGNOREMIDL codesnip</pre>
<p>
This is the same as doing:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make -DIGNOREMIDL typelib
<span class="prompt">&gt;</span> Make resources
<span class="prompt">&gt;</span> Make autogen
<span class="prompt">&gt;</span> Make pascal</pre>
<h3>
Build the Help File
</h3>
<p>
To build the help file just do
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make help</pre>
<h3>
Build the Setup Program
</h3>
<p>
The setup program requires that the <em>CodeSnip</em> excutable and the
compiled help file are already present in the <code>Exe</code> directory.
<code>CSInstallHelper.exe</code> must also be present in the same folder.
</p>
<p>
We've already shown how to build <em>CodeSnip</em> and the help file.
<code>CSInstallHelper.exe</code> is built by doing:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make installhelper</pre>
<p>
As an aside, you can make all the required files by doing:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make exes</pre>
<p>
<code>Make exes</code> will require the use of the <code>-DIGNOREMIDL</code>
switch if MIDL is not available.
</p>
<p>
Once you have built all the required files you build the setup file by
doing:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make setup</pre>
<p>
The setup program is named <code>CodeSnip-Setup-x.x.x.exe</code>, where
x.x.x is the version number extracted from <em>CodeSnip</em>'s version
information. It is placed in the <code>Exe</code> directory.
</p>
<p>
If the <em>SpecialBuild</em> string is defined in <em>CodeSnip</em>'s
version information the string will be appended to the setup file name like
this <code>CodeSnip-Setup-x.x.x-SPECIALBUILD</code>.
</p>
<h3>
Build the Release Zip File
</h3>
<p>
Once the setup file has been compiled you can create a zip file containing
the setup file along with <code>ReadMe.txt</code> from the <code>Docs</code>
directory. If either file is missing the build fails. Build the release by
doing:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make release</pre>
<p>
By default the release file is called <code>dd-codesnip.zip</code>. You can
change this name by defining the <code>RELEASEFILENAME</code> macro or
enviroment variable. For example, you can name the file
<code>MyRelease.zip</code> by doing:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make -DRELEASEFILENAME=MyRelease.zip release</pre>
<h3>
Build and Release Everything
</h3>
<p>
You can do a clean build of everything, and generate the release zip file
simply by doing:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make</pre>
<p>
without specifying a target. This is the equivalent of:
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make config
<span class="prompt">&gt;</span> Make exes
<span class="prompt">&gt;</span> Make setup
<span class="prompt">&gt;</span> Make release</pre>
<p>
<strong>Warning:</strong> You should not run this command if MIDL is not
available since <code>Make config</code> will delete any <code>.tlb</code>
file you may have placed in the <code>Bin</code> directory.
</p>
<h3>
Clean Up
</h3>
<p>
Various temporary files and directories are created by the IDE. These can be
deleted by running.
</p>
<pre class="cmd"><span class="prompt">&gt;</span> Make clean</pre>
<p>
Be warned though that this command removes the <code>__history</code>
folders that Delphi uses to maintain earlier versions of files.
</p>
<h2>
Copyright
</h2>
<p>
If you are planning to re-use or modify any of the code, please see the file
<code>SourceCodeLicenses.txt</code> in the <code>Docs</code> directory for
an overview of the various licenses that apply to the <em>CodeSnip</em>
source code.
</p>
<p>
It is intended to change the licensing for the majority of the code base
from the Mozilla Public License to the <a
href="http://www.mozilla.org/MPL/"
>MPL / GPL / LGPL disjunctive tri-license</a>. This could take some time.
In the meantime if you would like to use parts of the code under the
tri-license, <a
href="http://www.delphidabbler.com/contact"
>please ask</a>.
</p>
</body>
</html>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.