Skip to content
Commits on Source (1427)
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="samples/" kind="src" path=""/>
<classpathentry kind="src" path="samples"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
syntax: glob
*~
*OPT.OBJ/*
*DBG.OBJ/*
*DBG.OBJD/*
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>jss</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
This diff is collapsed.
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_PKI Project Profile
formatter_settings_version=12
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=false
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
sp_cleanup.add_missing_override_annotations_interface_methods=true
sp_cleanup.add_serial_version_id=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=false
sp_cleanup.format_source_code_changes_only=false
sp_cleanup.make_local_variable_final=false
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=false
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
sp_cleanup.remove_unnecessary_casts=true
sp_cleanup.remove_unnecessary_nls_tags=false
sp_cleanup.remove_unused_imports=true
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
sp_cleanup.use_blocks=false
sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
This diff is collapsed.
#! gmake
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#######################################################################
# (1) Include initial platform-independent assignments (MANDATORY). #
#######################################################################
include manifest.mn
#######################################################################
# (2) Include "global" configuration information. (OPTIONAL) #
#######################################################################
include $(CORE_DEPTH)/coreconf/config.mk
#######################################################################
# (3) Include "component" configuration information. (OPTIONAL) #
#######################################################################
#######################################################################
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
# have to put this here, instead of in rules.mk, so that Java gets
# built first
all:: buildJava
test_jss: testJava
include $(CORE_DEPTH)/coreconf/rules.mk
#######################################################################
# (6) Execute "component" rules. (OPTIONAL) #
#######################################################################
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################
include rules.mk
package:
$(MAKE) -C pkg publish
============================================
|| Upstream JSS Build/Test Instructions ||
============================================
(1) Prepare a work area
(a) For upstream builds which checkout and utilize
the current NSPR and NSS source repositories:
# mkdir sandbox
# cd sandbox
# hg clone https://hg.mozilla.org/projects/nspr
# hg clone https://hg.mozilla.org/projects/nss
# git clone git@github.com:dogtagpki/jss.git
# cd ..
(There is no need to clone every time. For additional builds,
simply use:
cd nspr; hg pull -u -v; cd ..; cd nss; hg pull -u -v; cd ..;
cd jss; hg pull -u -v; cd ..
)
(b) Alternatively, for upstream builds which use
the NSPR and NSS installed on the system:
# mkdir sandbox
# cd sandbox
# export USE_INSTALLED_NSPR=1
# export USE_INSTALLED_NSS=1
# export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
# export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
# export NSPR_INCLUDE_DIR=`/usr/bin/pkg-config --cflags-only-I nspr | sed 's/-I//'`
# export NSPR_LIB_DIR=`/usr/bin/pkg-config --libs-only-L nspr | sed 's/-L//'`
# export NSS_INCLUDE_DIR=`/usr/bin/pkg-config --cflags-only-I nss | sed 's/-I//'`
# export NSS_LIB_DIR=`/usr/bin/pkg-config --libs-only-L nss | sed 's/-L//'`
# export XCFLAGS="-g"
# hg clone https://hg.mozilla.org/projects/jss
# cd ..
(There is no need to clone every time. For additional builds,
simply use:
cd jss; hg pull -u -v; cd ..
)
(2) Prepare an interactive shell for building:
# export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0_openjdk
# export USE_64=1
NOTE: JSS will now attempt to verify whether or not these two
environment variables have been set (JAVA_HOME is mandatory;
USE_64 is mandatory on 64-bit platforms when building 64-bit).
The following steps are optional, and left to the discretion of the user:
Debug vs. Optimized jar files:
By default, JSS will be built as a debuggable jar
(xpclass_dbg.jar - generally recommended for test builds);
to create an optimized jar (xpclass.jar), set the following
environment variable:
# export BUILD_OPT=1
Beta vs. Non-Beta builds:
Finally, by default, JSS is not built as a "beta" release (as
specified in 'org/mozilla/jss/util/jssver.h'):
#define JSS_BETA PR_FALSE
If a "beta" version of JSS is desired, reset this #define (as
specified in 'org/mozilla/jss/util/jssver.h') to:
#define JSS_BETA PR_TRUE
(3) Build JSS
# cd sandbox/jss
# make clean all
# cd ../..
(or you can run "# script -c 'make clean all' typescript.build")
NOTE: When build method (1)(a) is being utilized, if nss has not been
built, it will now automatically be built before jss; if nss has
already been built, only jss will be built/re-built.
(4) Install JSS on the System (Optional)
If JSS already exists on the system, run something similar to the
following command(s):
# sudo mv /usr/lib/java/jss4.jar /usr/lib/java/jss4.jar.orig
If the platform is 32-bit Linux:
# sudo mv /usr/lib/jss/libjss4.so /usr/lib/jss/libjss4.so.orig
else if the platform is 64-bit Linux:
# sudo mv /usr/lib64/jss/libjss4.so /usr/lib64/jss/libjss4.so.orig
If BUILD_OPT is undefined (default Debuggable Jar):
# sudo cp sandbox/dist/xpclass_dbg.jar /usr/lib/java/jss4.jar
else if BUILD_OPT is defined (Optimized Jar):
# sudo cp sandbox/dist/xpclass.jar /usr/lib/java/jss4.jar
# sudo chown root:root /usr/lib/java/jss4.jar
# sudo chmod 644 /usr/lib/java/jss4.jar
# sudo cp sandbox/jss/lib/Linux*.OBJ/libjss4.so /usr/lib64/jss/libjss4.so
# sudo chown root:root /usr/lib64/jss/libjss4.so
# sudo chmod 755 /usr/lib64/jss/libjss4.so
(5) Run JSS Tests (Optional, but only if build method (1)(a) was utilized)
If build method (1)(a) is being utilized, it is possible to run the
built-in JSS tests:
# cd sandbox/jss
# make test_jss
# cd ../..
(or you can run "# script -c 'make test_jss' typescript.tests")
NOTE: This command is currently only available on Linux and Macintosh
platforms when method (1)(a) has been utilized to build JSS
since the tests are dependent upon the work area as setup in
this method; currenty JSS must be built via 'make clean all' before
execution of this command (e.g. - build is separate from test).
(6) Restoration of non-Test-Only Systems (Optional)
If step (4) above was run, and the system is being used for purposes
other than test, the user may wish to restore the original system JSS
by running the following commands:
# sudo mv /usr/lib/java/jss4.jar.orig /usr/lib/java/jss4.jar
If the platform is 32-bit Linux:
# sudo mv /usr/lib/jss/libjss4.so.orig /usr/lib/jss/libjss4.so
else if the platform is 64-bit Linux:
# sudo mv /usr/lib64/jss/libjss4.so.orig /usr/lib64/jss/libjss4.so
NOTE: For this procedure, no ownership or permission changes should
be necessary.
(7) Tagging the Source Code for a Release
During development, several releases may be made. Consequently, it is
good practice to create a "regular tag" to the source code at these
various points in time using the following format:
# hg tag -m "message" JSS_<major>_<minor>_YYYYMMDD
where: <major> = JSS Major Version Number
<minor> = JSS Minor Version Number
YYYY = 4-digit year (e. g. - 2017)
MM = 2-digit month (e. g. - 01, ..., 12)
DD = 2-digit day of the month (e. g. - 01, ..., 31)
For example:
# hg id
b3e864205ff0+ tip
# hg tag -m "Added tag JSS_4_4_20170328 for changeset b3e864205ff0" JSS_4_4_20170328
At the appropriate time, a new major.minor version may be created. At this
time, it is important to create a maintenance branch for any future changes
to the previous major.minor version:
For example:
# hg id
f00f00f00f00+ tip
# hg branch -m "Created branch JSS_4_4_BRANCH for changeset f00f00f00f00" JSS_4_4_BRANCH
(8) Known Issues
* Mozilla Bug #1346410 - Load JSS libraries appropriately
NOTE: This issue should not occur unless step (4) above was skipped.
Testing failures were found while working on Bug 1346410 when loading the
JSS libraries to meet requirements of certain operating systems. Our
investigation revealed that due to the nature of the changes made via this
patch and its interaction with the HMAC Tests (both non-FIPS and FIPS),
that a failure may be encountered on one or more of the HMAC algorithms
causing these two tests to fail. On 64-bit Linux, for example, the
workaround for this issue is to perform the following steps before
re-running the tests:
(a) Install the new JSS builds by executing step (4) above
(b) Execute the following commands:
# cd sandbox/jss; make test_jss
NOTE: If the system is being used for purposes other than test, the user
may wish to restore the original JSS by executing step (6) above.
#use strict;
use File::Find;
use File::Compare;
use File::Basename;
use File::stat;
use File::Copy;
@excluded_sources = qw(
provider\.new/
org/mozilla/jss/provider/java/security/KeyFactorySpi1_4\.java
org/mozilla/jss/pkix/cert/X509Certificate\.java
samples/
);
@javah_classes = qw(
org.mozilla.jss.DatabaseCloser
org.mozilla.jss.CryptoManager
org.mozilla.jss.crypto.Algorithm
org.mozilla.jss.crypto.EncryptionAlgorithm
org.mozilla.jss.crypto.PQGParams
org.mozilla.jss.crypto.SecretDecoderRing
org.mozilla.jss.asn1.ASN1Util
org.mozilla.jss.pkcs11.CertProxy
org.mozilla.jss.pkcs11.CipherContextProxy
org.mozilla.jss.pkcs11.PK11Module
org.mozilla.jss.pkcs11.ModuleProxy
org.mozilla.jss.pkcs11.PK11Cert
org.mozilla.jss.pkcs11.PK11Cipher
org.mozilla.jss.pkcs11.PK11KeyWrapper
org.mozilla.jss.pkcs11.PK11MessageDigest
org.mozilla.jss.pkcs11.PK11PrivKey
org.mozilla.jss.pkcs11.PK11PubKey
org.mozilla.jss.pkcs11.PK11SymKey
org.mozilla.jss.pkcs11.PK11KeyPairGenerator
org.mozilla.jss.pkcs11.PK11SymmetricKeyDeriver
org.mozilla.jss.pkcs11.PK11KeyGenerator
org.mozilla.jss.pkcs11.PK11Token
org.mozilla.jss.pkcs11.PrivateKeyProxy
org.mozilla.jss.pkcs11.PublicKeyProxy
org.mozilla.jss.pkcs11.SymKeyProxy
org.mozilla.jss.pkcs11.KeyProxy
org.mozilla.jss.pkcs11.PK11Token
org.mozilla.jss.pkcs11.TokenProxy
org.mozilla.jss.pkcs11.PK11Signature
org.mozilla.jss.pkcs11.PK11Store
org.mozilla.jss.pkcs11.PK11KeyPairGenerator
org.mozilla.jss.pkcs11.SigContextProxy
org.mozilla.jss.pkcs11.PK11RSAPublicKey
org.mozilla.jss.pkcs11.PK11DSAPublicKey
org.mozilla.jss.pkcs11.PK11ECPublicKey
org.mozilla.jss.pkcs11.PK11SecureRandom
org.mozilla.jss.provider.java.security.JSSKeyStoreSpi
org.mozilla.jss.SecretDecoderRing.KeyManager
org.mozilla.jss.ssl.SSLSocket
org.mozilla.jss.ssl.SSLServerSocket
org.mozilla.jss.ssl.SocketBase
org.mozilla.jss.util.Debug
org.mozilla.jss.util.Password
);
@packages = qw(
org.mozilla.jss
org.mozilla.jss.asn1
org.mozilla.jss.crypto
org.mozilla.jss.pkcs7
org.mozilla.jss.pkcs10
org.mozilla.jss.pkcs11
org.mozilla.jss.pkcs12
org.mozilla.jss.pkix.primitive
org.mozilla.jss.pkix.cert
org.mozilla.jss.pkix.cmc
org.mozilla.jss.pkix.cmmf
org.mozilla.jss.pkix.cms
org.mozilla.jss.pkix.crmf
org.mozilla.jss.provider.java.security
org.mozilla.jss.provider.javax.crypto
org.mozilla.jss.SecretDecoderRing
org.mozilla.jss.ssl
org.mozilla.jss.tests
org.mozilla.jss.util
);
# setup environment
setup_env();
# setup variables
setup_vars(\@ARGV);
# run the command with its arguments
my $cmd = (shift || "build"); # first argument is command
grep { s/(.*)/"$1"/ } @ARGV; # enclose remaining arguments in quotes
my $args = join(",",@ARGV); # and comma-separate them
eval "$cmd($args)"; # now run the command
if( $@ ) {
die $@; # errors in eval will be put in $@
}
# END
sub grab_cmdline_vars {
my $argv = shift;
while( $$argv[0] =~ /(.+)=(.*)/ ) {
$cmdline_vars{$1} = $2;
shift @$argv;
}
}
sub dump_cmdline_vars {
print "Command variables:\n";
for(keys %cmdline_vars) {
print "$_=" . $cmdline_vars{$_} . "\n";
}
}
sub setup_env {
# check that JAVA_HOME environment variable has been set externally
$ENV{JAVA_HOME} or
die "\nMust specify JAVA_HOME environment variable!\n"
. "(e. g. - export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0_openjdk)"
. "\n\n";
print "JAVA_HOME=$ENV{'JAVA_HOME'}\n";
# check that USE_64 environment variable has been set externally
# for 64-bit architectures (when applicable)
$bitsize = `getconf LONG_BIT`;
if( $bitsize == 64 ) {
$ENV{USE_64} or
die "\nMust specify USE_64 environment variable!\n"
. "(e. g. - export USE_64=1)\n\n";
print "USE_64=$ENV{'USE_64'}\n";
}
}
sub setup_vars {
my $argv = shift;
grab_cmdline_vars($argv);
dump_cmdline_vars();
$jar = "$ENV{JAVA_HOME}/bin/jar";
$javac = "$ENV{JAVA_HOME}/bin/javac";
$javah = "$ENV{JAVA_HOME}/bin/javah";
$javadoc = "$ENV{JAVA_HOME}/bin/javadoc";
$dist_dir = $cmdline_vars{SOURCE_PREFIX};
$jce_jar = $ENV{JCE_JAR};
$class_release_dir = $cmdline_vars{SOURCE_RELEASE_PREFIX};
if( $ENV{BUILD_OPT} ) {
$class_dir = "$dist_dir/classes";
$class_jar = "$dist_dir/$cmdline_vars{XPCLASS_JAR}";
$class_release_dir .= "/$cmdline_vars{SOURCE_RELEASE_CLASSES_DIR}";
$javac_opt_flag = "-O";
$debug_source_file = "org/mozilla/jss/util/Debug_ship.jnot";
} else {
$class_dir = "$dist_dir/classes_DBG";
$class_jar = "$dist_dir/$cmdline_vars{XPCLASS_DBG_JAR}";
$class_release_dir .= "/$cmdline_vars{SOURCE_RELEASE_CLASSES_DBG_DIR}";
$javac_opt_flag = "-g";
$debug_source_file = "org/mozilla/jss/util/Debug_debug.jnot";
}
$jni_header_dir = "$dist_dir/private/jss/_jni";
if( $jce_jar ) {
$classpath = "-classpath $jce_jar";
}
# retrieve present working directory
$pwd = `pwd`;
$pwd =~ chomp $pwd;
# retrieve architecture
$arch = `uname -m`;
$arch =~ chomp $arch;
# retrieve operating system
$os = `uname`;
$os =~ chomp $os;
if( ( $ENV{USE_INSTALLED_NSPR} ) && ( $ENV{USE_INSTALLED_NSS} ) ) {
print "Using the NSPR and NSS installed on the system to build JSS.\n";
} else {
# Verify existence of work area
if(( ! -d "$pwd/../nspr" ) ||
( ! -d "$pwd/../nss" ) ||
( ! -d "$pwd/../jss" )) {
my $workarea = "\nA work area must first be prepared; for example:\n\n"
. " mkdir sandbox\n"
. " cd sandbox\n"
. " hg clone https://hg.mozilla.org/projects/nspr\n"
. " hg clone https://hg.mozilla.org/projects/nss\n"
. " hg clone https://hg.mozilla.org/projects/jss\n"
. " cd ..\n\n";
die "$workarea";
}
# Build NSS if not already built
if( ! -d $dist_dir ) {
print("########################\n" .
"# BEGIN: Building NSS #\n" .
"########################\n");
print_do("cd ../nss;make clean nss_build_all;cd ../jss");
print("######################\n" .
"# END: Building NSS #\n" .
"######################\n");
}
if( $os eq 'Linux' || $os eq 'Darwin' ) {
# set major and minor release numbers
$majorrel = `uname -r | cut -f1 -d.`;
$majorrel =~ chomp $majorrel;
$minorrel = `uname -r | cut -f2 -d.`;
$minorrel =~ chomp $minorrel;
# read the contents of the $dist_dir into an array
opendir DIR, $dist_dir or die "Cannot open directory: $!";
my @files = readdir DIR;
closedir DIR;
# process the array to obtain the NSS OBJDIR_NAME
my $prefix = "$os$majorrel.$minorrel";
foreach my $file (@files) {
if ((index($file, $prefix) != -1) &&
(index($file, "_cc") != -1)) {
$nss_objdir_name = $file;
print "NSS OBJDIR_NAME=$nss_objdir_name\n";
# craft JSS OBJDIR_NAME based upon value of NSS OBJDIR_NAME
$jss_objdir_name = $nss_objdir_name;
$jss_objdir_name =~ s/_cc//;
print "JSS OBJDIR_NAME=$jss_objdir_name\n";
break;
}
}
# create a JSS OBJDIR_NAME symlink to NSS OBJDIR_NAME in $dist_dir
$jss_symlink = "$pwd/../dist/$jss_objdir_name";
if( ! -l $jss_symlink ) {
my $cmd = "cd ../dist;"
. "ln -s $nss_objdir_name $jss_objdir_name;"
. "cd ../jss";
print_do($cmd);
}
print "jss_symlink=$jss_symlink\n"
}
}
}
sub clean {
print_do("rm -rf $class_dir");
print_do("rm -f $class_jar");
print_do("rm -rf $jni_header_dir");
}
sub build {
#
# copy the appropriate debug file
#
my $debug_target_file = "org/mozilla/jss/util/Debug.java";
if( compare($debug_source_file, $debug_target_file) ) {
copy($debug_source_file, $debug_target_file) or die "Copying file: $!";
}
#
# generate manifest.mf file in lib dir
#
my $manifest_file = "MANIFEST.MF";
my $jss_revision = `grep JSS_VERSION org/mozilla/jss/util/jssver.h`;
chop($jss_revision);
$jss_revision = substr($jss_revision, 22, 3);
my $build_revision = $jss_revision;
$append = 0;
if ($append) {
open(MYOUTFILE, ">MANIFEST.MF"); #open for write, overwrite
} else {
open(MYOUTFILE, ">>MANIFEST.MF"); #open for write, append
}
#*** Print freeform text, semicolon required ***
print MYOUTFILE <<"MyLabel";
Manifest-Version: 1.0
Name: org/mozilla/jss/
Specification-Title: Network Security Services for Java (JSS)
Specification-Version: $jss_revision
Specification-Vendor: Mozilla Foundation
Implementation-Title: org.mozilla.jss
Implementation-Version: $build_revision
Implementation-Vendor: Mozilla Foundation
MyLabel
#*** Close the file ***
close(MYOUTFILE);
#
# recursively find *.java
#
my %source_list;
find sub {
my $name = $File::Find::name;
if( $name =~ /\.java$/) {
$source_list{$File::Find::name} = 1;
}
}, ".";
#
# weed out files that are excluded or don't need to be updated
#
my $file;
foreach $file (keys %source_list) {
my $pattern;
foreach $pattern (@excluded_sources) {
if( $file =~ /$pattern/ ) {
delete $source_list{$file};
}
}
unless( java_source_needs_update( $file, $class_dir ) ){
delete $source_list{$file};
}
}
my @source_list = keys(%source_list);
#
# build the java sources
#
if( scalar(@source_list) > 0 ) {
ensure_dir_exists($class_dir);
print_do("$javac $javac_opt_flag -sourcepath . -d $class_dir " .
"$classpath " . join(" ",@source_list));
print_do("sh -c 'pwd && cd $class_dir && pwd && rm -f $class_jar && pwd && ls -al && ls -al ../../dist && $jar -cvmf ../../jss/$manifest_file ../$class_jar *'");
print_do("rm -f $manifest_file");
print "Exit status was " . ($?>>8) . "\n";
}
#
# create the JNI header files
#
ensure_dir_exists($jni_header_dir);
print_do("$javah -classpath $class_dir -d $jni_header_dir " .
(join " ", @javah_classes) );
}
sub print_do {
my $cmd = shift;
print "$cmd\n";
system($cmd);
my $exit_status = $?>>8;
$exit_status and die "Command failed ($exit_status)\n";
}
sub needs_update {
my $target = shift;
my @dependencies = @_;
my $target_mtime = (stat($target))[9];
my $dep;
foreach $dep( @dependencies ) {
my $dep_mtime = (stat($dep))[9];
if( $dep_mtime > $target_mtime ) {
return 1;
}
}
return 0;
}
# A quick-and-dirty way to guess whether a .java file needs to be rebuilt.
# We merely look for a .class file of the same name. This won't work if
# the source file's directory is different from its package, and it
# doesn't know about nested or inner classes.
# source_file: the relative path to the source file ("org/mozilla/jss/...")
# dest_dir: the directory where classes are output ("../../dist/classes_DBG")
# Returns 1 if the source file is newer than the class file, or the class file
# doesn't exist. Returns 0 if the class file is newer than the source file.
sub java_source_needs_update {
my $source_file = shift;
my $dest_dir = shift;
my $class_dir = "$dest_dir/" . dirname($source_file);
my $class_file = basename($source_file);
$class_file =~ s/\.java/.class/;
$class_file = $class_dir . "/" . $class_file;
if( -f $class_file ) {
my $class_stat = stat($class_file);
my $source_stat = stat($source_file);
if( $source_stat->mtime > $class_stat->mtime) {
# class file exists and is out of date
return 1;
} else {
#class file exists and is up to date
return 0;
}
} else {
# class file hasn't been generated yet.
return 1;
}
}
# Recursively makes the given directory. Dies at the first sign of trouble
sub ensure_dir_exists {
my $dir = shift;
my $parent = dirname($dir);
if( $parent ne $dir ) {
ensure_dir_exists($parent);
}
if( ! -d $dir ) {
mkdir($dir, 0777) or die "Failed to mkdir $dir: $!";
}
}
sub release {
# copy all class files into release directory
ensure_dir_exists("$class_release_dir");
print_do("cp -r $class_dir/* $class_release_dir");
}
sub javadoc {
my $html_header_opt;
if( $ENV{HTML_HEADER} ) {
$html_header_opt = "-header '$ENV{HTML_HEADER}'";
}
ensure_dir_exists("$dist_dir/jssdoc");
my $targets = join(" ", @packages);
print "$targets\n";
print_do("$javadoc -breakiterator -sourcepath . -d $dist_dir/jssdoc $html_header_opt $targets");
print_do("cp $dist_dir/jssdoc/index.html $dist_dir/jssdoc/index.html.bak");
print_do("cp $dist_dir/jssdoc/overview-summary.html $dist_dir/jssdoc/index.html");
}
sub test {
if( ( $ENV{USE_INSTALLED_NSPR} ) && ( $ENV{USE_INSTALLED_NSS} ) ) {
die "make test_jss is only available on upstream builds of Linux and MacOS platforms.";
} elsif( $os eq 'Linux' || $os eq 'Darwin' ) {
# Test JSS presuming that it has already been built
if(( -d $dist_dir ) &&
( -l $jss_symlink )) {
my $cmd = "cd $pwd/org/mozilla/jss/tests;"
. "perl all.pl dist $jss_symlink;"
. "cd $pwd";
print("#######################\n" .
"# BEGIN: Testing JSS #\n" .
"#######################\n");
print_do($cmd);
print("#####################\n" .
"# END: Testing JSS #\n" .
"#####################\n");
} else {
die "JSS builds are not available at $jss_symlink.";
}
} else {
die "make test_jss is only available on Linux and MacOS platforms.";
}
}
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Configuration information unique to the "sectools" component
#
#######################################################################
# Local "sectools" component library link options #
#######################################################################
include $(CORE_DEPTH)//config/linkage.mk
#######################################################################
# Local "sectools" component STATIC system library names #
#######################################################################
include $(CORE_DEPTH)/config/static.mk
#######################################################################
# Local "sectools" component DYNAMIC system library names #
#######################################################################
include $(CORE_DEPTH)/config/dynamic.mk
# Stricter semantic checking for SunOS compiler. This catches calling
# undeclared functions, a major headache during debugging.
ifeq ($(OS_ARCH), SunOS)
OS_CFLAGS += -v
endif
ifeq ($(OS_ARCH), WINNT)
LINK_DLL += -LIBPATH:$(SOURCE_LIB_DIR)
LINK_DLL += -LIBPATH:$(JAVA_HOME)/$(JAVA_LIBDIR)
LINK_DLL += $(foreach file,$(LD_LIBS),-DEFAULTLIB:"$(notdir $(file))")
endif
CFLAGS += -I$(JAVA_HOME)/include
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#######################################################################
# Initialize DYNAMIC system library names on some platforms #
#######################################################################
#
# AIX platforms
#
ifeq ($(OS_ARCH),AIX)
ifeq ($(OS_RELEASE),4.1)
DLLSYSTEM += -lsvld -lC_r -lC -lpthreads -lc_r -lm /usr/lib/libc.a
else
DLLSYSTEM += -ldl -lC_r -lC -lpthreads -lc_r -lm /usr/lib/libc.a
endif
endif
#
# HP/UX platforms
#
ifeq ($(OS_ARCH),HP-UX)
ifeq ($(USE_PTHREADS), 1)
DLLSYSTEM += -lpthread
endif
ifeq ($(PTHREADS_USER), 1)
DLLSYSTEM += -lpthread
endif
ifeq ($(OS_RELEASE),A.09.03)
DLLSYSTEM += -ldld -L/lib/pa1.1 -lm
else
DLLSYSTEM += -ldld -lm -lc
endif
endif
#
# IRIX platforms
#
ifeq ($(OS_ARCH), IRIX)
ifeq ($(USE_PTHREADS), 1)
DLLSYSTEM += -lpthread
endif
endif
#
# Linux platforms
#
ifeq ($(OS_ARCH), Linux)
DLLSYSTEM += -ldl -lpthread -lm
endif
#
# NCR platforms
#
ifeq ($(OS_ARCH), NCR)
DLLSYSTEM += -lsocket -ldl -lnsl -lc
endif
#
# OSF 1 platforms
#
ifeq ($(OS_ARCH),OSF1)
ifneq ($(OS_RELEASE),V2.0)
DLLSYSTEM += -lc_r
endif
ifeq ($(USE_PTHREADS), 1)
DLLSYSTEM += -lpthread -lrt
endif
ifeq ($(USE_IPV6), 1)
DLLSYSTEM += -lip6
endif
endif
#
# SCO platforms
#
ifeq ($(OS_ARCH), SCO_SV)
DLLSYSTEM += -lsocket -ldl -lnsl -lc
endif
#
# Solaris platforms
#
ifeq ($(OS_ARCH), SunOS)
ifneq ($(OS_RELEASE), 4.1.3_U1)
DLLSYSTEM += -lthread -lposix4 -lsocket -lnsl -lintl -ldl
endif
endif
#
# UNIXWARE platforms
#
ifeq ($(OS_ARCH), UNIXWARE)
DLLSYSTEM += -lsocket
endif
#
# Windows platforms
#
ifeq ($(OS_ARCH),WINNT)
ifneq ($(OS_TARGET),WIN16)
DLLSYSTEM += wsock32.lib winmm.lib
endif
endif
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#######################################################################
# Adjust variables for component library linkage on some platforms #
#######################################################################
#
# AIX platforms
#
ifeq ($(OS_ARCH),AIX)
LDOPTS += -blibpath:.:$(PWD)/$(SOURCE_LIB_DIR):/usr/lib/threads:/usr/lpp/xlC/lib:/usr/lib:/lib
endif
#
# HP/UX platforms
#
ifeq ($(OS_ARCH), HP-UX)
LDOPTS += -Wl,+s,+b,$(PWD)/$(SOURCE_LIB_DIR)
endif
#
# IRIX platforms
#
ifeq ($(OS_ARCH), IRIX)
LDOPTS += -rpath $(PWD)/$(SOURCE_LIB_DIR)
endif
#
# OSF 1 platforms
#
ifeq ($(OS_ARCH), OSF1)
LDOPTS += -rpath $(PWD)/$(SOURCE_LIB_DIR) -lpthread
endif
#
# Solaris platforms
# NOTE: Disable optimization on SunOS4.1.3
#
ifeq ($(OS_ARCH), SunOS)
ifneq ($(OS_RELEASE), 4.1.3_U1)
ifdef NS_USE_GCC
LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(SOURCE_LIB_DIR)
else
LDOPTS += -R $(PWD)/$(SOURCE_LIB_DIR)
endif
else
OPTIMIZER =
endif
endif
#
# Windows platforms
#
ifeq ($(OS_ARCH), WINNT)
LDOPTS += -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
endif
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#######################################################################
### ###
### R U L E S O F E N G A G E M E N T ###
### ###
#######################################################################
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#######################################################################
# Initialize STATIC system library names on some platforms #
#######################################################################
#
# AIX platforms
#
ifeq ($(OS_ARCH),AIX)
ifeq ($(OS_RELEASE),4.1)
LIBSYSTEM += /lib/libsvld.a /lib/libC_r.a /lib/libC.a /lib/libpthreads.a /lib/libc_r.a /lib/libm.a /lib/libc.a
else
LIBSYSTEM += -ldl /lib/libC_r.a /lib/libC.a /lib/libpthreads.a /lib/libc_r.a /lib/libm.a /lib/libc.a
endif
endif
#
# HP/UX platforms
#
ifeq ($(OS_ARCH),HP-UX)
ifeq ($(USE_PTHREADS), 1)
LIBSYSTEM += -lpthread
endif
ifeq ($(PTHREADS_USER), 1)
LIBSYSTEM += -lpthread
endif
ifeq ($(OS_RELEASE),A.09.03)
LIBSYSTEM += -ldld -L/lib/pa1.1 -lm
else
LIBSYSTEM += -ldld -lm -lc
endif
endif
#
# Linux platforms
#
ifeq ($(OS_ARCH), Linux)
LIBSYSTEM += -ldl
endif
#
# IRIX platforms
#
ifeq ($(OS_ARCH), IRIX)
ifeq ($(USE_PTHREADS), 1)
LIBSYSTEM += -lpthread
endif
endif
#
# OSF 1 platforms
#
ifeq ($(OS_ARCH),OSF1)
ifneq ($(OS_RELEASE),V2.0)
LIBSYSTEM += -lc_r
endif
ifeq ($(USE_PTHREADS), 1)
LIBSYSTEM += -lpthread -lrt
endif
ifeq ($(USE_IPV6), 1)
LIBSYSTEM += -lip6
endif
endif
#
# Solaris platforms
#
ifeq ($(OS_ARCH), SunOS)
ifneq ($(OS_RELEASE), 4.1.3_U1)
ifeq ($(OS_RELEASE), 5.5.1_i86pc)
LIBSYSTEM += -lsocket -lnsl -lintl -ldl
else
ifeq ($(OS_RELEASE), 5.6_i86pc)
LIBSYSTEM += -lsocket -lnsl -lintl -ldl
else
LIBSYSTEM += -lthread -lposix4 /lib/libsocket.a /lib/libnsl.a /lib/libintl.a -ldl
endif
endif
endif
endif
#
# UNIXWARE platforms
#
ifeq ($(OS_ARCH), UNIXWARE)
LIBSYSTEM += -lsocket
endif
#
# Windows platforms
#
ifeq ($(OS_ARCH),WINNT)
ifneq ($(OS_TARGET),WIN16)
LIBSYSTEM += wsock32.lib winmm.lib
endif
endif
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Config stuff for AIX.
include $(CORE_DEPTH)/coreconf/UNIX.mk
#
# There are two implementation strategies available on AIX:
# pthreads, and pthreads-user. The default is pthreads.
# In both strategies, we need to use pthread_user.c, instead of
# aix.c. The fact that aix.c is never used is somewhat strange.
#
# So we need to do the following:
# - Default (PTHREADS_USER not defined in the environment or on
# the command line):
# Set PTHREADS_USER=1, USE_PTHREADS=1
# - PTHREADS_USER=1 set in the environment or on the command line:
# Do nothing.
#
ifeq ($(PTHREADS_USER),1)
USE_PTHREADS = # just to be safe
IMPL_STRATEGY = _PTH_USER
else
USE_PTHREADS = 1
PTHREADS_USER = 1
endif
DEFAULT_COMPILER = xlc_r
CC = xlc_r
CCC = xlC_r
CPU_ARCH = rs6000
RANLIB = ranlib
OS_CFLAGS = -DAIX -DSYSV
OS_LIBS += -blibpath:/usr/lib:/lib -lc -lm
DSO_LDOPTS = -brtl -bnortllib -bM:SRE -bnoentry
MKSHLIB = $(LD) $(DSO_LDOPTS) -blibpath:/usr/lib:/lib -lc -lm
AIX_WRAP = $(DIST)/lib/aixwrap.o
AIX_TMP = $(OBJDIR)/_aix_tmp.o
ifdef MAPFILE
DSO_LDOPTS += -bexport:$(MAPFILE)
else
DSO_LDOPTS += -bexpall
endif
PROCESS_MAP_FILE = grep -v ';+' $< | grep -v ';-' | \
sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' > $@
ifdef BUILD_OPT
OPTIMIZER += -qmaxmem=-1
endif
ifeq ($(USE_64), 1)
OS_CFLAGS += -DAIX_64BIT
OBJECT_MODE=64
export OBJECT_MODE
endif
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include $(CORE_DEPTH)/coreconf/Linux.mk
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include $(CORE_DEPTH)/coreconf/UNIX.mk
DEFAULT_COMPILER = gcc
CC = gcc
CCC = g++
RANLIB = ranlib
ifeq ($(OS_TEST),i386)
OS_REL_CFLAGS = -D__i386__
CPU_ARCH = x86
else
ifeq ($(OS_TEST),ppc)
OS_REL_CFLAGS = -D__ppc__
CPU_ARCH = ppc
else
ifeq ($(OS_TEST),sparc)
OS_REL_CFLAGS = -D__sparc__
CPU_ARCH = sparc
else
# treat the ultrasparc like a regular sparc, at least for now!
ifeq ($(OS_TEST),sparc_v9)
OS_REL_CFLAGS = -D__sparc__
CPU_ARCH = sparc
endif
endif
endif
endif
DLL_SUFFIX = so
OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wall -Wno-switch -DBSD_OS -DBSDI -Dunix -DHAVE_STRERROR -DHAVE_BSD_FLOCK
ARCH = bsdos
DSO_CFLAGS = -fPIC -DPIC
DSO_LDOPTS = -shared -Wl,-soname,lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
ifdef LIBRUNPATH
DSO_LDOPTS += -Wl,-R$(LIBRUNPATH)
endif
MKSHLIB = $(CC) $(DSO_LDOPTS)
ifdef MAPFILE
# Add LD options to restrict exported symbols to those in the map file
endif
# Change PROCESS to put the mapfile in the correct format for this platform
PROCESS_MAP_FILE = cp $< $@
G++INCLUDES = -I/usr/include/g++
INCLUDES += -I/usr/X11R6/include
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include $(CORE_DEPTH)/coreconf/UNIX.mk
XP_DEFINE := $(XP_DEFINE:-DXP_UNIX=-DXP_BEOS)
USE_PTHREADS =
ifeq ($(USE_PTHREADS),1)
IMPL_STRATEGY = _PTH
endif
CC = gcc
CCC = g++
RANLIB = ranlib
DEFAULT_COMPILER = gcc
ifeq ($(OS_TEST),ppc)
OS_REL_CFLAGS = -Dppc
CPU_ARCH = ppc
else
OS_REL_CFLAGS = -Di386
CPU_ARCH = x86
endif
MKSHLIB = $(CC) -nostart -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
ifdef BUILD_OPT
OPTIMIZER = -O2
endif
OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wall -Wno-switch -pipe
OS_LIBS = -lbe
DEFINES += -DBEOS
ifdef USE_PTHREADS
DEFINES += -D_REENTRANT
endif
ARCH = beos
DSO_CFLAGS = -fPIC
DSO_LDOPTS =
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include $(CORE_DEPTH)/coreconf/UNIX.mk
DEFAULT_COMPILER = gcc
CC = gcc
CCC = g++
RANLIB = ranlib
ifndef CPU_ARCH
# When cross-compiling, CPU_ARCH should already be defined as the target
# architecture, set to powerpc or i386.
CPU_ARCH := $(shell uname -p)
endif
ifeq (,$(filter-out i%86,$(CPU_ARCH)))
ifdef USE_64
CC += -arch x86_64
override CPU_ARCH = x86_64
else
OS_REL_CFLAGS = -Di386
CC += -arch i386
override CPU_ARCH = x86
endif
else
ifeq (arm,$(CPU_ARCH))
# Nothing set for arm currently.
else
OS_REL_CFLAGS = -Dppc
CC += -arch ppc
endif
endif
ifneq (,$(MACOS_SDK_DIR))
GCC_VERSION_FULL := $(shell $(CC) -dumpversion)
GCC_VERSION_MAJOR := $(shell echo $(GCC_VERSION_FULL) | awk -F. '{ print $$1 }')
GCC_VERSION_MINOR := $(shell echo $(GCC_VERSION_FULL) | awk -F. '{ print $$2 }')
GCC_VERSION = $(GCC_VERSION_MAJOR).$(GCC_VERSION_MINOR)
ifeq (,$(filter-out 2 3,$(GCC_VERSION_MAJOR)))
# GCC <= 3
DARWIN_SDK_FRAMEWORKS = -F$(MACOS_SDK_DIR)/System/Library/Frameworks
ifneq (,$(shell find $(MACOS_SDK_DIR)/Library/Frameworks -maxdepth 0))
DARWIN_SDK_FRAMEWORKS += -F$(MACOS_SDK_DIR)/Library/Frameworks
endif
DARWIN_SDK_CFLAGS = -nostdinc -isystem $(MACOS_SDK_DIR)/usr/include/gcc/darwin/$(GCC_VERSION) -isystem $(MACOS_SDK_DIR)/usr/include $(DARWIN_SDK_FRAMEWORKS)
DARWIN_SDK_LDFLAGS = -L$(MACOS_SDK_DIR)/usr/lib/gcc/darwin -L$(MACOS_SDK_DIR)/usr/lib/gcc/darwin/$(GCC_VERSION_FULL) -L$(MACOS_SDK_DIR)/usr/lib
DARWIN_SDK_SHLIBFLAGS = $(DARWIN_SDK_LDFLAGS) $(DARWIN_SDK_FRAMEWORKS)
NEXT_ROOT = $(MACOS_SDK_DIR)
export NEXT_ROOT
else
# GCC >= 4
DARWIN_SDK_CFLAGS = -isysroot $(MACOS_SDK_DIR)
ifneq (4.0.0,$(GCC_VERSION_FULL))
# gcc > 4.0.0 passes -syslibroot to ld based on -isysroot.
# Don't add -isysroot to DARWIN_SDK_LDFLAGS, because the programs
# that are linked with those flags also get DARWIN_SDK_CFLAGS.
DARWIN_SDK_SHLIBFLAGS = -isysroot $(MACOS_SDK_DIR)
else
# gcc 4.0.0 doesn't pass -syslibroot to ld, it needs to be
# explicit.
DARWIN_SDK_LDFLAGS = -Wl,-syslibroot,$(MACOS_SDK_DIR)
DARWIN_SDK_SHLIBFLAGS = $(DARWIN_SDK_LDFLAGS)
endif
endif
LDFLAGS += $(DARWIN_SDK_LDFLAGS)
endif
# "Commons" are tentative definitions in a global scope, like this:
# int x;
# The meaning of a common is ambiguous. It may be a true definition:
# int x = 0;
# or it may be a declaration of a symbol defined in another file:
# extern int x;
# Use the -fno-common option to force all commons to become true
# definitions so that the linker can catch multiply-defined symbols.
# Also, common symbols are not allowed with Darwin dynamic libraries.
OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wall -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK $(DARWIN_SDK_CFLAGS)
ifdef BUILD_OPT
ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
OPTIMIZER = -Oz
else
OPTIMIZER = -O2
endif
ifdef MOZ_DEBUG_SYMBOLS
ifdef MOZ_DEBUG_FLAGS
OPTIMIZER += $(MOZ_DEBUG_FLAGS)
else
OPTIMIZER += -gdwarf-2 -gfull
endif
endif
endif
ARCH = darwin
DSO_CFLAGS = -fPIC
# May override this with different compatibility and current version numbers.
DARWIN_DYLIB_VERSIONS = -compatibility_version 1 -current_version 1
# May override this with -bundle to create a loadable module.
DSO_LDOPTS = -dynamiclib $(DARWIN_DYLIB_VERSIONS) -install_name @executable_path/$(notdir $@) -headerpad_max_install_names
MKSHLIB = $(CC) $(DSO_LDOPTS) $(DARWIN_SDK_SHLIBFLAGS)
DLL_SUFFIX = dylib
ifdef MAPFILE
MKSHLIB += -exported_symbols_list $(MAPFILE)
endif
PROCESS_MAP_FILE = grep -v ';+' $< | grep -v ';-' | \
sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,^,_,' > $@
USE_SYSTEM_ZLIB = 1
ZLIB_LIBS = -lz