Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
flaupretre committed Jan 14, 2015
2 parents 5842eab + 11d4720 commit 756f5cf
Show file tree
Hide file tree
Showing 53 changed files with 2,038 additions and 1,215 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.phk
examples/auto.map
*.map
automap.psf
test/php.log
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "submodules/phool"]
path = submodules/phool
url = git@github.com:flaupretre/phool.git
18 changes: 0 additions & 18 deletions Automap_api.psf

This file was deleted.

62 changes: 52 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,65 @@
#
#==============================================================================

PRODUCT=Automap

TARGETS = $(PRODUCT).phk
BUILD_DIR = build
EXTRA_CLEAN = $(PRODUCT).psf $(PRODUCT)

SOURCE_DIR = src

SUBDIRS = test

NO_FILTER = true
FILTER_SOURCE=$(SOURCE_DIR)
#-----------------------------

include ./make.vars
include ./make.common

.PHONY: check mem_check
#-----------------------------

.PHONY: all clean_doc clean_distrib clean doc distrib test mem_test clean_test \
examples clean_examples

all: base doc examples

check mem_check: all
clean: clean_base clean_doc clean_distrib clean_test clean_examples

#--- How to build the package

$(PRODUCT).phk: $(PRODUCT).psf
$(PHK_BUILD) $@

#--- Tests

test mem_test: base
$(MAKE) -C test $@

clean_test:
$(MAKE) -C test clean

#--- Examples

examples: base
$(MAKE) -C examples

clean_examples:
$(MAKE) -C examples clean

#--- Documentation

doc: base
$(MAKE) -C doc

clean_doc:
$(MAKE) -C doc clean

#--- How to build distrib
# As we copy the whole examples and test subdirs into the distrib, we must
# clean them first.

distrib: $(DISTRIB)

$(DISTRIB): base doc clean_test clean_examples
BASE=$(PWD) TMP_DIR=$(TMP_DIR) PRODUCT=$(PRODUCT) \
SOFTWARE_VERSION=$(SOFTWARE_VERSION) \
SOFTWARE_RELEASE=$(SOFTWARE_RELEASE) $(MK_DISTRIB)

clean_distrib:
/bin/rm -f $(DISTRIB)

#-----------------------------------------------------------------------------
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@

Map-based autoloaders resolve symbols using **map files**. These files
are created offline by a program (included) which scans PHP script files
and extracts their symbols.
and extracts their symbols into a map file.

At runtime, map files are loaded by the main script and then used
to resolve undefined symbols and load the corresponding PHP script
files.

