-
Notifications
You must be signed in to change notification settings - Fork 22
/
Packages.py
1789 lines (1515 loc) · 72.7 KB
/
Packages.py
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
#!/usr/bin/env python
from __future__ import print_function
import os, shutil
import os.path as P
import re, sys
from glob import glob
import subprocess
from BinaryBuilder import CMakePackage, GITPackage, Package, stage, warn, \
PackageError, HelperError, SVNPackage, Apps, write_vw_config, write_asp_config, \
replace_line_in_file, run, get, program_paths, get_platform, find_file, get_cores
from BinaryDist import lib_ext, which
class ccache(Package):
src = 'https://www.samba.org/ftp/ccache/ccache-3.1.12.tar.bz2'
chksum = '64c4bbe08187a448bc3526b1e657f1cbd1aff855'
class m4(Package):
src = 'http://ftp.gnu.org/gnu/m4/m4-1.4.17.tar.gz'
chksum = '4f80aed6d8ae3dacf97a0cb6e989845269e342f0'
def configure(self):
self.env['CPPFLAGS'] += ' -fgnu89-inline' # Needed for CentOS 5
super(m4, self).configure()
class libtool(Package):
src = 'http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz'
chksum = '22b71a8b5ce3ad86e1094e7285981cae10e6ff88'
class autoconf(Package):
src='http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz'
chksum = '562471cbcb0dd0fa42a76665acf0dbb68479b78a'
class automake(Package):
src='ftp://ftp.gnu.org/gnu/automake/automake-1.14.1.tar.gz'
chksum = '0bb1714b78d70cab9907d2013082978a28f48a46'
class cmake(Package):
src = 'https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5.tar.gz'
chksum = 'a4c021c4fa91e812b87d9c88fdd047ead4201a2f'
def __init__(self, env):
super(cmake, self).__init__(env)
#if self.arch.os == 'linux':
# # Bugfix, skip using ccache
# self.env['CXX']='g++'
# self.env['CC']='gcc'
self.env['LDFLAGS'] += ' -Wl,-rpath -Wl,%(INSTALL_DIR)s/lib' % self.env
def configure(self):
opts = ['--system-curl', '--parallel=%d' % get_cores() ]
super(cmake, self).configure(other = opts)
def compile(self):
cmd = ['gmake', '-j%d' % get_cores() ]
self.helper(*cmd)
# cmake pollutes the doc folder
@stage
def install(self):
super(cmake, self).install()
cmd = ['rm', '-vrf'] + glob(P.join( self.env['INSTALL_DIR'], 'doc', 'cmake*' ))
self.helper(*cmd)
class chrpath(Package):
src = 'http://ftp.debian.org/debian/pool/main/c/chrpath/chrpath_0.16.orig.tar.gz'
chksum = '174bb38c899229f4c928734b20e730f61191795a'
# chrpath pollutes the doc folder
@stage
def install(self):
super(chrpath, self).install()
cmd = ['rm', '-vrf'] + glob(P.join( self.env['INSTALL_DIR'], 'doc', 'chrpath*' ))
self.helper(*cmd)
class bzip2(Package):
src = 'https://downloads.sourceforge.net/project/bzip2/bzip2-1.0.6.tar.gz'
chksum = '3f89f861209ce81a6bab1fd1998c0ef311712002'
def configure(self):
# Not doing anything here so add this option (required for ImageMagick) while we are here
self.env['MAKEOPTS'] += ''' CFLAGS="-fPIC"'''
@stage
def install(self):
# Copy just the things we need.
self.helper(*['mkdir','-p',P.join(self.env['INSTALL_DIR'],'include')]);
self.helper(*['mkdir','-p',P.join(self.env['INSTALL_DIR'],'lib')]);
self.helper(*['mkdir','-p',P.join(self.env['INSTALL_DIR'],'bin')]);
cmd = ['cp', '-vf'] + glob(P.join(self.workdir, '*.h')) + \
[P.join(self.env['INSTALL_DIR'], 'include')]
self.helper(*cmd)
cmd = ['cp', '-vf'] + glob(P.join(self.workdir, 'lib*')) + \
[P.join(self.env['INSTALL_DIR'], 'lib')]
self.helper(*cmd)
cmd = ['cp', '-vf', P.join(self.workdir, 'bzip2'),
P.join(self.env['INSTALL_DIR'], 'bin')]
self.helper(*cmd)
class pbzip2(Package):
src = 'https://launchpad.net/pbzip2/1.1/1.1.6/+download/pbzip2-1.1.6.tar.gz'
chksum = '46cbdcf95b06e72be576d3bd12643de4aa27af5f'
def configure(self): pass
def compile(self):
# Force it to use our compiler and flags
self.helper('sed','-ibak','-e','s# g++# %s#g' % self.env['CXX'],
'Makefile');
cflags = 'CFLAGS = -I' + P.join(self.env['INSTALL_DIR'], 'include') + \
' -L' + P.join(self.env['INSTALL_DIR'], 'lib') + ' ' + self.env['CFLAGS'] + ' '
self.helper('sed','-ibak','-e','s#CFLAGS = #%s#g' % cflags, 'Makefile')
self.helper('sed','-ibak','-e','s#LDFLAGS =#LDFLAGS = %s#g' % self.env['LDFLAGS'],
'Makefile')
super(pbzip2, self).compile()
def install(self):
# Copy just the things we need.
cmd = ['cp', '-vf', P.join(self.workdir, 'pbzip2'),
P.join(self.env['INSTALL_DIR'], 'bin')]
self.helper(*cmd)
class parallel(Package):
src = 'http://ftp.gnu.org/gnu/parallel/parallel-20170722.tar.bz2'
chksum = '98bbaa8df35e0d6050ae76d6cb7d8a2e9e26ab8d'
@stage
def install(self):
super(parallel, self).install()
# Copy parallel to libexec, as we want it to be hidden there in
# the released ASP distribution.
libexec = P.join( self.env['INSTALL_DIR'], 'libexec' )
self.helper('mkdir', '-p', libexec)
cmd = ['cp', '-vf', P.join( self.env['INSTALL_DIR'], 'bin', 'parallel' ),
libexec]
self.helper(*cmd)
class tnt(Package):
src = 'http://math.nist.gov/tnt/tnt_126.zip'
chksum = '32f628d7e28a6e373ec2ff66c70c1cb25783b946'
patches = 'patches/tnt'
def __init__(self, env):
super(tnt, self).__init__(env)
# Our source doesn't unpack into a directory. So our work
# directory is just the outer containing folder.
self.workdir = P.join(self.env['BUILD_DIR'], self.pkgname)
def configure(self): pass
def compile(self): pass
@stage
def install(self):
d = P.join('%(INSTALL_DIR)s' % self.env, 'include', 'tnt')
self.helper('mkdir', '-p', d)
cmd = ['cp', '-vf'] + glob(P.join(self.workdir, '*.h')) + [d]
self.helper(*cmd)
class jama(Package):
src = 'http://math.nist.gov/tnt/jama125.zip'
chksum = '5ca8b154d0a0c30e2c50700ffe70567315ebcf2c'
def __init__(self, env):
super(jama, self).__init__(env)
self.workdir = P.join(self.env['BUILD_DIR'], self.pkgname)
def configure(self): pass
def compile(self): pass
@stage
def install(self):
d = P.join('%(INSTALL_DIR)s' % self.env, 'include', 'jama')
self.helper('mkdir', '-p', d)
cmd = ['cp', '-vf'] + glob(P.join(self.workdir, '*.h')) + [d]
self.helper(*cmd)
class openjpeg2(CMakePackage):
# Note: Upgrading to a newer openjpeg causes problems with dem_geoid.
# The solution may be to convert the old jp2 geoid to the new
# jp2 format perhaps.
src = 'https://github.com/uclouvain/openjpeg/archive/version.2.0.tar.gz'
chksum = 'a2e65326289a5836b82ed8567a2de8a283d722cd'
@stage
def configure(self):
curr_include = '-I' + self.workdir + '/src/bin/common'
self.env['CPPFLAGS'] = curr_include + ' ' + self.env['CPPFLAGS']
asp_deps_dir = self.env['ASP_DEPS_DIR']
self.env['LDFLAGS'] += ' -Wl,-rpath -Wl,%s/lib -L%s/lib' % (asp_deps_dir, asp_deps_dir)
super(openjpeg2, self).configure(other=[
'-DCMAKE_CXX_FLAGS=-O3',
'-DCMAKE_C_FLAGS=-O3',
'-DBUILD_SHARED_LIBS=ON',
'-DCMAKE_VERBOSE_MAKEFILE=ON',
])
class tiff(Package):
src = 'http://download.osgeo.org/libtiff/tiff-4.0.8.tar.gz'
chksum = '88717c97480a7976c94d23b6d9ed4ac74715267f'
def configure(self):
super(tiff, self).configure(
with_ = ['jpeg', 'png', 'zlib'],
without = ['x'],
enable=('shared',),
disable = ['static', 'lzma', 'cxx', 'logluv'])
class libgeotiff(CMakePackage):
src='http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.0.tar.gz'
chksum='4c6f405869826bb7d9f35f1d69167e3b44a57ef0'
def configure(self):
super(libgeotiff, self).configure( other=[
'-DCMAKE_CXX_FLAGS=-O3',
'-DCMAKE_C_FLAGS=-O3',
'-DCMAKE_VERBOSE_MAKEFILE=ON',
'-DBUILD_SHARED_LIBS=ON',
'-DBUILD_STATIC_LIBS=OFF'] )
class gdal(Package):
src = 'http://download.osgeo.org/gdal/2.0.2/gdal202.zip'
chksum = '91c1ce0e5156ab0e2671ae9133324e52f12c73b8'
patches = 'patches/gdal'
@stage
def configure(self):
# Parts of GDAL will attempt to load libproj manual (something
# we can't see or correct in the elf tables). This sed should
# correct that problem.
asp_deps_dir = self.env['ASP_DEPS_DIR']
self.env['LDFLAGS'] += ' -Wl,-rpath -Wl,%s/lib -L%s/lib -ljpeg -lproj' % (asp_deps_dir, asp_deps_dir)
# TODO: This may no longer be necessary.
self.helper('sed', '-ibak', '-e', 's/libproj./libproj.0./g', 'ogr/ogrct.cpp')
w = ['threads', 'libtiff', 'geotiff=' + self.env['ASP_DEPS_DIR'],
'jpeg=' + self.env['ASP_DEPS_DIR'],
'png', 'zlib', 'pam',
'openjpeg=' + self.env['ASP_DEPS_DIR'],
'geos=' + self.env['ASP_DEPS_DIR'],
'liblzma='+ self.env['ASP_DEPS_DIR'],
'curl']
wo = \
'''bsb cfitsio dods-root dwg-plt dwgdirect ecw epsilon expat expat-inc expat-lib fme
gif grass hdf4 hdf5 idb ingres jasper jp2mrsid kakadu libgrass
macosx-framework mrsid msg mysql netcdf oci oci-include oci-lib odbc ogdi pcidsk
pcraster perl pg php pymoddir python sde sde-version spatialite sqlite3
static-proj4 xerces xerces-inc xerces-lib libiconv-prefix libiconv xml2 pcre
freexl json-c kea libkml'''.split()
self.helper('./autogen.sh')
super(gdal,self).configure(with_=w, without=wo, disable='static', enable='shared')
@stage
def install(self):
super(gdal, self).install()
# Copy gdal_translate and gdalinfo to libexec, as we want it
# to be hidden there in the released ASP distribution.
progs = ['gdalinfo', 'gdal_translate']
libexec = P.join( self.env['INSTALL_DIR'], 'libexec' )
self.helper('mkdir', '-p', libexec)
for prog in progs:
cmd = ['cp', '-vf', P.join( self.env['INSTALL_DIR'], 'bin',
prog ), libexec]
self.helper(*cmd)
class ilmbase(Package):
src = 'http://download.savannah.nongnu.org/releases/openexr/ilmbase-1.0.2.tar.gz'
chksum = 'fe6a910a90cde80137153e25e175e2b211beda36'
patches = 'patches/ilmbase'
@stage
def configure(self):
self.env['AUTOHEADER'] = 'true'
# XCode in snow leopard removed this flag entirely (way to go, guys)
self.helper('sed', '-ibak', '-e', 's/-Wno-long-double//g', 'configure.ac')
self.helper('autoupdate', 'configure.ac')
self.helper('autoreconf', '-fvi')
super(ilmbase, self).configure(disable='static')
class openexr(Package):
src = 'http://download.savannah.nongnu.org/releases/openexr/openexr-1.7.0.tar.gz'
chksum = '91d0d4e69f06de956ec7e0710fc58ec0d4c4dc2b'
patches = 'patches/openexr'
@stage
def configure(self):
self.env['AUTOHEADER'] = 'true'
# XCode in snow leopard removed this flag entirely
self.helper('sed', '-ibak', '-e', 's/-Wno-long-double//g', 'configure.ac')
self.helper('autoupdate', 'configure.ac')
self.helper('autoreconf', '-fvi')
super(openexr,self).configure(with_=('ilmbase-prefix=%(INSTALL_DIR)s' % self.env),
disable=('ilmbasetest', 'imfexamples', 'static'))
class proj(Package):
src = 'http://download.osgeo.org/proj/proj-4.8.0.tar.gz'
chksum = '5c8d6769a791c390c873fef92134bf20bb20e82a'
@stage
def configure(self):
# Download some data files
# - There appear to be duplicate files in the extra tarballs???
base_dir = os.path.join(self.env['BUILD_DIR'], 'proj')
os.system('mkdir -p ' + base_dir)
main_tar_path = os.path.join(base_dir, 'main_grids.tar.gz' )
na_tar_path = os.path.join(base_dir, 'na_grids.tar.gz' )
oceania_tar_path = os.path.join(base_dir, 'oceania_grids.tar.gz')
europe_tar_path = os.path.join(base_dir, 'europe_grids.tar.gz' )
get('https://github.com/OSGeo/proj-datumgrid/archive/1.7.tar.gz', main_tar_path )
#get('https://github.com/OSGeo/proj-datumgrid/archive/north-america-1.0.tar.gz', na_tar_path )
#get('https://github.com/OSGeo/proj-datumgrid/archive/oceania-1.0.tar.gz', oceania_tar_path)
#get('https://github.com/OSGeo/proj-datumgrid/archive/europe-1.0.tar.gz', europe_tar_path )
# Extract the data files
os.system('tar -xf ' + main_tar_path + ' -C ' + base_dir)
#os.system('tar -xf ' + na_tar_path + ' -C ' + base_dir)
#os.system('tar -xf ' + oceania_tar_path + ' -C ' + base_dir)
#os.system('tar -xf ' + europe_tar_path + ' -C ' + base_dir)
super(proj,self).configure(disable='static', without='jni')
@stage
def install(self):
super(proj, self).install()
# Copy extra files which are needed by libgeotiff to compile.
cmd = ['cp', '-vf'] + glob(P.join(self.workdir, 'src/*.h')) + \
[P.join(self.env['INSTALL_DIR'], 'include')]
self.helper(*cmd)
# Copy grid files to the share folder
unpack_folder = os.path.join(self.env['BUILD_DIR'], 'proj', 'proj-datumgrid-1.7')
share_folder = os.path.join(self.env['INSTALL_DIR'], 'share', 'proj')
# First delete some extra files we don't want
os.system('rm -rf ' + os.path.join(share_folder, 'europe', '.github'))
os.system('rm -rf ' + os.path.join(share_folder, 'north-america', '.github'))
# Larger files are skipped to keep the ASP tarball size down.
grid_list = ('alaska europe null prvi stlrnc WI BETA2007.gsb conus FL ntf_r93.gsb nzgd2kgrid0005.gsb stpaul WO' +
' egm96_15.gtx hawaii MD ntv1_can.dat stgeorge TN').split()
for f in grid_list:
try:
shutil.move(os.path.join(unpack_folder, f), share_folder)
except:
pass # Skip existing files
class openssl(Package):
src = 'https://github.com/openssl/openssl/archive/OpenSSL_1_1_0e.tar.gz'
chksum = '14eaed8edc7e48fe1f01924fa4561c1865c9c8ac'
@stage
def configure(self):
cmd = ('./config --prefix=%s --openssldir=%s --with-zlib-include=%s --with-zlib-lib=%s'
% (self.env['INSTALL_DIR'], self.env['BUILD_DIR'],
self.env['INSTALL_DIR']+'/include', self.env['INSTALL_DIR']+'/lib'))
args = cmd.split()
self.helper(*args)
class curl(Package):
src = 'http://curl.haxx.se/download/curl-7.57.0.tar.bz2'
chksum = '7f47469324bf22cc9ffd1d3a201aa3c76ab626b8'
@stage
def configure(self):
w = ['zlib='+self.env['INSTALL_DIR'], 'ssl='+self.env['INSTALL_DIR']]
wo = 'libidn '.split() # Turn this off so this is not auto-included, our packages don't need it.
super(curl,self).configure(
with_=w, without=wo, disable=['static','ldap','ldaps'])
class liblas(GITPackage, CMakePackage):
src = '[email protected]:oleg-alexandrov/libLAS.git'
#chksum = 'e30c1efb3df4bcdc7119d7c42638e7a01b14f236'
#patches = 'patches/liblas'
@stage
def configure(self):
# Remove the pedantic flag. Latest boost is not compliant.
#self.helper('sed', '-ibak', '-e', 's/-pedantic//g', 'CMakeLists.txt')
# Make the compiler C++11
#cmd=['perl', '-pi', '-e', '"s#-std=c\+\+98\s+-ansi#-std=c++11#g"', 'CMakeLists.txt']
#self.helper(*cmd)
asp_deps_dir = self.env['ASP_DEPS_DIR']
# bugfix for linux
asp_deps_dir = self.env['ASP_DEPS_DIR']
boost_dir = P.join(asp_deps_dir,'include')
self.env['CXXFLAGS'] += ' -I' + boost_dir
self.env['LDFLAGS'] += ' -pthread -Wl,-rpath -Wl,%s/lib -L%s/lib -llzma -pthread -llz4 -lgeos_c -lqhull_r -lexpat -lproj' % (asp_deps_dir, asp_deps_dir)
ext = lib_ext(self.arch.os)
super(liblas, self).configure(other=[
'-DCMAKE_CXX_FLAGS=-O3',
'-DCMAKE_C_FLAGS=-O3',
'-DJPEG_INCLUDE_DIR=' + P.join(asp_deps_dir,'include'),
'-DJPEG_LIBRARY_RELEASE=' + P.join(asp_deps_dir,'lib', 'libjpeg'+ ext),
'-DBoost_INCLUDE_DIR=' + boost_dir,
'-DBoost_LIBRARY_DIRS=' + P.join(asp_deps_dir,'lib'),
'-DWITH_LASZIP=ON',
'-DLASZIP_INCLUDE_DIR=' + P.join(self.env['INSTALL_DIR'],'include'),
'-DWITH_GDAL=ON',
'-DGDAL_INCLUDE_DIR=' + P.join(self.env['INSTALL_DIR'],'include'),
'-DWITH_GEOTIFF=ON',
'-DGEOTIFF_INCLUDE_DIR=' + P.join(asp_deps_dir,'include'),
'-DTIFF_INCLUDE_DIR=' + P.join(asp_deps_dir,'include'),
'-DTIFF_LIBRARY_RELEASE=' + P.join(asp_deps_dir,'lib', 'libtiff'+ ext),
'-DZLIB_LIBRARY_RELEASE=' + P.join(asp_deps_dir,'lib', 'libz'+ ext),
'-DBUILD_SHARED_LIBS=ON',
'-DBoost_NO_BOOST_CMAKE=OFF',
'-DCMAKE_VERBOSE_MAKEFILE=ON',
'-DBoost_DEBUG=ON',
'-DBoost_DETAILED_FAILURE_MSG=ON',
'-DBoost_NO_SYSTEM_PATHS=ON' # don't use system boost
])
@stage
def install(self):
super(liblas, self).install()
# Copy lasinfo to libexec, as we want it
# to be hidden there in the released ASP distribution.
progs = ['lasinfo']
libexec = P.join( self.env['INSTALL_DIR'], 'libexec' )
self.helper('mkdir', '-p', libexec)
for prog in progs:
cmd = ['cp', '-vf', P.join( self.env['INSTALL_DIR'], 'bin',
prog ), libexec]
self.helper(*cmd)
class laszip(CMakePackage):
src = 'http://download.osgeo.org/laszip/laszip-2.1.0.tar.gz'
chksum = 'bbda26b8a760970ff3da3cfac97603dd0ec4f05f'
@stage
def configure(self):
asp_deps_dir = self.env['ASP_DEPS_DIR']
boost_dir = P.join(asp_deps_dir,'include')
self.env['CXXFLAGS'] += ' -I' + boost_dir + ' -pthread'
ext = lib_ext(self.arch.os)
super(laszip, self).configure(other=[
'-DCMAKE_CXX_FLAGS=-O3',
'-DCMAKE_C_FLAGS=-O3',
'-DBoost_INCLUDE_DIR=' + boost_dir,
'-DBoost_LIBRARY_DIRS=' + P.join(asp_deps_dir,'lib'),
'-DWITH_LASZIP=ON',
'-DLASZIP_INCLUDE_DIR=' + P.join(self.env['INSTALL_DIR'],'include'),
'-DWITH_GDAL=ON',
'-DGDAL_INCLUDE_DIR=' + P.join(self.env['INSTALL_DIR'],'include'),
'-DWITH_GEOTIFF=ON',
'-DGEOTIFF_INCLUDE_DIR=' + P.join(asp_deps_dir,'include'),
'-DTIFF_INCLUDE_DIR=' + P.join(asp_deps_dir,'include'),
'-DTIFF_LIBRARY_RELEASE=' + P.join(asp_deps_dir,'lib', 'libtiff'+ ext),
'-DZLIB_LIBRARY_RELEASE=' + P.join(asp_deps_dir,'lib', 'libz'+ ext),
#'-DGEOTIFF_INCLUDE_DIR=' + P.join(self.env['INSTALL_DIR'],'include'),
#'-DBoost_USE_STATIC_LIBS=OFF',
'-DBUILD_SHARED_LIBS=ON',
'-DBoost_NO_BOOST_CMAKE=OFF',
'-DCMAKE_VERBOSE_MAKEFILE=ON',
'-DBoost_DEBUG=ON',
'-DBoost_DETAILED_FAILURE_MSG=ON',
'-DBoost_NO_SYSTEM_PATHS=ON' # don't use system boost
])
class libelas(GITPackage, CMakePackage):
src = '[email protected]:NeoGeographyToolkit/libelas.git'
@stage
def configure(self):
asp_deps_dir = self.env['ASP_DEPS_DIR']
ext = lib_ext(self.arch.os)
super(libelas, self).configure(other=[
'-DCMAKE_CXX_FLAGS=-O3',
'-DCMAKE_C_FLAGS=-O3',
'-DTIFF_INCLUDE_DIR=' + P.join(asp_deps_dir,'include'),
'-DTIFF_LIBRARY_RELEASE=' + P.join(asp_deps_dir, 'lib', 'libtiff' + ext),
])
@stage
def install(self):
# Copy the 'elas' tool to the plugins subdir meant for it
prog = 'elas'
bindir = P.join(self.env['INSTALL_DIR'], 'plugins', 'stereo', 'elas', 'bin')
self.helper('mkdir', '-p', bindir)
cmd = ['cp', '-fv', P.join(self.builddir, 'elas'), bindir]
self.helper(*cmd)
class geoid(Package):
src = 'https://github.com/NeoGeographyToolkit/StereoPipeline/releases/download/geoid1.0/geoids.tgz'
chksum = 'e6e3961d6a84e10b4c49039b9a84098d57bd2206'
@stage
def configure(self): pass
def compile(self):
self.helper(self.env['GFORTRAN'], '-c','-fPIC','interp_2p5min.f')
if self.arch.os == 'osx':
flag = '-dynamiclib'
ext = '.dylib'
else:
flag = '-shared'
ext = '.so'
self.helper(self.env['GFORTRAN'], flag, '-o', 'libegm2008' + ext, 'interp_2p5min.o')
def install(self):
cmd = ['cp'] + glob(P.join(self.workdir, 'libegm2008.*')) \
+ [P.join(self.env['INSTALL_DIR'], 'lib')]
self.helper(*cmd)
geoidDir = P.join(self.env['INSTALL_DIR'], 'share/geoids')
self.helper('mkdir', '-p', geoidDir)
cmd = ['cp'] + glob(P.join(self.workdir, '*tif')) \
+ glob(P.join(self.workdir, '*jp2')) + [geoidDir]
self.helper(*cmd)
class hdf5(Package):
# This must be synched up with ISIS's hdf5 package in miniconda.
# TODO: Could use just that if our whitelist was able to pick things
# from Minconda's directory.
src = 'https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.18/src/hdf5-1.8.18.tar.bz2'
chksum = 'd7e008cbfcf5cb6913b5327a81bbcaf34cc9436d'
def configure(self):
super(hdf5, self).configure(enable=('cxx'), disable = ['static'])
class armadillo(CMakePackage):
src = 'http://sourceforge.net/projects/arma/files/armadillo-9.100.5.tar.xz'
chksum = 'c4f9bf2c0d0650ba7814ae746e0da088211accfd'
patches = 'patches/armadillo'
@stage
def configure(self):
super(armadillo, self).configure(other=['-DDETECT_HDF5=OFF'])
# Build our copy of the ISIS code...
class isis(GITPackage, CMakePackage):
src = 'https://github.com/USGS-Astrogeology/ISIS3.git'
chksum = 'f6beda24b408a6e352f3a8aeb87505874c555691' # version 4.1
patches = 'patches/isis'
def __init__(self, env):
super(isis, self).__init__(env)
@stage
def configure(self):
# The code is stored one folder down
self.workdir = os.path.join(self.workdir, 'isis')
# Follow the ISIS convention of where the build should be
self.builddir = os.path.join(self.workdir, '../build')
self.env['CONDA_PREFIX'] = self.env['ASP_DEPS_DIR']
# Do not configure as we will fetch the binaries with conda,
# we need only the headers
return
ext = lib_ext(self.arch.os)
super(isis, self).configure(other= [
'-DCMAKE_FIND_ROOT_PATH=' + self.env['ASP_DEPS_DIR'] + ':' \
+ self.env['INSTALL_DIR'],
'-DCMAKE_CXX_COMPILER=' + which(self.env['CXX']),
'-DCMAKE_C_COMPILER=' + which(self.env['CC']),
'-DCMAKE_CXX_FLAGS=-O3 -std=c++11',
'-DCMAKE_C_FLAGS=-O3',
'-DPNG_LIBRARY=' + P.join(self.env['ASP_DEPS_DIR'],'lib/libpng' + ext),
'-DCSPICE_LIBRARY=' + P.join(self.env['ASP_DEPS_DIR'],'lib/libcspice' + ext),
'-DX11_LIBRARY=' + P.join(self.env['ASP_DEPS_DIR'],'lib/libX11' + ext),
'-Dpybindings=Off',
'-DJP2KFLAG=OFF',
'-DbuildTests=OFF',
'-DBUILD_TESTING=OFF',
'-GNinja',
'-DCMAKE_VERBOSE_MAKEFILE=ON',
])
@stage
def compile(self):
# Do not build as we will fetch the binaries with conda,
# so we need only the headers (one day they will upload those too)
return
self.env['ISISROOT'] = self.builddir # Per the ISIS documentation
super(isis, self).compile()
cmd = ('ninja', 'install', '-v')
self.helper(*cmd, cwd=self.builddir)
@stage
def install(self):
# Copy all header files. Some are repeated, but hoping
# for the best. This is a temporary solution.
dest_dir = P.join(self.env['INSTALL_DIR'],'include/isis')
cmd = ['mkdir','-p', dest_dir]
self.helper(*cmd)
src_dir = os.path.join(self.workdir, 'src')
if not os.path.isdir(src_dir):
raise Exception("Cannot find directory: " + src_dir)
header_files = []
print("Copying header files in " + src_dir + " to " + dest_dir)
for root, dirs, files in os.walk(src_dir):
for file_name in files:
if file_name.endswith(".h"):
header_file = os.path.join(root, file_name)
shutil.copy(header_file, dest_dir)
# USGS Community sensor model
# TODO: Make it install in lib and not in lib64 like everything else.
class usgscsm(GITPackage, CMakePackage):
src = 'https://github.com/USGS-Astrogeology/usgscsm'
chksum = 'a53f9cfe30f595809917013c277698a413c32443'
def unpack(self):
super(usgscsm, self).unpack()
cmd = ('git', 'submodule', 'update', '--init', '--recursive')
self.helper(*cmd)
def configure(self):
# # The code is stored one folder down
# self.helper('./autogen')
#self.workdir = os.path.join(self.workdir, 'usgscsm')
super(usgscsm, self).configure(other=[
'-DCMAKE_VERBOSE_MAKEFILE=ON',
'-DCMAKE_CXX_FLAGS=-O3',
'-DCMAKE_C_FLAGS=-O3',
]) #-DNinja
class stereopipeline(GITPackage, CMakePackage):
src = 'https://github.com/NeoGeographyToolkit/StereoPipeline.git'
def configure(self):
## Skip config in fast mode if config file exists
#config_file = P.join(self.workdir, 'config.options')
#if self.fast and os.path.isfile(config_file): return
#self.helper('./autogen')
asp_deps_dir = self.env['ASP_DEPS_DIR']
boost_dir = P.join(asp_deps_dir,'include')
# TODO: Just remove the bad arguments!
if self.arch.os == 'osx':
self.env['LDFLAGS'] = '-Wl,-headerpad_max_install_names'
else:
self.env['LDFLAGS'] += ' -Wl,-O1 -Wl,--enable-new-dtags -Wl,--hash-style=both -m64'
#use_env_flags = False # TODO: What is this?
prefix = self.env['INSTALL_DIR']
installdir = prefix
#vw_build = prefix
#arch = self.arch
#write_asp_config(use_env_flags, prefix, installdir, vw_build,
# arch, geoid, config_file)
#super(stereopipeline, self).configure(
# other = ['docdir=%s/doc' % prefix],
# without = ['clapack', 'slapack', 'tcmalloc'],
# disable = ['pkg_paths_default', 'static', 'qt-qmake'],
# enable = ['debug=ignore', 'optimize=ignore']
# )
super(stereopipeline, self).configure(other=[
'-DASP_DEPS_DIR=' + asp_deps_dir,
'-DVISIONWORKBENCH_INSTALL_DIR=' + installdir,
'-DCMAKE_VERBOSE_MAKEFILE=ON',
])
@stage
def compile(self):
super(stereopipeline, self).compile()
# Run unit tests. If the ISIS env vars are not set,
# the ISIS-related tests will be skipped.
# Make install must happen before 'make check',
# otherwise the old installed library is linked.
#cmd = ('make', 'install')
#self.helper(*cmd)
super(stereopipeline, self).install()
if self.fast or int(self.env['SKIP_TESTS']) == 1:
print("Skipping tests.")
else:
cmd = ('make', 'gtest_all')
# TODO(oalexan1): Replace buildDir below with self.builddir?
buildDir = os.path.join(self.workdir, 'build_binarybuilder')
self.helper(*cmd, cwd=buildDir)
@stage
def install(self):
pass # We installed during the compile step so skip this.
class visionworkbench(GITPackage, CMakePackage):
src = 'https://github.com/visionworkbench/visionworkbench.git'
def __init__(self,env):
super(visionworkbench,self).__init__(env)
@stage
def configure(self):
## Skip config in fast mode if config file exists
#config_file = P.join(self.workdir, 'config.options')
#if self.fast and os.path.isfile(config_file): return
#self.helper('./autogen')
asp_deps_dir = self.env['ASP_DEPS_DIR']
# TODO: Just remove the bad arguments!
if self.arch.os == 'osx':
self.env['LDFLAGS'] = '-Wl,-headerpad_max_install_names'
else:
self.env['LDFLAGS'] += ' -Wl,-O1 -Wl,--enable-new-dtags -Wl,--hash-style=both -m64'
arch = self.arch
installdir = self.env['INSTALL_DIR']
super(visionworkbench, self).configure(other=[
'-DASP_DEPS_DIR=' + asp_deps_dir,
'-DCMAKE_VERBOSE_MAKEFILE=ON',
# -DVW_ENABLE_SSE=0 # on pfe
])
@stage
def compile(self):
super(visionworkbench, self).compile()
# Run unit tests
# Make install must happen before 'make check',
# otherwise the old installed library is linked.
#cmd = ('make', 'install')
#self.helper(*cmd)
super(visionworkbench, self).install()
if self.fast or int(self.env['SKIP_TESTS']) == 1:
print("Skipping tests.")
else:
cmd = ('make', 'gtest_all')
buildDir = os.path.join(self.workdir, 'build_binarybuilder')
self.helper(*cmd, cwd=buildDir)
@stage
def install(self):
pass # We installed during the compile step so skip this.
class lapack(CMakePackage):
src = 'http://www.netlib.org/lapack/lapack-3.5.0.tgz'
chksum = '5870081889bf5d15fd977993daab29cf3c5ea970'
def configure(self):
LDFLAGS_ORIG = self.env['LDFLAGS']
LDFLAGS_CURR = []
for i in self.env['LDFLAGS'].split(' '):
if not i.startswith('-L'):
LDFLAGS_CURR.append(i);
self.env['LDFLAGS'] = ' '.join(LDFLAGS_CURR)
super(lapack, self).configure( other=['-DBUILD_SHARED_LIBS=ON','-DBUILD_STATIC_LIBS=OFF','-DCMAKE_Fortran_FLAGS=-fPIC'] )
self.env['LDFLAGS'] = LDFLAGS_ORIG
class boost(Package):
version = '1_67' # variable is used in class liblas, libnabo, etc.
src = 'http://downloads.sourceforge.net/boost/boost_' + version + '_0.tar.bz2'
chksum = '694ae3f4f899d1a80eb7a3b31b33be73c423c1ae'
patches = 'patches/boost'
def __init__(self, env):
super(boost, self).__init__(env)
self.env['NO_BZIP2'] = '1'
#self.env['NO_ZLIB'] = '1'
if self.arch.os == 'osx':
self.env['PATH'] = '/usr/bin:' + self.env['PATH'] # to use the right libtool
@stage
def configure(self):
with open(P.join(self.workdir, 'user-config.jam'), 'w') as f:
if self.arch.os == 'linux':
toolkit = 'gcc'
elif self.arch.os == 'osx':
toolkit = 'darwin'
# print('variant myrelease : release : <optimization>none <debug-symbols>none ;', file=f)
# print('variant mydebug : debug : <optimization>none ;', file=f)
args = [toolkit] + list(self.env.get(i, ' ') for i in ('CXX', 'CXXFLAGS', 'LDFLAGS'))
print('using %s : : %s : <cxxflags>"%s" <linkflags>"%s -ldl" ;' % tuple(args), file=f)
print('using zlib : 1.2.8 : <include>%s <search>%s ;' %
(P.join(self.env['INSTALL_DIR'],'include'),P.join(self.env['INSTALL_DIR'],'lib')), file=f)
print('option.set keep-going : false ;', file=f)
@stage
def compile(self):
self.env['BOOST_ROOT'] = self.workdir
self.helper('./bootstrap.sh')
os.unlink(P.join(self.workdir, 'project-config.jam'))
cmd = ['./bjam']
if 'MAKEOPTS' in self.env:
cmd += (self.env['MAKEOPTS'],)
self.args = [
'-q', '--user-config=%s/user-config.jam' % self.workdir,
'--prefix=%(INSTALL_DIR)s' % self.env, '--layout=versioned',
'threading=multi', 'variant=release', 'link=shared', 'runtime-link=shared',
'--without-mpi', '--without-python', '--without-wave', 'stage',
'-d+2' # Show commands as they are executed
]
cmd += self.args
self.helper(*cmd)
@stage
def install(self):
self.env['BOOST_ROOT'] = self.workdir
cmd = ['./bjam'] + self.args + ['install']
self.helper(*cmd)
class gsl(Package):
src = 'ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz',
chksum = 'd914f84b39a5274b0a589d9b83a66f44cd17ca8e',
def configure(self):
super(gsl, self).configure(disable=('static'))
class geos(Package):
# This version must be synched up with what ISIS needs.
# Their conda packages provide geos for Linux but not for Mac.
src = 'http://download.osgeo.org/geos/geos-3.5.1.tar.bz2'
chksum = '83373542335c2f20c22d5420ba01d99f645f0c61'
def __init__(self, env):
super(geos, self).__init__(env)
#if self.arch.os == 'linux':
# # Bugfix for SuSE, skip using ccache
#self.env['CXX']='g++'
#self.env['CC']='gcc'
def configure(self):
super(geos, self).configure(disable=('python', 'ruby', 'static'))
class superlu(Package):
# TODO: This may need some tweaks.
src = ['http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sci-libs/superlu/files/superlu-4.3-autotools.patch','http://crd-legacy.lbl.gov/~xiaoye/SuperLU/superlu_4.3.tar.gz']
chksum = ['c9cc1c9a7aceef81530c73eab7f599d652c1fddd','d2863610d8c545d250ffd020b8e74dc667d7cbdd']
def __init__(self,env):
super(superlu,self).__init__(env)
self.patches = [P.join(env['DOWNLOAD_DIR'], 'superlu-4.3-autotools.patch'),
P.join(self.pkgdir,'patches','superlu','finish_autotools.patch')]
@stage
def configure(self):
self.helper('mkdir', 'm4')
self.helper('autoreconf', '-fvi')
blas = ''
if self.arch.os == "osx":
asp_deps_dir = self.env['ASP_DEPS_DIR']
self.env['LDFLAGS'] += ' -Wl,-rpath -Wl,%s/lib -L%s/lib' % (asp_deps_dir, asp_deps_dir)
blas = glob(P.join(self.env['ASP_DEPS_DIR'],'lib','libblas.dylib*'))[0]
#blas = '"-framework vecLib"'
else:
blas = glob(P.join(self.env['ASP_DEPS_DIR'],'lib','libblas.so*'))[0]
if self.arch.os == 'linux':
# This is a bugfix, that took long to investigate. For some versions of Linux,
# the FLIBS in configure contains the -R option, which confuses the compiler.
# This value is determined dynamically. So we really have no choice but
# to edit configure to modify this value before being used.
line_in = 'FLIBS="$ac_cv_f77_libs"'
line_out = 'FLIBS=$(echo "$ac_cv_f77_libs" | perl -pi -e "s/ -R/ -Wl,-R/g")'
configure_file = P.join(self.workdir, 'configure')
replace_line_in_file(configure_file, line_in, line_out)
super(superlu,self).configure(with_=('blas=%s') % blas,
disable=('static'))
@stage
def install(self):
super(superlu, self).install()
# Need to comment out a few lines in the include files to get ISIS to compile with clang!!
file_list = ['slu_cdefs.h', 'slu_ddefs.h', 'slu_sdefs.h', 'slu_zdefs.h']
target_list = ['extern void countnz',
'extern void ilu_countnz',
'extern void fixupL',
'extern void PrintPerf',
'extern void check_tempv',
'double, double, double ', # Hit the lines following the PrintPerf line
'complex, complex, complex ',
'float, float, float ',
'doublecomplex, doublecomplex, doublecomplex '
]
# Use sed to add // before every instance of these targets in these files
for f in file_list:
full_path = P.join(self.env['INSTALL_DIR'],'include', 'superlu', f)
for target in target_list:
cmd = ['sed', '-i', '-e',
"s#"+target+"#//"+target+"#g",
full_path]
self.helper(*cmd)
class gmm(Package):
src = 'http://download-mirror.savannah.gnu.org/releases/getfem/stable/gmm-4.2.tar.gz'
chksum = '3555d5a5abdd525fe6b86db33428604d74f6747c'
patches = 'patches/gmm'
@stage
def configure(self):
self.helper('autoreconf', '-fvi')
blas = ''
if self.arch.os == "osx":
blas = '"-framework vecLib"'
else:
blas = glob(P.join(self.env['INSTALL_DIR'],'lib','libblas.so*'))[0]
super(gmm,self).configure(with_=('blas=%s') % blas)
class xercesc(Package):
src = 'http://archive.apache.org/dist/xerces/c/3/sources/xerces-c-3.1.3.tar.xz'
chksum = '44aa39f8b9ccbfcaf58771634761cbea1084e8f1'
@stage
def configure(self):
super(xercesc,self).configure(with_=['curl=%s' % glob(P.join(self.env['INSTALL_DIR'],'lib','libcurl.*'))[0],
'icu=no'],
disable = ['static', 'msgloader-iconv', 'msgloader-icu', 'network'])
class qt(Package):
src = 'http://download.qt.io/official_releases/qt/5.6/5.6.3/single/qt-everywhere-opensource-src-5.6.3.tar.xz'
chksum = 'ca7a752bff079337876ca6ab70b0dec17b47e70f' #SHA-1 Hash
patches = 'patches/qt'
#patch_level = '-p0'
@stage
def configure(self):
# Modify the min OSX version
config_path = self.workdir + '/qtbase/mkspecs/macx-clang/qmake.conf'
self.helper('sed', '-ibak', '-e',
's/QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7/QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.12/g',
config_path)
## The default confs override our compiler choices.
cmd = ("./configure -c++std c++11 -opensource -confirm-license -release -nomake tools -nomake examples "
"-prefix %(INSTALL_DIR)s "
"-no-openssl -no-libjpeg -no-libpng -no-cups -no-openvg -no-sql-psql -no-pulseaudio "
"-skip qt3d "
"-skip qtactiveqt "
"-skip qtandroidextras "
"-skip qtconnectivity "
"-skip qtlocation "
"-skip qtmacextras "
"-skip qtquickcontrols "
"-skip qtquickcontrols2 "
"-skip qtsensors "
"-skip qtserialbus "
"-skip qtserialport "
"-skip qtwayland "
"-skip qtwebchannel "
"-skip qtwebengine "
"-skip qtwebview "
"-skip qtwinextras "
) % self.env
# TODO: Make sure static libraries are not built! Causes linker error in ASP in OSX.
args = cmd.split()
if self.arch.os == 'osx':
args.append('-no-framework')
args.append('-no-xcb')
args.append('-no-pch') # Required to avoid weird redefinition errors, but slows down compilation.
args.extend(['-skip', 'x11extras'])
args.extend(['-platform', 'macx-clang'])
else:
args.append('-qt-xcb') # Not needed on OSX
self.helper(*args)
@stage
def install(self):
super(qt, self).install()
# Add a Prefix entry to INSTALL_DIR/bin/qt.conf so that qmake
# finds the correct QT install location!
config_path = os.path.join(self.env['INSTALL_DIR'], 'bin/qt.conf')
print(config_path)
with open(config_path, "w") as f:
f.write('[Paths]\n')
f.write('Plugins=../lib/plugins/\n')
f.write('Prefix='+self.env['INSTALL_DIR']+'\n')
class qwt(Package):
src = 'http://downloads.sourceforge.net/qwt/qwt-6.1.3.tar.bz2',
chksum = '90ec21bc42f7fae270482e1a0df3bc79cb10e5c7',
patches = 'patches/qwt'
def configure(self):
installDir = self.env['INSTALL_DIR']
# Wipe old installation, otherwise qwt refuses to install
cmd = ['rm', '-vf'] + glob(P.join(installDir, 'lib/', 'libqwt.*'))
self.helper(*cmd)
cmd = [installDir + '/bin/qmake','-spec']
if self.arch.os == 'osx':
cmd.append(P.join(installDir,'mkspecs','macx-clang'))
else:
cmd.append(P.join(installDir,'mkspecs','linux-g++'))
self.helper(*cmd)