Commit ff56f43d authored by Patrick Brunschwig's avatar Patrick Brunschwig

new build system completely decoupled from Mozilla

parent 9846b799
......@@ -5,18 +5,10 @@
XPI_MODULE = enigmail
XPI_MODULE_VERS = 1.6
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DEPTH = .
include $(DEPTH)/config/autoconf.mk
MOZILLA_VERSION_PARTS = $(subst ., ,$(MOZILLA_VERSION))
MOZILLA_MAJOR_VERSION = $(firstword $(MOZILLA_VERSION_PARTS))
TMP_VAR = $(word 2,$(MOZILLA_VERSION_PARTS))
MOZILLA_MINOR_VERSION = $(shell echo $(TMP_VAR)|sed 's/[a-z].*//')
DIRS = ipc public
DIRS += ui package lang
......@@ -24,49 +16,43 @@ DIRS += ui package lang
PLATFORM_STR = unknown
# Edit the lines below as needed, depending upon your platform(s)
ifeq ($(OS_ARCH),Linux)
ifeq ($(OS_TARGET),Linux)
PLATFORM_STR = linux
endif
ifeq ($(OS_ARCH),WIN95)
ifeq ($(OS_TARGET),WIN95)
PLATFORM_STR = win32
endif
ifeq ($(OS_ARCH),WINNT)
ifeq ($(OS_TARGET),WINNT)
PLATFORM_STR = win32
endif
ifeq ($(OS_CONFIG),SunOS5)
ifeq ($(OS_CONFIG),SunOS)
PLATFORM_STR = sunos5
endif
ifeq ($(OS_ARCH),Darwin)
ifeq ($(OS_TARGET),Darwin)
PLATFORM_STR = darwin
endif
ifeq ($(OS_ARCH),FreeBSD)
ifeq ($(OS_TARGET),FreeBSD)
PLATFORM_STR = freebsd
endif
ifeq ($(OS_ARCH),OpenBSD)
ifeq ($(OS_TARGET),OpenBSD)
PLATFORM_STR = openbsd
endif
ifeq ($(OS_ARCH),OS2)
ifeq ($(OS_TARGET),OS2)
PLATFORM_STR = os2
endif
ifeq ($(OS_ARCH),OSF1)
ifeq ($(OS_TARGET),OSF1)
PLATFORM_STR = osf1
endif
XPIFILE = $(XPI_MODULE)-$(XPI_MODULE_VERS)-$(PLATFORM_STR)-$(TARGET_CPU).xpi
ifeq ($(TARGET_XPCOM_ABI),)
ENIG_XPCOM_ABI = $(OS_ARCH)
else
ENIG_XPCOM_ABI = $(OS_ARCH)_$(TARGET_XPCOM_ABI)
endif
XPIFILE = $(XPI_MODULE)-$(XPI_MODULE_VERS)-$(PLATFORM_STR)-$(CPU_ARCH).xpi
.PHONY: dirs $(DIRS)
......@@ -78,10 +64,13 @@ $(DIRS):
$(MAKE) -C $@
xpi:
$(srcdir)/genxpi $(XPIFILE) $(XPI_MODULE_VERS) $(OS_ARCH) "$(TARGET_XPCOM_ABI)" $(MOZ_APP_NAME)-$(MOZ_APP_VERSION) $(DIST)/bin $(srcdir) $(XPI_MODULE) $(DLL_SUFFIX) $(LIB_PREFIX)
$(srcdir)/util/genxpi $(XPIFILE) $(XPI_MODULE_VERS) $(OS_TARGET) $(CPU_ARCH) $(DIST) $(srcdir) $(XPI_MODULE) $(DLL_SUFFIX) $(DLL_PREFIX)
clean:
test -f $(DIST)/bin/$(XPIFILE) && rm $(DIST)/bin/$(XPIFILE) || echo ""
rm -f build/$(XPIFILE)
for dir in $(DIRS); do \
$(MAKE) -C $$dir clean; \
done
distclean: clean
rm -rf build/*
# **** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "MPL"); you may not use this file
# except in compliance with the MPL. You may obtain a copy of
# the MPL at http://www.mozilla.org/MPL/
#
# Software distributed under the MPL is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the MPL for the specific language governing
# rights and limitations under the MPL.
#
# The Original Code is Enigmail.
#
# The Initial Developer of the Original Code is Ramalingam Saravanan.
# Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
# Copyright (C) 2001 Ramalingam Saravanan. All Rights Reserved.
#
# Contributor(s):
# Patrick Brunschwig <patrick@enigmail.net>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
# ***** END LICENSE BLOCK *****
# Makefile for build directory
DIRS =
# Specify these as parameters to the make command
XPI_MODULE = enigmime
XPI_MODULE_VERS = 1.5
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = enigmime
LIBRARY_NAME = enigmime
SHORT_LIBNAME = enigmime
MODULE_NAME = EnigModule
IS_COMPONENT = 1
FORCE_SHARED_LIB = 1
ifeq ($(OS_ARCH),WINNT)
EXPORT_LIBRARY = 0
USE_STATIC_LIBS = 1
endif
MOZILLA_VERSION_PARTS = $(subst ., ,$(MOZILLA_VERSION))
MOZILLA_MAJOR_VERSION = $(firstword $(MOZILLA_VERSION_PARTS))
TMP_VAR = $(word 2,$(MOZILLA_VERSION_PARTS))
MOZILLA_MINOR_VERSION = $(shell echo $(TMP_VAR)|sed 's/[a-z].*//')
ENIG_GECKO_VERSION=$(MOZILLA_MAJOR_VERSION)$(MOZILLA_MINOR_VERSION)
DEFINES += -DMOZILLA_MAJOR_VERSION=$(MOZILLA_MAJOR_VERSION)
DEFINES += -DMOZILLA_MINOR_VERSION=$(MOZILLA_MINOR_VERSION)
ifdef USE_XPCOM_GLUE
# Ensure that the xpcom classes that we build
# do not export themselves
DEFINES += -D_IMPL_NS_COM_OFF -DXPCOM_GLUE
endif
REQUIRES = xpcom \
string \
msgbase \
msgbaseutil \
msgsmime \
pref \
js \
necko \
uconv \
unicharutil \
msgcompose \
editor \
dom \
intl \
msgimap \
exthandler \
mailnews \
msgdb \
chardet \
ipc \
caps \
mime \
mimetype \
xpconnect \
pipnss \
$(NULL)
CPPSRCS = nsEnigModule.cpp
LOCAL_INCLUDES = \
-I$(srcdir)/../src \
-I$(srcdir)/../ipc/src \
$(NULL)
# hack to build non standard library dependent build on unix
ifeq ($(ENIGMAIL_STATIC),1)
BUILD_STATIC = -nodefaultlibs -Xlinker --unresolved-symbols=ignore-all
else
BUILD_STATIC =
endif
# separate libraries linked in.
SHARED_LIBRARY_LIBS = \
../src/$(LIB_PREFIX)enigmime_s.$(LIB_SUFFIX) \
$(NULL)
ifeq ($(OS_ARCH),WINNT)
EXTRA_DSO_LDOPTS = \
$(LIBS_DIR) \
$(XPCOM_GLUE_LDOPTS) \
$(NSPR_LIBS) \
$(NSPR_LIBS) \
$(WIN32_CRT_LIBS) \
$(NULL)
else
EXTRA_DSO_LDOPTS = \
$(LIBS_DIR) \
$(XPCOM_GLUE_LDOPTS) \
$(XPCOM_LIBS) \
$(NSPR_LIBS) \
$(BUILD_STATIC) \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk
This diff is collapsed.
This diff is collapsed.
# @configure_input@
CC = @CC@
PERL = @PERL@
PYTHON = @PYTHON@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
OS_TARGET = @BUILD_OS_ARCH@
CPU_ARCH = @BUILD_TARGET_CPU@
DLL_PREFIX = @DLL_PREFIX@
DLL_SUFFIX = @DLL_SUFFIX@
srcdir = @srcdir@
DIST = $(DEPTH)/build/dist
BUILD = $(DEPTH)/build
#!/usr/bin/env perl
# Determin Target OS name and CPU type as used by Mozilla
# based on input from autoconf / configure
# usage:
# -c|-o target_os target_cpu compiler
#
# -c : CPU and compiler type
# -o : OS type
if ($#ARGV != 3) {
exit (1);
}
my $srcOs = $ARGV[1];
my $srcCpu = $ARGV[2];
my $srcComp = $ARGV[3];
my $targetOs = "";
my $targetCpu = "";
my $targetComp = "";
my $dllPrefix = "";
my $dllSuffix = "";
# determine OS-Name
if ($srcOs =~ /^darwin/i) {
$targetOs = "Darwin";
}
elsif ($srcOs =~ /linux/i) {
$targetOs = "Linux";
}
elsif ($srcOs =~ /FreeBSD/i) {
$targetOs = "FreeBSD";
}
elsif ($srcOs =~ /OpenBSD/i) {
$targetOs = "OpenBSD";
}
elsif ($srcOs =~ /NetBSD/i) {
$targetOs = "NetBSD";
}
elsif ($srcOs =~ /OS2/i) {
$targetOs = "OS2";
}
elsif ($srcOs =~ /aix/i) {
$targetOs = "AIX";
}
elsif ($srcOs =~ /beos/i) {
$targetOs = "BeOS";
}
elsif ($srcOs =~ /irix/i) {
$targetOs = "IRIX64";
}
elsif ($srcOs =~ /hpux/i) {
$targetOs = "HP-UX";
}
elsif ($srcOs =~ /sun/i) {
$targetOs = "SunOS";
}
elsif ($srcOs =~ /(mingw|win)/i) {
$targetOs = "WINNT";
}
else {
$targetOs = $srcOs;
}
# determine CPU
if ($srcCpu =~ /x86[_-]64/i) {
$targetCpu = "x86_64";
}
elsif ($srcCpu =~ /i[3456]86/i) {
$targetCpu = "x86";
}
elsif ($srcCpu =~ /ppc/i) {
$targetCpu = "ppc";
}
elsif ($srcCpu =~ /alpha/i) {
$targetCpu = "Alpha";
}
elsif ($srcCpu =~ /sparc/i) {
$targetCpu = "sparc";
}
elsif ($srcCpu =~ /ia64/i) {
$targetCpu = "ia64";
}
elsif ($srcCpu =~ /arm/i) {
$targetCpu = "arm";
}
else {
$targetCpu = $srcCpu;
}
# determine Compiler
if ($targetOs eq "WINNT") {
$targetComp = "msvc";
}
if ($srcComp =~ /^gcc/) {
$targetComp = "gcc3";
}
elsif ($srcComp =~ /^cc/) {
if ($targetOs eq "SunOS") {
$targetComp = "sunc";
}
elsif ($targetOs eq "AIX") {
$targetComp = "ibmc";
}
}
else {
$targetComp = $srcComp;
}
# determine DLL prefix
if ($targetOs eq "WINNT") {
$dllSuffix = ".dll";
}
elsif ($targetOs eq "Darwin") {
$dllPrefix = "lib";
$dllSuffix = ".dylib";
}
else {
$dllPrefix = "lib";
$dllSuffix = ".so";
}
if ($ARGV[0] =~ /^-o$/i) {
printf ($targetOs);
}
elsif ($ARGV[0] =~ /^-c$/i) {
printf ("%s-%s", $targetCpu, $targetComp);
}
elsif ($ARGV[0] =~ /^-dp$/i) {
printf ($dllPrefix);
}
elsif ($ARGV[0] =~ /^-ds$/i) {
printf ($dllSuffix);
}
else {
exit(1);
}
This diff is collapsed.
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
min_automake_version="1.10"
AC_INIT([enigmail],[1.6], [http://www.enigmail.net])
AC_PATH_PROG(PYTHON, "python")
if test "x$PYTHON" = "x" ; then
AC_MSG_ERROR([[python not found.]])
fi
AC_PATH_PROG(PERL,"perl")
if test "x$PERL" = "x" ; then
AC_MSG_ERROR([[Perl not found.]])
fi
AC_PROG_CC
if test "x$ac_cv_prog_cc_c89" = "xno" ; then
AC_MSG_ERROR([[No C-89 compiler found]])
fi
AC_CANONICAL_TARGET
changequote(,)dnl
BUILD_OS_ARCH=`$PERL config/getOsTarget.pl -o "$target_os" "$target_cpu" "$CC"`
BUILD_TARGET_CPU=`$PERL config/getOsTarget.pl -c "$target_os" "$target_cpu" "$CC"`
DLL_PREFIX=`$PERL config/getOsTarget.pl -dp "$target_os" "$target_cpu" "$CC"`
DLL_SUFFIX=`$PERL config/getOsTarget.pl -ds "$target_os" "$target_cpu" "$CC"`
changequote([,])dnl
AC_SUBST(BUILD_OS_ARCH)
AC_SUBST(BUILD_TARGET_CPU)
AC_SUBST(DLL_PREFIX)
AC_SUBST(DLL_SUFFIX)
AC_CONFIG_FILES([config/autoconf.mk])
AC_OUTPUT
This diff is collapsed.
......@@ -2,16 +2,13 @@
# 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/.
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DEPTH = ..
include $(DEPTH)/config/autoconf.mk
DIRS = modules
ifneq ($(OS_ARCH),WINNT)
ifneq ($(OS_TARGET),WINNT)
DIRS += src
endif
......@@ -25,4 +22,7 @@ $(DIRS):
$(MAKE) -C $@
clean:
for dir in $(DIRS); do \
$(MAKE) -C $$dir clean; \
done
#!/usr/bin/perl
# makemake: script to generate Makefile from Makefile.in
# -r: process recursively all subdirectories
# -o DIR: use DIR as MOZ_OBJDIR
# Usage: makemake [-o @TOPSRCDIR@/somedir] [-r]
my $makelist="./Makefile.in.ipc";
my $mozObjDir=".";
my $makefile;
my $cwd=`pwd`;
chomp($cwd);
my $topdir=$cwd;
my $depth="";
open(MAKEFILE, $makelist) || die ("Could not open '$makelist'\n");
while (my $l = <MAKEFILE>) {
chomp($l);
if ($l =~ /^\s*DEPTH\s*=/) {
$l =~ s/(^\s*DEPTH\s*=\s*)(.*)$/$2/;
$depth = $l;
}
}
close(MAKEFILE);
if ($depth eq "") {
while ( (length($topdir)>0) && ( basename($topdir) ne "mozilla" )) {
$topdir=dirname($topdir);
}
}
else {
chdir($depth) || die "Directory '$depth' not found\n";
$topdir=`pwd`;
chomp($topdir);
chdir($cwd);
}
print "INFO: found toplevel source directory $topdir\n";
if (open(MOZCONFIG, "$topdir/.mozconfig")) {
while (my $l = <MOZCONFIG>) {
chomp($l);
if ($l =~ /^\s*mk_add_options\s+MOZ_OBJDIR\s*=/) {
$l =~ s/(^\s*mk_add_options\s+MOZ_OBJDIR\s*=\s*)(.*)$/$2/;
$mozObjDir = $l;
}
}
close(MOZCONFIG);
}
else {
print "INFO: no .mozconfig file found\n";
}
while ( $#ARGV >= 0 ) {
if ($ARGV[0] eq "-o") {
$mozObjDir=$ARGV[1];
shift @ARGV;
}
if ($ARGV[0] eq "-r") {
$makelist=`find . -name Makefile.in.ipc -print`;
break;
}
shift @ARGV;
}
$mozObjDir =~ s/\@TOPSRCDIR\@/$topdir/;
if ($mozObjDir eq ".") {
print "INFO: no MOZ_OBJDIR used\n";
}
else {
print "INFO: using MOZ_OBJDIR=$mozObjDir\n\n";
}
foreach $makefile (split(/[ \n\r]+/, $makelist)) {
$makefile =~ s/^\.\///;
my $dir=dirname("$cwd/$makefile");
my $wd=$dir;
print "Processing: $wd\n";
my $top_srcdir="";
my $newMakefile = $makefile;
$newMakefile =~ s/.in.ipc$//;
if ($mozObjDir eq ".") {
# no OBJDIR specified
if ($depth eq "") {
while ( (length($wd)>0) && (basename($wd) ne "mozilla") ) {
if (length($top_srcdir) == 0) {
$top_srcdir="..";
}
else {
$top_srcdir="../$top_srcdir";
}
$wd=dirname($wd);
}
}
else {
$top_srcdir=$topdir;
}
$srcdir=".";
}
else {
# using OBJDIR
if ($depth eq "") {
while ( (length($wd)>0) && (basename($wd) ne "mozilla") ) {
$wd=dirname($wd);
}
$top_srcdir=$wd;
}
else {
$top_srcdir=$topdir;
}
$srcdir=$dir;
my $targetDir=$srcdir;
$targetDir =~ s/$top_srcdir/$mozObjDir/x;
system("mkdir -p '$targetDir'");
$newMakefile=sprintf("%s/%s", $targetDir, basename($newMakefile));
}
open(INFILE, $makefile) || die ("cannot open input file '$makefile'\n");
open(OUTFILE, ">$newMakefile") || die ("cannot open output file '$newMakefile'\n");
my $line;
while ($line = <INFILE>) {
$line =~ s/\@srcdir\@/$srcdir/g;
$line =~ s/\@top_srcdir\@/$top_srcdir/g;
print OUTFILE $line;
}
close(INFILE);
close(OUTFILE);
}
if ($mozObjDir eq ".") {
print "Done\n\n";
}
else {
my $newWd=$cwd;
$newWd =~ s/$topdir/$mozObjDir/x;
print "Done. The code can now be compiled from $newWd\n\n";
}
sub basename {
my $fn=$_[0];
$fn =~ s/^(.*)\/(.*)$/$2/;
return $fn;
}
sub dirname {
my $dn=$_[0];
$dn =~ s/^(.*)\/(.*)$/$1/;
return $dn;
}
/*
* MAKEMAKE.CMD for OS/2
*
* REXX script to make Makefile from Makefile.in in OS/2
*
* Usage:
* MAKEMAKE.CMD [/R] [ObjDir]
*
* /R: create Makefiles recursively in all subdirectories
* ObjDir: should correspond to the MOZ_OBJDIR parameter of
* your .mozconfig, if defined
*
*/
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
PARSE ARG ObjDir;
if ObjDir = '' then do
Makelist.0 = 1;
Makelist.1 = 'Makefile.in.ipc';
ObjDir = '';
end
else do
Switch = SUBWORD(ObjDir, 1, 1);
ObjDir = SUBWORD(ObjDir, 2, 1);
if (Switch = '/r') | (Switch = '/R') then do
CALL SysFileTree 'Makefile.in.ipc', 'Makelist', 'FSO'
end /* do */
else do
Makelist.0 = 1;
Makelist.1 = 'Makefile.in.ipc';
ObjDir = Switch;
end /* do */
end
/*
* Check if ObjDir is correct
*/
CurDir = DIRECTORY();
if ObjDir \= '' then do
ObjDir = DIRECTORY(ObjDir);
if ObjDir = '' then
SIGNAL Usage
SAY 'ObjDir:' ObjDir
end /* if ObjDir */
/*
* Find TOPSRCDIR (usally x:/Mozilla)
*/
TopSrcDir = DIRECTORY(CurDir);
DO WHILE (TopSrcDir \= '') & (FILESPEC('name', TopSrcDir) \= 'mozilla')
TopSrcDir = DIRECTORY(..);
end /* do */
TopSrcDir = TRANSLATE(TopSrcDir, '/', '\');
n = LENGTH(TopSrcDir);
CALL DIRECTORY CurDir
/*
* Create Makefile
*/
'@ECHO OFF'
do i = 1 to Makelist.0
SAY Makelist.i
SrcDir = FILESPEC('path', Makelist.i);
Drive = FILESPEC('drive', Makelist.i);
SrcDir = STRIP(Drive||SrcDir,'T','\');
SrcDir = DIRECTORY(SrcDir);
ObjMake = 'Makefile';
if ObjDir \= '' then do
RelDir = SUBSTR(SrcDir, n+1);
ObjMake = ObjDir||RelDir'\Makefile';
CALL SysMkDir ObjDir||RelDir;
end /* do */
SAY ObjMake
SrcDir = TRANSLATE(SrcDir, '/', '\');
'sed.exe -e "s,@top_srcdir@,'TopSrcDir',g" -e "s,@srcdir@,'SrcDir',g" Makefile.in > 'ObjMake
SAY 'srcdir:' SrcDir
SAY 'topsrcdir:' TopSrcDir
SAY
end /* do 1 to Makelist.0 ... */
CALL DIRECTORY CurDir
EXIT 0;
Usage:
SAY 'Usage: MAKEMAKE.CMD [/R] [ObjDir]'
EXIT 1;
......@@ -3,16 +3,10 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Specify these as parameters to the make command
DEPTH = ../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
DEPTH = ../..
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
EXTRA_JS_MODULES = \
subprocess.jsm \
......@@ -20,4 +14,7 @@ EXTRA_JS_MODULES = \