As a complement to the base Automap software, the optional
[Automap PECL extension](http://pecl.php.net/package/automap)
acts as an accelerator, making Automap the fastest PHP autoloader
available so far.

More information in the [wiki](https://github.com/flaupretre/automap/wiki).
More information on [the project website](http://automap.tekwire.net) or in the [wiki](https://github.com/flaupretre/automap/wiki).
16 changes: 12 additions & 4 deletions Automap.psf → automap.psf.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@

merge / $(PSF_DIR)/src
add -C src .

%options ---------------------------------------------------------------------
# Submodules

# Phool

add -t submodules/phool -C submodules/phool/src/classes .

#---------------------------------------------------------------------
%options

name : Automap
summary : Automap Runtime and Creator tool
version : '2.1'
release : 0
version : '@SOFTWARE_VERSION@'
release : '@SOFTWARE_RELEASE@'
crc_check : true
license : Apache License Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>
copyright : (c) F. Laupretre
Expand All @@ -15,3 +22,4 @@ url : http://automap.tekwire.net
packager : F. Laupretre <mailto:phk@tekwire.net>
cli_run_script : /scripts/main.php
license_prefix : /etc/license
plain_prolog : true
9 changes: 9 additions & 0 deletions build/distrib_list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# The list of files/dir to include in the distrib

automap.phk
examples
test
README.md
doc/api.phk
doc/api.pdf
doc/xref.phk
4 changes: 4 additions & 0 deletions build/expand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

sed \
-e "s/@SOFTWARE_VERSION@/$SOFTWARE_VERSION/g" \
-e "s/@SOFTWARE_RELEASE@/$SOFTWARE_RELEASE/g"
44 changes: 44 additions & 0 deletions build/mk_distrib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh
# Must be run via 'make distrib'

error_exit()
{
echo "**ERROR** $*"
exit 1
}

#-------------------- Main -----------------

SUBDIR=${PRODUCT}-${SOFTWARE_VERSION}-${SOFTWARE_RELEASE}

#---------

[ -z "$TMP_DIR" ] && error_exit "TMP_DIR not set. This script must not be run directly. Instead, run 'make distrib' in the base directory"

/bin/rm -rf $TMP_DIR
mkdir -p $TMP_DIR || error_exit "Cannot create tmp dir at $TMP_DIR"
cd $TMP_DIR || error_exit "Cannot cd to $TMP_DIR"

mkdir $SUBDIR
cd $SUBDIR

flist=`cat $BASE/build/distrib_list.txt | grep -v '^#'`
for i in $flist
do
( cd $BASE ; tar cf - $i ) | tar xvpf -
done

#----------------------------
# Build tgz file

cd ..
tar cf - ./$SUBDIR | gzip --best >$BASE/$SUBDIR.tgz
echo "Created file $SUBDIR.tgz"

#-----
# Cleanup

cd $BASE
/bin/rm -rf $TMP_DIR

#=========================================================================
39 changes: 39 additions & 0 deletions build/xref.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Set default directory to phpxref install directory and, then, launch phpxref.
# If phpxref is called from another directory, the result does not include
# the style sheets (phpxref bug).
# This wrapper script allows not to set the output path in the configuration file.
#
# Variables :
# INPUT = Directory containing the source files (relative to the directory
# containing the script)
# OUTPUT = Output dir
# PHPXREF_DIR = phpxref install dir
#
# $1 = Config file

if [ -z "$PHPXREF_DIR" ] ; then
echo "PHPXREF_DIR is not defined"
exit 1
fi

TMP=/tmp/.t$$
/bin/rm -rf $TMP

save_wd=`pwd`
cd $INPUT
SOURCE=`pwd`
cd $save_wd

(
echo "SOURCE=$SOURCE"
echo "OUTPUT=$OUTPUT"
grep -v '^SOURCE=' <$1 | grep -v 'OUTPUT='
) >$TMP

cd $PHPXREF_DIR
perl phpxref.pl -c $TMP

/bin/rm -f $TMP

exit 0
57 changes: 57 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

SOURCE_DIR = ../src
BUILD_DIR = ../build

CLASSES_DIR = ../src/classes
PUBLIC_API_CLASSES = Automap Automap_Creator Automap_Tools

TARGETS = api.phk api.pdf xref.phk
EXTRA_CLEAN = api.psf xref.psf

#------

include ../make.vars
include ../make.common

#------

.PHONY: clean

all: base

clean: clean_base

#------ API Documentation
#-- Restrict API documentation to the public API

api.phk: api.psf
/bin/rm -rf $(TMP_DIR)
mkdir -p $(TMP_DIR)/result $(TMP_DIR)/source
for i in $(PUBLIC_API_CLASSES) ; do cp $(CLASSES_DIR)/$$i.php \
$(TMP_DIR)/source ; done
$(PHPDOC) -o HTML:frames:DOM/earthli -ti "$(PRODUCT) API" \
-d $(TMP_DIR)/source -t $(TMP_DIR)/result
$(PHK_BUILD) $@ -d SOURCE=$(TMP_DIR)/result
/bin/rm -rf $(TMP_DIR)

#-- PDF

api.pdf: api.psf
/bin/rm -rf $(TMP_DIR)
mkdir -p $(TMP_DIR)/result $(TMP_DIR)/source
for i in $(PUBLIC_API_CLASSES) ; do cp $(CLASSES_DIR)/$$i.php \
$(TMP_DIR)/source ; done
$(PHPDOC) -o PDF:default:default -ti "$(PRODUCT) API" \
-d $(TMP_DIR)/source -t $(TMP_DIR)/result
mv $(TMP_DIR)/result/documentation.pdf $@
/bin/rm -rf $(TMP_DIR)

#-- Cross Reference

xref.phk: xref.psf
/bin/rm -rf $(TMP_DIR)
mkdir $(TMP_DIR)
PHPXREF_DIR="$(PHPXREF_DIR)" INPUT="$(SOURCE_DIR)" OUTPUT="$(TMP_DIR)" \
$(XREF) xref.cfg
$(PHK_BUILD) $@ -d SOURCE=$(TMP_DIR)
/bin/rm -rf $(TMP_DIR)
24 changes: 24 additions & 0 deletions doc/api.psf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

#-- Documentation files

add --strip --compress gzip --directory $(SOURCE) .

#-- The license files

add -C ../src etc/license.htm etc/license.txt

#-- The options
%options

name : Automap API reference
version : '@SOFTWARE_VERSION@'
release : '@SOFTWARE_RELEASE@'
license : Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>
copyright : (c) F. Laupretre
author : F. Laupretre <mailto:automap@tekwire.net>
url : http://automap.tekwire.net
packager : F. Laupretre <mailto:automap@tekwire.net>
web_run_script : /index.html
license_prefix : /etc/license
web_access : / #-- Open access
web_main_redirect : true
File renamed without changes.
13 changes: 6 additions & 7 deletions Automap_xref.psf → doc/xref.psf.in
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@

#-- Documentation files

merge -compress=gzip / $(TMP_DIR)
add --compress gzip --directory $(SOURCE) .

#-- The icons
#-- The license files

add /etc/& $(PSF_DIR)/src/etc/license.htm
add /etc/& $(PSF_DIR)/src/etc/license.txt
add -C ../src etc/license.htm etc/license.txt

#-- The options
%options

name : Automap Cross reference
version : '2.1'
release : 0
version : '@SOFTWARE_VERSION@'
release : '@SOFTWARE_RELEASE@'
copyright : (c) F. Laupretre
author : F. Laupretre <mailto:francois@tekwire.net>
url : http://automap.tekwire.net
packager : F. Laupretre <mailto:francois@tekwire.net>
web_run_script : /index.html
license_prefix : /etc/license
web_access : / #-- Open access
web_main_redirect : true
license_prefix : /etc/license

#----------------
20 changes: 20 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
#==============================================================================

SUBDIRS = handlers hello namespaces

include ../make.vars
include ../make.common

#-----------------------------

.PHONY: all examples clean

all: examples

clean: clean_base

examples:
for i in $(SUBDIRS) ; do $(MAKE) -C $$i ; done

#-----------------------------------------------------------------------------
Loading

0 comments on commit 756f5cf

Please sign in to comment.