5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 # Create THIRDPARTYLICENSE files using the index file in $CODEMGR_WS.
37 # -c: only generate crypto license file
38 my $usage = "mktpl [-c] license-list-file";
40 my $top = $ENV{"CODEMGR_WS"};
42 die "CODEMGR_WS must be set.\n";
46 die "usage: $usage\n";
49 die "usage: $usage\n";
52 my $indexfile = $ARGV[0];
57 # Create a THIRDPARTYLICENSE file from the given license list and suffix.
60 my ($suffix, @tpllist) = @_;
62 my $tplname = "$top/THIRDPARTYLICENSE.$suffix";
69 open(TPL, ">$tplname") or die "Can't create $tplname: $!\n";
71 print TPL "DO NOT TRANSLATE OR LOCALIZE.\n\n";
73 foreach my $licfile (@tpllist) {
74 my $descrip = `cat "$licfile.descrip"`;
76 warn "Missing description for $licfile\n";
78 $descrip = "(MISSING DESCRIPTION for $licfile)\n";
80 print TPL "$licnum) The following software may be included ",
81 "in this product:\n\n";
82 print TPL "\t$descrip\n";
83 print TPL " Use of this software is governed by the ",
84 "terms of the following license:\n";
86 if (open(LIC, "<$licfile")) {
92 warn "Can't open $licfile: $!\n";
94 print TPL " (MISSING LICENSE: $licfile)\n";
100 close TPL or die "I/O error on $tplname: $!\n";
104 # Return non-zero if we expect the crypto for the given
105 # third-party license file to be signed. Else, return zero.
107 my $hashes = qr"/(rng|md4|md5|sha1/sha2)/";
111 return 0 if $licpath =~ m#$hashes#;
116 # Make file list for each TPL file.
119 chdir($top) or die "Can't chdir to $top: $!\n";
122 my $isclosed = qr"^usr/closed";
123 my $iscrypto = qr"(^usr/src/common/crypto)|(^usr/src/lib/pkcs11)";
128 open(IX, "<$indexfile") or die "Can't open $indexfile: $!\n";
132 if (! $opt_c && $lic =~ /$isclosed/) {
133 push @closedlist, $lic;
135 if ($lic =~ /$iscrypto/ && signedcrypto($lic)) {
136 push @cryptolist, $lic;
142 # Generate each TPL file.
145 maketpl("ON-BINARIES", @closedlist);
146 maketpl("ON-CRYPTO", @cryptolist);