forked from pemsley/coot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-it-gtk2
2803 lines (2489 loc) · 82.4 KB
/
build-it-gtk2
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
# -*-shell-script-*-s
# Prerequisites: sed, GNU make, libtool, wget
#
# (and for autogening: GNU m4, GNU autoconf, GNU automake)
#
# libz is optional for the moment
# 1.3 Put RELEASE-NOTES on web site too
# 1.4 Apply both of Ezra's patches of today Wed Mar 2 22:51:36 GMT 2005
# Update clipper version (the one with shelx .fcf ability)
# 1.5 Apply Ezra's gtkglarea patch and GSL patch.
# Update version of FFTW and other updates from MATSUURA Takanori.
# 1.6 Update to mmdb-1.0.8 [# for molrep output]
# 1.7 Fix logic of fftw test
# 1.8 Add the clipper edcalc patch (suggested by Ezra ages ago)
# 1.9 Add Fedora Core 4 support and testing for the need to build mccp4,
# mmdb and clipper.
# 1.10 Tidy up nightly code.
# 1.11 Add code testing the need for guile_gui and goosh.
# 1.12 Tidy nightly code again.
# 1.13 Don't escape the "."s in gsub for new gawk (Ward Smith).
# 1.14 20050628 Test for imlib on the installation, not the system (ignore
# the system).
# 1.15 20050709 Add glib gstrfuncs patch
# 1.16 20050709 Update to guile 1.6.7 and add lt_preloaded_symbols patch
# 1.17 20050721 Added clipper status code to compiling clipper part.
# Redirect stderr output?
# fix build_mccp4 problem.
# 1.18 20050722 Fix guile build (wrong http tar file).
# Added freeglut
# 1.19 20050803 Update version of guile-gtk to 0.41
# 1.20 20050815 Several updates and clean up from MATSUURA Takanori.
# 1.21 20050815 Stop if wget test fails.
# 1.22 20050916 Update build for freeglut to use --disable-warnings and
# CFLAGS
# 1.23 20050916 Move "set" so we don't see confusing default coot_version
# 1.24 20051012 Do pre-release tars for a few days.
# 1.25 20051017 Don't make install if Coot's makes fails. Don't make -k
# 1.26 20051018 Handle clipper nxmap patch.
# 1.27 20051027 [Gif, Paris] Fix tarred directory for nightly pre-release
# tars.
# 1.28 20051101 Fix the md5sum for nxmap.h
# 1.29 20051104 Apply most of MATSUURA Takanori's fixes.
# Use CCP4 libs (mtz, clipper, mmdb).
# 1.30 20051109 Darwin setting of FC for CCP4 libs configure.
# 1.31 20051114 Fix coot tar file problem on building pre-release (or not).
# 1.32 20060205 Add scripting variable debugging (its currently not making
# python tar files)
# 1.33 20060214 Get wget testing tar file from YSBL, not chem.gla
# 1.34 20060219 Correct the install position of libccp4c.la
# 1.35 20060219 create time stamp with current time, not the time of
# the previous ccp4 libs file, now the find ctime test works
# as I wanted.
# 1.36 20060220 Add a libmmdb.la too.
# 1.37 20060222 Add Bob Nolte's proxy settings
# 1.38 20060224 dylib variable for libmmdb.la and libccp4c.la
# 1.39 20060225 Fix sedding of libmmdb.la and libccp4c.la
# 1.40 20060323 copy over coot.py to share/coot/python (if we built with
# python)
# 1.41 20060401 Big changes for ccp4 5.0.2 ccp4c libs.
# 1.42 20060404 Various small build debuggings.
# 1.43 20060405 Fix do_nightlies syntax error and fix up glut_prefix build
# problem.
# 1.44 20060405 Fix the tarred directory name when this is not a pre-release
# 1.45 20060406 Check for missing reference structures and monomer lib and
# install them if needed.
# 1.46 20060418 use install_top_dir variable to copy over coot.py (not
# $coot_prefix!)
# 1.47 20060419 Remove the mmdb binaries
# 1.48 20060420 J. Maclean says no guile. He is right. So check install for
# guile, not system.
# 1.49 20060420 Replace many $AUTOBUILD_INSTALLED with $install_top_dir.
# 1.50 20060421 Replace other $AUTOBUILD_INSTALLED with $install_top_dir for
# tar file creation.
# 1.51 20060425 net-http was installing into the wrong place because it had
# been set to install_top_dir, but this was not set as a shell
# (or configured) variable so it was just blank [James Murray].
# Now we export install_top_dir.
# 1.52 20060427 Don't add unecessary tagging of -pre-release to tar_dir at
# the end.
# 1.53 20060503 Force GSL to be in $install_top_dir rather than anywhere.
# 1.54 20060519 Update to extract the right coot version from the release and
# pre-release directories.
# 1.55 20060621 Shuffle around the test for using pre-release
# 1.56 20060626 Fixes from MATSUURA Takanori. Shuffle around the usage of
# install_top_dir.
# 1.57 20060704 run imlib-config from the installation, not anywhere.
# 1.58 20060705 Fix wrong directory to build libtiff.
# 1.59 20060706 guile-config should run with an argument, otherise it
# returns with exit status 1 (and we test for non-zero).
# 1.60 20060706 Fix (directory for) mmdb include file test.
# 1.61 20060707 Add to coot configure line the option for guile_gtk
# 1.62 20060708 Fix coot_prerelease_exists typo in setting install_top_dir
# (oops).
# 1.63 20060708 Add jpeg dependency for imlib
# 1.64 20060708 Add libungif test to installation, not system (imlib
# dependency).
# 1.65 20060710 Add removal of coot_wrap_guile.cc compilation when python
# scripting.
# 1.66 20060710 Python on a Sunday.
# 1.67 20060711 Try to fix up the Makefile for PNG.
# 1.68 20060723 Add in the updates to ltmain.sh, ltconfig and config.guess/sub
# for Mactel build. Add build for readline.
# Readline version typo fixed.
# 1.69 20060724 ENABLE_PYTHON_COOT variable is tested. Don't display
# a variables if we are using a proxy.
# 1.70 20060728 pass CFLAGS and LDFLAGS to guile's configure
# 1.71 20060730 Add test for 64-bit Linux to update config.xxxs and libtool.
# Installation readline built now, not system.
# 1.72 20060801 Use mmdb-1.0.8-ysbl-2, which installs includes in the include
# dir. This matches clipper cif_data_io.cpp which presumes that
# it is there. (And is a clean thing to do anyway).
# 1.73 20060801 Use the new version of libccp4c, with some of Ralf's patches
# and includes that go into include/ccp4 dir.
# 1.74 20060801 Use CCP4_CXXFLAGS argument to clipper (it does the wrong thing
# with --with-ccp4)
# 1.75 20060801 Use -pre-2 version of SSMlib, that has -Ixxx/include/mmdb to
# find mmdb include files.
# 1.76 20060808 test for libjpeg.$shared_lib_ext not libjpeg.so. LTE bug.
# 1.77 20060818 Force update of libtool and config files for libjpeg. Extend
# the make install proceedure. Lynn Ten Eyck reported problems
# here.
# 1.78 20060823 Add poll fix and getpwuid fix to glib build on Intel Mac.
# 1.79 20060827 Add fix for gtk-canvas from fink for Intel Mac.
# 1.80 20061002 Change freeglut test to test instaltion, not system.
# 1.81 20061012 The path used to find *-config files should be the same one
# that new executables are added (it was $AUTOBUILD_INSTALLED)
# and it should be $AUTOBUILD_INSTALLED-pre-release/bin) when
# we are building a pre-release.
# 1.82 20061012 Change the destination tar file so that there are nightly
# and stable directories for the binary tar files on the web
# server.
# 1.83 20061107 cd to the clipper dir when building clipper. Pirate and
# bucca are not (attempted to be) built then.
# 1.84 20061107 Capture and report error status from make in GSL (intel mac
# build fails).
# 1.85 20061107 Use GSL version 1.8, which includes Charles Ballard's fix for
# fp_regs.h
# 1.86 20061108 Add fink-based args for configure of gtk for Darwin
# 1.87 20061108 Fix ltmain.sh updating for Gtk (oops!).
# 1.88 20061122 Fix coot tar directory now that we have revision numbers in
# tar file name.
# 1.89 20061123 Fix/add test for ssmlib build (now depends on mmdb build) and
# libccp4c build (now depends on xxx/include/ccp4/cmtzlib.h).
# 1.90 20061128 Allow the user to specify if the dependencies should be checked
# on the system or only in the autobuild installed directory.
# Needs more checks to use this. Currently only glib and gtk
# tests.
# 1.91 20061211 Don't make install for guile-gtk if the make fails - or the
# dependency check for guile-gtk in coot's configure passes
# when it should fail (maybe).
# 1.92 20061212 Apply Charles Ballards libtool patch for Macs for imlib and
# guile-gtk.
# 1.93 20061212 Fiddle the env vars to compile gtk+ on Mac.
# 1.94 20070104 Non-pre-release build problems, BINARY_DEST_DIR
# 2.01 20070109 imlib tar gz should be downloaded from the correct directory
# (sigh).
# 2.02 20070117 Try to compile clipper with -fno-strict-aliasing
# 2.03 20070123 Tell us where the gtkglarea include file was found.
# 2.04 20070124 GCC 3.2 on RH8 machine cannot compile new clipper, so add a
# patch if needed.
# 2.05 20070216 Put libtiff after libjpeg and give tiff's configure command
# line args to find jpeg.
# 2.06 20070306 Put in the clipper<->ccp4 new dist patch.
# 2.07 20070319 Remove == comparisons - Lothar Esser.
# 2.08 20070424 --with-jpeg-lib-dir should be a lib dir!
# 2.09 20070501 Fix the setting of coot_version when no pre-release set.
# 2.10 20071002 Post install slim the binaries. Add helper functions.
# 2.11 20071005 Add some debugging to make_tar. It doesn't seem to work
# currently.
# 2.12 20071005 Fix post_install_slim call.
# 2.13 20071005 Fix slim_dir
# 2.14 20071006 Adjust python scripting settings, so that it should try
# to compile with python most of the time now.
# 2.15 20071008 Fix extra fi, uncommented typo.
# 2.16 20071010 ENABLE_PYTHON_COOT=no for now.
# 2.17 20071105 Swap out DL Clipper for York clipper [whoosh, bang, kerpow!]
# enable-cns
# 2.18 20071105 Backpeddle to mmdb 1.08. Baah.
# 2.19 20071108 Version 1.08-ysbl-3 of mmdb.
# 2.20 20071118 No longer make the full fat tar file.
# 2.21 20071120 Sourcefource no longer distributes libungif, now in
# ysbl software/extras
# 2.22 20071121 set the architecture for ubuntu systems.
# 2.23 20071125 Fix typo in recent fixes.
# 2.24 20071126 Fix setting of systype for MacOSX, hopefully.
# 2.25 20071126 Another try to fix setting of systype for MacOSX.
# 2.26 20071130 Try to enable python
# 2.27 20071207 More python tinkering. Upgrade to 2.5.1
# 2.28 20071207 Add greg. If in York, use it to test before installing.
# 2.29 20071208 Setup CCP4 and use it to test coot before making binaries.
# 2.30 20071209 Add dewinter's ccp4 setup in setup_ccp4.
# 2.31 20071212 Redirect testing output to $LOGS/$HOST-testing.log
# 2.32 20071213 Copy over the ChangeLog, README and RELEASE-NOTES on good test
# 2.33 20071215 Pythonize only sometimes, default off.
# 2.34 20071215 Tell us some Python info
# 2.35 20071215 Python settings outside the subshell.
# 2.36 20071219 Set up for testing and tars on biop too.
# 3.00 20080108 Gtk+-2 version
# 3.01 20080118 Add GtkGlExt
# 3.02 20080121 Tinker with guile build settings.
# 3.03 20080124 Build GTK2 from scratch: librsvg, cairo, pango, glitz. glib, gtk+-2
# 3.04 20080128 Add a test for the existance of pygtk
# 3.05 20080129 Add pkg-config and pygobject
# 3.06 20080130 Add test for pycairo
# 3.07 20080130 pycairo needs 1.4.12 - so test for cairo, setting build_gtk=1 on
# failure
# 3.08 20080130 Remove static patch (for sgi). Add test/build for freetype2
# 3.09 20080130 fontconfig added too.
# 3.10 20080131 Change HOSTLOGDIR to include gtk2 to separate it from gtk1 build logs.
# 3.11 20080201 Fix problem in scripting args to coot's configure.
# 3.12 20080207 Add test and build of ATK, needed for gtk+2.10.x
# 3.13 20080208 lib cleaning problems, add debugging.
# 3.14 20080208 Try requiring gtk 2.10
# 3.15 20080225 Adjust guile-gtk build variables.
script_version=3.15
# :: NOTE::
# this "strange" construction of variable names: x=${x:=thing} sets the
# variable x only if it has not previously been defined.
#
# So, the idea is that you write a wrapper for this script (defining typically
# AUTOBUILD_INSTALLED, AUTOBUILD_BUILD, LOGS and build_coot_prerelease) then
# source this file. That means that you (probably) don't have to edit your
# version of build-it every time it changes.
# ENABLE_PYTHON_COOT: if ENABLE_PYTHON_COOT is set to 0 or "no" then
# python coot is not enable (guile coot is enabled). if
# ENABLE_PYTHON_COOT is set, but not set to 0 or no then python coot
# is enabled. If ENABLE_PYTHON_COOT is not set, the guile-coot is
# enabled (python coot is not enabled).
# Pythonizing coot makes non-transferable binararies (why?). Let
# the pythonness be controlled on the command line:
#
if [ "$1" = "python" ] ; then
ENABLE_PYTHON_COOT=yes
else
ENABLE_PYTHON_COOT=no
fi
# Set the host and the OS.
# Fairly fundamental.
#
OS=$(uname)
HOST=$(hostname)
# Do we need to use a proxy server to get documents from the web? (set
# to 1 if we do)
use_proxy=${use_proxy:=}
# if we do need a proxy then we should give the proxy host and port too:
proxy_host=${proxy_host:=myproxy.com}
proxy_port=${proxy_port:=800}
no_proxy=${no_proxy:=".corp.net.com"}
# This is where the compiled binaries/libraries/data get installed:
# Note that the directory name must NOT end in a /
#
AUTOBUILD_INSTALLED=${AUTOBUILD_INSTALLED:=${HOME}/autobuild/${OS}-${HOST}}
# or perhaps, for the adventurous:
#AUTOBUILD_INSTALLED=$CCP4_MASTER
# This is where the actual build (compilation) master directory is:
# a temporary or scratch directory would be sensible.
#
# AUTOBUILD_BUILD=${HOME}/autobuild
# I'm putting my build on "scratch space"
AUTOBUILD_BUILD=${AUTOBUILD_BUILD:=/y/work/emsley/autobuild}
# This is where the build logs go:
# suggested value:
# LOGS=$AUTOBUILD_BUILD/logs
# but I want to put my log file on the web, so I put them here:
LOGS=${LOGS:=$HOME/public_html/build-logs/${OS}-${HOST}}
# set this to "no" if you don't want to compile the pre-release code.
# build_coot_prerelease=
build_coot_prerelease=${build_coot_prerelease:=1}
# We shall we check dependencies?
#
# Should we look for gtk etc on the system or only in the installed
# build directory? We want to do the first if we are a person using
# this build script to build coot themselves and we want to do the
# second to build a external-dependency-free coot build (like making
# the binary tars distributed from York).
# check_dependencies_in_install_only=
check_dependencies_in_install_only=1
# get build specials, e.g. change the compiler or the compiler options
# (e.g build for debugging), extra libraries etc setup LD_LIBRARY_DIR
# (or whatever) to include the autobuild library dir so that
# intermediate (configure compile) programs run and the addition to
# the path of GNU make and wget.
#
# use this to specify config_extras
#
# options are: GL_prefix, e.g. SunOS has Mesa Graphics - this is
# where to find them:
# glut_prefix, optionally can use freeglut
#
# Suggested value: comment out this line
specs=${specs:=$HOME/autobuild/build-scripts/${HOST}-specials}
# Make nightly binary tarballs?
# You probably don't want to do this, so recommended is do_nightlies=0
do_nightlies=${do_nightlies:=1}
# if you do want to build them where should they go?
# NIGHTLY_DEST_DIR=$AUTOBUILD_BUILD
NIGHTLY_DEST_DIR=${NIGHTLY_DEST_DIR:=${HOME}/public_html/software/binaries/nightlies/pre-release}
# if we are not building a nightly/pre-release, i.e. this is a binary
# for a stable release, they go somewhere else:
#
STABLE_DEST_DIR=${STABLE_DEST_DIR:=${HOME}/public_html/software/binaries/stable}
# When we fail to extract the correct tar file from the web site, what
# shall we build instead?
#
fallback_coot_version=coot-0.4
# ----------------------------------------------------------------
# End of tinkering with parameters.
# ----------------------------------------------------------------
# First, check that this is bash!
#
if [ "$BASH" = "" ] ; then
echo this is not bash\!
echo this must be run with bash\!
exit
fi
# now the functions:
function mkdir_maybe {
dir=$1
if [ ! -e "$dir" ] ; then
mkdir $dir
fi
}
# Give args: prefix-dir and (based on is-static-flag) either
# "clear-static" or "clear-dynamic" #
#
function post_install_slim {
echo we are slimming directory $1
fat_dir="$1"
cleaned_dir="$2"
clear_type="$3"
echo fat_dir is $fat_dir
echo clear_type is $clear_type
echo cleaned_dir is $cleaned_dir
mkdir_maybe $cleaned_dir
mkdir_maybe $cleaned_dir/bin
mkdir_maybe $cleaned_dir/lib
lib_sos=`cd $fat_dir && ls -1 lib/lib*.so*`
lib_as=`cd $fat_dir && ls -1 lib/lib*.a`
if [ "$clear_type" = "clear-dynamic" ] ; then
keep_lib_archs="$lib_as"
fi
if [ "$clear_type" = "clear-static" ] ; then
keep_lib_archs="$lib_sos"
fi
for file in etc html info man share bin/coot bin/coot-real \
bin/findwaters bin/findwaters-real bin/findligand bin/findligand-real \
bin/guile lib/$python_version $keep_lib_archs ;
do
dn=`dirname $file`
if [ -e $fat_dir/$file ] ; then
echo rsync -axr $fat_dir/$file $cleaned_dir/$dn
rsync -axr $fat_dir/$file $cleaned_dir/$dn
else
echo $fat_dir/$file does not exist
fi
done
}
function make_tar {
echo in make_tar args: $1 $2
echo in make_tar: in dir: $PWD
tar_dir=$1
tar_file_name=$2
cd $install_top_dir/..
if [ -e $tar_dir ] ; then
echo taring nightly... from $tar_dir to $tar_file_name
echo taring nightly... from $tar_dir to $tar_file_name >&2
tar czf $tar_file_name $tar_dir
status=$?
if [ "$status" != 0 ] ; then
echo ERROR:: tar czf $tar_file_name $tar_dir failed!
echo ERROR:: tar failed > $tar_file_name.md5sum
rm $tar_file_name
else
md5sum $tar_file_name > $tar_file_name.md5sum
/bin/ls -l $tar_file_name >> $tar_file_name.md5sum
echo done tar successfully.
fi
else
echo ERROR:: tar target directory $tar_dir does not exist.
echo ERROR:: tar target directory $tar_dir does not exist. >&2
fi
}
function setup_ccp4 {
# we have access to $OS and $arch.
if test "$OS" = Linux ; then
setup_file=/y/programs/xtal/ccp4-6.0/ccp4-6.0/include/ccp4.setup-sh
if test -e $setup_file ; then
. $setup_file
fi
setup_file=/lmb/dorset/linux_software/ccp4-6.0/include/ccp4.setup-bash
if test -e $setup_file ; then
. $setup_file
fi
fi
if test "$OS" = Darwin ; then
. /usr/local/ccp4-6.0.2/bin/ccp4.setup-sh
fi
}
# Return 0 on success, 1 on failure (or not tested)
#
#
# This can only be run when the coot tar file and greg tests have been
# untared (in this particular build)
#
# we should be in the directory where coot was untarred for building
# when this function was called.
#
function test_coot {
echo testing with greg
echo currently we are here:
pwd
if test "$run_tests" = true ; then
# let's test our new coot
# the greg tests are where the coot source code was untarred.
#
if [ ! -d greg-tests ] ; then
return 1
fi
setup_ccp4
cat <<EOF > command-line-greg.scm
(use-modules (ice-9 greg))
(set! greg-tools (list "greg-tests"))
(set! greg-debug #t)
(set! greg-verbose 5)
(let ((r (greg-test-run)))
(if r
(coot-real-exit 0)
(coot-real-exit 1)))
EOF
echo $install_top_dir/bin/coot-real --no-graphics --script command-line-greg.scm
$install_top_dir/bin/coot-real --no-graphics --script command-line-greg.scm
status=$?
if [ $status = 0 ] ; then
echo test_coot: coot test passed
return 0
else
echo test_coot: coot test failed
return 1
fi
else
return 1
fi
}
# now on to some code!
if [ "$use_proxy" = 1 ] ; then
# establish proxy settings
printf "Proxy user: "
read proxy_user
printf "Proxy password: "
read -s proxy_pass
printf "\n"
http_proxy="http://${proxy_user}:${proxy_pass}@${proxy_host}:${proxy_port}/"
https_proxy="http://${proxy_user}:${proxy_pass}@${proxy_host}:${proxy_port}/"
ftp_proxy="http://${proxy_user}:${proxy_pass}@${proxy_host}:${proxy_port}/"
ssl_proxy="http://${proxy_user}:${proxy_pass}@${proxy_host}:${proxy_port}/"
export http_proxy https_proxy ftp_proxy ssl_proxy no_proxy
fi
# use the right (GNU) tar and provide the path to wget (needed
# for downloads) and to GNU make - (which is necesary for python
# at least).
#
# So that python and the *-configs are found when it is installed:
# A bit of a kludge because we do testing for pre-release later.
# It's a logical mess.
#
if test "$build_coot_prerelease" = 1 ; then
PATH=${AUTOBUILD_INSTALLED}-pre-release-gtk2/bin:$PATH
else
PATH=$AUTOBUILD_INSTALLED-gtk2/bin:$PATH
fi
PATH=$PATH:/usr/local/bin:/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:
PATH=$PATH:/etc:/usr/etc
#
export PATH
echo PATH is now: $PATH
echo AUTOBUILD_BUILD is $AUTOBUILD_BUILD
# This is where the sources downloaded from network go:
AUTOBUILD_SOURCES=${AUTOBUILD_BUILD}/sources
echo AUTOBUILD_SOURCES is $AUTOBUILD_SOURCES
if (! test -d ${AUTOBUILD_SOURCES}) ; then
mkdir -p ${AUTOBUILD_SOURCES}
fi
# now make the build logs directory
mkdir -p $LOGS
shared_static_flag="--disable-shared"
shared_lib_ext=so
systype=unknown
# malloc.h business, Darwin does not have malloc.h
# used in the gtk_canvas build
have_malloc=1
if test "$OS" = "Darwin" ; then
have_malloc=0
fix_ulong=1
update_libtool=1
update_config_guess_sub=1
shared_static_flag="--disable-static"
shared_lib_ext=dylib
need_readline_patch=1
# uname -a gives processor type in last field on Darwin
processor=`uname -a | awk '{print $(NF)}'`
need_gtk_imlib_libtool_fix=1
if test "$processor" = "i386" ; then
need_glib_getpwuid_fix=1
need_glib_poll_fix=1
need_gtk_canvas_patch=1
fi
osversion=`sw_vers -productVersion`
systype=MacOSX-${osversion}-${processor}
fi
# redirect the output.
#
# exec 2>&1 > $LOGS/$HOST.log
# Try not to redirect standard out so that it goes to
# the sub-shell log? (testing)
exec > $LOGS/gtk2-build.log
echo This is script version $script_version for Gtk2
# local tinkering because our sgi runs out of room on /tmp on compiling
if [ $HOST = batman ] ; then
TMPDIR=$HOME/tmp
export TMPDIR
fi
date
#
if [ -n "$specs" ] ; then
if [ -e "$specs" ] ; then
echo running these extras:
echo . --------------------------------
cat "$specs"
. "$specs"
echo . --------------------------------
fi
fi
#initially unset:
if test $OS = Linux ; then
architecture=`uname -i`
# uname -i and uname -p (strangely) return unknown on my ubuntu
if test $architecture = unknown ; then
architecture=`uname -m`
fi
fi
# now architecture is something like i386 or x86_64
# now test for 64 bit Linux:
if test "$OS" = "Linux" ; then
processor=`uname -a | awk '{print $NF}'`
# on my Redhat i386, uname returns:
# Linux kalypso 2.6.12-1.1398_FC4 #1 Fri Jul 15 00:52:32 EDT 2005 i686 athlon i386 GNU/Linux
# 64 bit Ubuntu:
# Linux kalypso 2.6.22-14-generic #1 SMP Sun Oct 14 21:45:15 GMT 2007 x86_64 GNU/Linux
# from that I presume we need $(NF-2) to get the arch (not NF-1). Eh?
# arch=`uname -a | awk '{print $(NF-1)}'`
arch=`uname -a | awk '{print $(NF-1)}'`
echo currently architecture is $architecture
if test "$architecture" = x86_64 -o "$architecture" = ia64 ; then
update_libtool=1
update_config_guess_sub=1
else
echo this is not a 64 bit machine
fi
fi
if test $OS = Linux ; then
if rpm -a ; then
for i in fedora-release redhat-release redhat-release-workstation centos-release ; do
dist=`rpm -q --qf '%{name}' ${i}`
if test $? = 0 ; then
dist_name=`echo ${dist} | sed s/\-release//g`
dist_ver=`rpm -q --qf '%{version}' ${i}`
break
else
dist_name='unknown'
fi
done
else
dist_name='unknown'
fi
case ${dist_name} in
redhat* )
case ${dist_ver} in
[0-9] | [0-9].[0-9]* )
systype=${architecture}-redhat-${dist_ver}
;;
* )
systype=rhel-`echo ${dist_ver} | sed s/[A-Za-z]//g`
;;
esac
;;
fedora | centos )
systype=${architecture}-${dist_name}-${dist_ver}
;;
* )
if test -r /etc/issue; then
dist_name=`awk 'NR==1{print tolower($1)}' /etc/issue`
dist_ver=`awk 'NR==1{print tolower($2)}' /etc/issue`
systype=${architecture}-${dist_name}-${dist_ver}
else
systype=${architecture}-unknown-Linux
fi
;;
esac
fi
if test $OS = IRIX64 ; then
osversion=`uname -r`
systype=${osversion}-sgi
fi
if test $OS = IRIX ; then
osversion=`uname -r`
systype=${osversion}-sgi
fi
if test $OS = OSF1 ; then
osversion=`uname -r | sed s/V//g`
systype=${osversion}-OSF1
fi
echo systype: $systype
echo update_libtool: $update_libtool
echo update_config_guess_sub: $update_config_guess_sub
# give us some diagnostic shell information:
# (what extra things did $specs give us?)
#
if [ "$use_proxy" = 1 ] ; then
echo no diagnostic variables, we are using a proxy.
else
set
fi
# We want to add some compiler info in the directory name.
# If CC is set, use that,
# If not, try gcc,
# if not, try cc
#
# Similarly for the c++ compiler info
# If CXX is set, use that
# if not, try g++
# if not, try c++
if [ -n "$CC" ] ; then
# CC was set
v=$CC-`$CC --version`
if [ $? -ne 0 ] ; then
# but not gcc
v=$CC-`$CC -v`
if [ $? -ne 0 ] ; then
v="missing_version"
fi
fi
else
# CC not set
v=gcc-`gcc -dumpversion | head -1`
if [ $? -ne 0 ] ; then
# not gcc
# try cc
v=cc-`cc -v`
if [ $? -ne 0 ] ; then
v="missing_version"
fi
fi
fi
if [ -n "$CXX" ] ; then
# CXX was set
w=$CXX-`$CXX --version`
if [ $? -ne 0 ] ; then
# but not g++
w=$CXX-`$CXX -v`
if [ $? -ne 0 ] ; then
w="missing_cxx_version"
fi
fi
else
# CXX not set
w=g++-`g++ -dumpversion | head -1`
if [ $? -ne 0 ] ; then
# not g++
# try c++
w=c++-`c++ -v`
if [ $? -ne 0 ] ; then
# try CC
w=CC-`CC -v`
if [ $? -ne 0 ] ; then
w="missing_c++_version"
fi
fi
fi
# note that g++ 3.2 cannot compile clipper's test_contrib.cpp.
# So, if we have g++ 3.2 or less, then we need to get and apply
# test_contrib.cpp.patch
awk -vversion=$w 'BEGIN{ exit (version+0 >= 3.3)}'
wvers=$?
if [ $wvers = 0 ] ; then
need_clipper_contrib_patch=true
fi
fi
# so now we have v and w set to something. We
# need to sanitize that something.
v_fid=`echo $v | sed 's/ /_/g'`
w_fid=`echo $w | sed 's/ /_/g'`
compilers_dir=gtk2-${v_fid}_and_${w_fid}
HOSTLOGDIR=$LOGS/$compilers_dir
if [ ! -e $HOSTLOGDIR ] ; then
mkdir -p $HOSTLOGDIR
if [ $? -ne 0 ] ; then
#
echo DISASTER: could not make directory $HOSTLOGDIR
echo exiting.
exit 2
fi
fi
# need to add test that make is GNU make
echo "Testing version of make"
MAKE=make
make --version
if [ $? -ne 0 ] ; then
# definately not GNU make
# Try gmake then....
gmake --version
if [ $? -ne 0 ] ; then
nomake=1
else
MAKE=gmake
nomake=0
fi
if [ $nomake -eq 1 ] ; then
echo Ooops. Your make '(' `which make` ')' is not GNU make and gmake not found.
echo Exiting now.
exit 2
fi
fi
if [ ! -e "$AUTOBUILD_BUILD" ] ; then
mkdir "$AUTOBUILD_BUILD"
if [ $? -ne 0 ] ; then
echo mkdir "$AUTOBUILD_BUILD" failed.
exit 2
fi
fi
cd $AUTOBUILD_BUILD
if [ $? -ne 0 ] ; then
echo $AUTOBUILD_BUILD failed for some reason. Now in `pwd`
fi
# for ccp4 (20051104) compatibility, we can't use colons in the date string
date=`date -u +'%Y-%m-%d__T%H_%M_%S'`
echo Date: $date
# now in $AUTOBUILD_BUILD
mkdir ${HOST}_$date
if [ $? -ne 0 ] ; then
echo mkdir ${HOST}_$date failed for some reason. Now in `pwd`
fi
cd ${HOST}_$date
if [ $? -ne 0 ] ; then
echo cd ${HOST}_$date failed for some reason. Now in `pwd`
fi
build_dir=`pwd`
echo checking wget
echo which wget
which wget
wget "http://www.ysbl.york.ac.uk/~emsley/build-logs/build-notes"
if [ $? -ne 0 ] ; then
echo wget failed for some reason
echo exiting now.
exit 1
else
echo Done wget check.
WGET="wget -N -P ${AUTOBUILD_SOURCES}"
fi
# latest version (without .tar.gz extension)
coot_version=$fallback_coot_version
${WGET} -O ${AUTOBUILD_SOURCES}/index.html -o ${AUTOBUILD_SOURCES}/wget-e.s.p.log http://www.ysbl.york.ac.uk/~emsley/software/
${WGET} -O ${AUTOBUILD_SOURCES}/index-pre-release.html -o ${AUTOBUILD_SOURCES}/wget-e.s.p.log http://www.ysbl.york.ac.uk/~emsley/software/pre-release/
pre_release_files_html=""
if [ $build_coot_prerelease = 1 ] ; then
pre_release_files_html=${AUTOBUILD_SOURCES}/index-pre-release.html
fi
if [ $build_coot_prerelease = yes ] ; then
pre_release_files_html=${AUTOBUILD_SOURCES}/index-pre-release.html
fi
coot_version_tmp=`egrep href ${AUTOBUILD_SOURCES}/index.html $pre_release_files_html | sed -e 's/.*">//' -e 's/<.*//' | awk '
BEGIN {bmajor = -1; bminor = -1; bmicro = -1; }
# /^coot-[0-9]\.[0-9]+\.[0-9]+.*\.tar\.gz/ {
/^coot-[0-9]\.[0-9]+.*\.tar\.gz$/ {
n = split($1,arr,"[-.]");
# print n,"parts";
# print arr[1], arr[2], arr[3], arr[4];
# print arr[5], arr[6], arr[7], arr[8];
major = arr[2] + 0;
minor = arr[3] + 0;
micro = arr[4] + 0;
# print "testing best:",file, bmajor, bminor, bmicro,"vs. this:", major, minor, micro
if (major > bmajor) {
file = $1;
bmajor = major;
bminor = minor;
bmicro = micro;
} else {
if (major == bmajor) {
if (minor > bminor) {
file = $1;
bmajor = major;
bminor = minor;
bmicro = micro;
} else {
if (minor == bminor) {
if (micro >= bmicro) {
file = $1;
bmajor = major;
bminor = minor;
bmicro = micro;
}
}
}
}
}
}
END {
gsub(".tar.gz.*", "", file);
print file; # which is a version now.
}
'`
if [ -z "$coot_version_tmp" ] ; then
echo clever coot_version extraction failed, using default.
else
coot_version=$coot_version_tmp
echo setting coot_version to $coot_version from extraction
fi
# are we doing a pre-release in York?
#
# problem here? generic_prefix is not yet set. What happens to coot_prefix?
#
domainname=`domainname`
coot_prefix=
if [ "$domainname" = "yorksbl" ] ; then
# we are in York, let's try the pre-release coot...
echo we are in York
run_tests=true
build_coot_prerelease=1
fi
if [ "$domainname" = "biop" ] ; then
run_tests=true
build_coot_prerelease=1
fi
# override the switch which turns off the building of the pre-release here:
# build_coot_prerelease=1
# Let's initially set coot_prerelease_exists to not-exist, then we
# try to download it from the Coot web site, and if it exists we set
# coot_prerelease_exists to 1. If it doesn't exist, we don't do that
# of course and we also don't make the install_top_dir to be the pre-release
# directory later on.
coot_prerelease_exists=
if test "$build_coot_prerelease" = 1 ; then
${WGET} -O ${AUTOBUILD_SOURCES}/index.html -o ${AUTOBUILD_SOURCES}/wget-e.s.p.log http://www.ysbl.york.ac.uk/~emsley/software/pre-release
coot_version_pre=`egrep href ${AUTOBUILD_SOURCES}/index.html | sed -e 's/.*">//' -e 's/<.*//' | awk ' /^coot-[0-9]\.[0-9]+.*-pre.*\.tar\.gz$/ {
last=$0 }
END {
print last
}
'`
echo INFO:: building pre-release and coot_version_pre is $coot_version_pre
if [ -z "$coot_version_pre" ] ; then
echo trying to build pre-release coot, but failed to find pre-release version
BINARY_TAR_DEST_DIR=$STABLE_DEST_DIR
else
build_coot_prerelease=1 # belt and braces
coot_prerelease_exists=1
# tinker with coot_prefix, it is generic_prefix with pre-release added to prefix dir
coot_prefix="--prefix=${AUTOBUILD_INSTALLED}-pre-release-gtk2 ${config_extras:-}"
coot_source_tar_file=http://www.ysbl.york.ac.uk/~emsley/software/pre-release/$coot_version_pre
coot_version=`echo $coot_version_pre | sed s/\.tar.gz//`
BINARY_TAR_DEST_DIR=$NIGHTLY_DEST_DIR
mkdir -p ${NIGHTLY_DEST_DIR}
echo INFO:: set the target destination for binary tar file \(BINARY_TAR_DEST_DIR\) to $NIGHTLY_DEST_DIR
fi
else
# this is a stable release
BINARY_TAR_DEST_DIR=$STABLE_DEST_DIR
mkdir -p ${BINARY_TAR_DEST_DIR}
fi
echo INFO:: binary tar destination dir: BINARY_TAR_DEST_DIR is $BINARY_TAR_DEST_DIR
# set the build prefix for installed stuff. Put everything in the
# pre-release directory if we are building a pre-release.
# (Perhaps this bit of code should go down lower, where we test
# build_coot_prerelease again
#
# we need install_top_dir because we use it to copy over coot.py
# to the install python directory.
#
if [ "$build_coot_prerelease" = 1 ] ; then
if [ "$coot_prerelease_exists" = 1 ] ; then
generic_prefix="--prefix=${AUTOBUILD_INSTALLED}-pre-release-gtk2 ${config_extras:-}"
install_top_dir=${AUTOBUILD_INSTALLED}-pre-release-gtk2
else
# don't use pre-release
generic_prefix="--prefix=$AUTOBUILD_INSTALLED-gtk2 ${config_extras:-}"
coot_prefix="$generic_prefix"
install_top_dir=${AUTOBUILD_INSTALLED}-gtk2