1 | # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 |
---|
2 | |
---|
3 | # Global Keywords |
---|
4 | PortSystem 1.0 |
---|
5 | PortGroup github 1.0 |
---|
6 | |
---|
7 | github.setup bazelbuild bazel 0.5.1 |
---|
8 | github.tarball_from releases |
---|
9 | categories devel |
---|
10 | maintainers tfmnet.com:mohamed.issa \ |
---|
11 | openmaintainer |
---|
12 | description A tool for automating builds and tests. |
---|
13 | long_description ${description} |
---|
14 | platforms darwin |
---|
15 | license Apache-2 |
---|
16 | |
---|
17 | # Pre-Fetch Phase |
---|
18 | pre-fetch { |
---|
19 | # Make sure the Java compiler exists |
---|
20 | set cmdnm "javac" |
---|
21 | set param [auto_execok $cmdnm] |
---|
22 | if {$param == ""} { |
---|
23 | error "The Java compiler was not detected on this machine. \ |
---|
24 | Please ensure JDK 8 or newer is properly installed." |
---|
25 | } |
---|
26 | |
---|
27 | # Get the Java compiler version and then extract the major + minor parts |
---|
28 | set ver [exec -ignorestderr -- $cmdnm -version 2>@1] |
---|
29 | set count [scan $ver "%s %d.%d." cmdnm mjver mnver] |
---|
30 | if {$count != 3} { |
---|
31 | error "The Java compiler version data could not be parsed." |
---|
32 | } |
---|
33 | |
---|
34 | # Check for major version incompatbility |
---|
35 | if {$mjver < 1} { |
---|
36 | error "The installed JDK is too old, please upgrade to JDK 8 or newer." |
---|
37 | } |
---|
38 | |
---|
39 | # Check for minor version incompatbility |
---|
40 | if {$mjver == 1} { |
---|
41 | if {$mnver < 8} { |
---|
42 | error "The installed JDK is too old, please upgrade to JDK 8 or newer." |
---|
43 | } |
---|
44 | } |
---|
45 | } |
---|
46 | |
---|
47 | # Fetch Phase |
---|
48 | distname ${distname}-dist |
---|
49 | dist_subdir ${name} |
---|
50 | |
---|
51 | # Checksum Phase |
---|
52 | checksums rmd160 e0b5b8bd17df2557219561ece7c0020f330ebfe4 \ |
---|
53 | sha256 85e6a18b111afeea2e475fe991db2a441ec3824211d659bee7b0012c36be9a40 |
---|
54 | |
---|
55 | # Extract Phase |
---|
56 | use_zip yes |
---|
57 | extract.mkdir yes |
---|
58 | |
---|
59 | # Patch Phase |
---|
60 | patch {} |
---|
61 | |
---|
62 | # Configure Phase |
---|
63 | use_configure no |
---|
64 | |
---|
65 | # Build Phase |
---|
66 | build { |
---|
67 | # The Bazel compilation script erroneously writes to the standard |
---|
68 | # error stream, so we'll just ignore it. If the build fails, then there |
---|
69 | # won't be a binary to copy and the destroot phase will fail. |
---|
70 | exec -ignorestderr -- bash ${worksrcpath}/compile.sh |
---|
71 | |
---|
72 | # Run the bash completion script generator with the same error |
---|
73 | # handling intentions as the compilation script. |
---|
74 | exec -ignorestderr -- bash ${worksrcpath}/scripts/generate_bash_completion.sh \ |
---|
75 | --bazel=${worksrcpath}/output/${name} \ |
---|
76 | --output=${worksrcpath}/output/${name}-complete.bash |
---|
77 | } |
---|
78 | |
---|
79 | # Test Phase |
---|
80 | test {} |
---|
81 | |
---|
82 | # Destroot Phase |
---|
83 | destroot { |
---|
84 | # Copy compiled binary |
---|
85 | set bindir ${prefix}/bin |
---|
86 | xinstall -d ${destroot}${bindir} |
---|
87 | xinstall -m 755 -W ${worksrcpath}/output ${name} ${destroot}${bindir} |
---|
88 | |
---|
89 | # Copy bash completion script |
---|
90 | xinstall -m 755 -W ${worksrcpath}/output ${name}-complete.bash ${destroot}${bindir} |
---|
91 | } |
---|
92 | |
---|
93 | # Post-Destroot Phase |
---|
94 | post-destroot { |
---|
95 | # Mark documentation, source, and example directories |
---|
96 | set docdir ${prefix}/share/doc/${name} |
---|
97 | set srcdir ${prefix}/src/${name} |
---|
98 | set expdir ${prefix}/share/examples/${name} |
---|
99 | |
---|
100 | # Copy documentation files |
---|
101 | xinstall -d ${destroot}${docdir} |
---|
102 | xinstall -m 644 -W ${worksrcpath} AUTHORS \ |
---|
103 | CHANGELOG.md \ |
---|
104 | CONTRIBUTING.md \ |
---|
105 | CONTRIBUTORS \ |
---|
106 | ISSUE_TEMPLATE.md \ |
---|
107 | LICENSE \ |
---|
108 | README.md \ |
---|
109 | ${destroot}${docdir} |
---|
110 | |
---|
111 | # Copy source files |
---|
112 | xinstall -d ${destroot}${srcdir} |
---|
113 | file copy -force {*}[glob ${worksrcpath}/src/*] ${destroot}${srcdir} |
---|
114 | |
---|
115 | # Copy example files |
---|
116 | xinstall -d ${destroot}${expdir} |
---|
117 | file copy -force {*}[glob ${worksrcpath}/examples/*] ${destroot}${expdir} |
---|
118 | } |
---|
119 | |
---|
120 | notes " |
---|
121 | You can activate bash completion by adding the following line to your ~/.bash_profile: |
---|
122 | |
---|
123 | source ${prefix}/bin/bazel-complete.bash |
---|
124 | |
---|
125 | See http://bazel.build/docs/getting-started.html to start a new project! |
---|
126 | " |
---|