Project = xdebug
UserType = Developer
ToolType = Library
_OS_VERSION = $(shell sw_vers -productVersion | cut -d. -f1-2)
Extra_Environment = INSTALL_ROOT="$(DSTROOT)"
Extra_Configure_Flags = --enable-xdebug --with-php-config=$(SYMROOT)/php-config
Extra_Make_Flags =
GnuAfterInstall = install-macosx
Install_Prefix = $(USRDIR)/local
Install_Man = $(Install_Prefix)/share/man
Install_Info = $(Install_Prefix)/info
AEP = YES
AEP_Version = 2.2.3
AEP_Binaries = $(shell $(DSTROOT)$(USRBINDIR)/php-config --extension-dir)/$(Project).so
AEP_LicenseFile =
AEP_Patches =
.PHONY: post-extract-source $(GnuAfterInstall)
install::
include $(MAKEFILEPATH)/CoreOS/ReleaseControl/GNUSource.make
GnuAfterInstall += install-startup-files install-open-source-files
GnuAfterInstall += install-top-level-man-pages install-configuration-files
ifndef AEP_Project
AEP_Project = $(Project)
endif
ifndef AEP_ProjVers
ifdef AEP_Version
AEP_ProjVers = $(AEP_Project)-$(AEP_Version)
else
AEP_ProjVers = $(AEP_Project)
endif
endif
ifndef AEP_Filename
AEP_Filename = $(wildcard $(AEP_ProjVers).tar.gz $(AEP_ProjVers).tar.bz2)
endif
ifeq ($(suffix $(AEP_Filename)),.bz2)
AEP_ExtractOption = j
else
AEP_ExtractOption = z
endif
ifndef AEP_ExtractDir
AEP_ExtractDir = $(AEP_ProjVers)
endif
ifndef AEP_LicenseFile
AEP_LicenseFile = $(SRCROOT)/$(ProjectName).txt
endif
ifndef AEP_ManPages
AEP_ManPages := $(wildcard *.[1-9] man/*.[1-9])
endif
ifndef AEP_ConfigDir
AEP_ConfigDir = $(ETCDIR)
endif
ifndef AEP_Binaries
AEP_Binaries = $(subst ./,/,$(shell cd $(DSTROOT) && $(FIND) . -type f -perm +0111 -exec $(SHELL) -c 'test \"`file -b --mime-type {}`\" = \"application/octet-stream\"' \; -print))
endif
AEP_ExtractRoot = $(OBJROOT)
GNUConfigStamp := $(ConfigStamp)
Sources = $(AEP_ExtractRoot)/$(AEP_Project)
ifndef Make_Flags
ifdef Extra_Configure_Environment
Configure := $(Extra_Configure_Environment) $(Configure)
endif
endif
OSVDIR = $(USRDIR)/local/OpenSourceVersions
OSLDIR = $(USRDIR)/local/OpenSourceLicenses
LAUNCHDDIR = $(NSSYSTEMDIR)$(NSLIBRARYSUBDIR)/LaunchDaemons
SYSTEM_STARTUP_DIR = $(NSSYSTEMDIR)$(NSLIBRARYSUBDIR)/StartupItems
.PHONY: extract-source build-dependencies archive-strip-binaries
.PHONY: install-open-source-files install-startup-files
.PHONY: install-top-level-man-pages install-configuration-files
ifdef ConfigStamp
$(GNUConfigStamp): extract-source build-dependencies
else
build:: extract-source build-dependencies
endif
extract-source::
ifeq ($(AEP),YES)
@echo "Extracting source for $(Project)..."
$(MKDIR) $(AEP_ExtractRoot)
$(TAR) -C $(AEP_ExtractRoot) -$(AEP_ExtractOption)xf $(SRCROOT)/$(AEP_Filename)
$(RMDIR) $(Sources)
$(_v) $(RM) $(GNUConfigStamp)
$(MV) $(AEP_ExtractRoot)/$(AEP_ExtractDir) $(Sources)
ifdef AEP_Patches
for patchfile in $(AEP_Patches); do \
echo "Applying $$patchfile..."; \
cd $(Sources) && $(PATCH) -lp1 < $(SRCROOT)/patches/$$patchfile; \
done
endif
ifeq ($(AEP_BuildInSources),YES)
ifneq ($(Sources),$(BuildDirectory))
@echo "Copying sources to build directory..."
$(_v) $(CP) $(Sources) $(BuildDirectory)
endif
endif
else
@echo "Source extraction for $(Project) skipped!"
endif
build-dependencies:
ifdef Dependencies
$(_v) for Dependency in $(Dependencies); do \
$(MKDIR) $(SYMROOT)/$${Dependency}; \
$(MAKE) -C $${Dependency} $(TARGET) \
SRCROOT=$(SRCROOT)/$${Dependency} \
OBJROOT=$(OBJROOT) \
SYMROOT=$(SYMROOT)/$${Dependency} \
DSTROOT=$(DSTROOT) \
BuildDirectory=$(OBJROOT)/Build/$${Dependency} \
Sources=$(OBJROOT)/$${Dependency} \
CoreOSMakefiles=$(CoreOSMakefiles) \
$(Extra_Dependency_Flags); \
done
endif
archive-strip-binaries:: $(SYMROOT)
ifdef AEP_Binaries
@echo "Archiving and stripping binaries..."
$(_v) for file in $(addprefix $(DSTROOT),$(AEP_Binaries)); \
do \
_type=`file -b --mime-type $${file}`; \
if [ "$${_type}" = "application/octet-stream" ]; then \
echo "\tProcessing $${file}..."; \
$(CP) $${file} $(SYMROOT); \
$(DSYMUTIL) --out=$(SYMROOT)/$${file##*/}.dSYM $${file};\
$(STRIP) -S $${file}; \
else \
echo "\tSkipped non-binary $${file}; type is $${_type}";\
fi \
done
endif
install-startup-files::
ifdef AEP_LaunchdConfigs
@echo "Installing launchd configuration files..."
$(INSTALL_DIRECTORY) $(DSTROOT)$(LAUNCHDDIR)
$(INSTALL_FILE) $(AEP_LaunchdConfigs) $(DSTROOT)$(LAUNCHDDIR)
endif
ifdef AEP_StartupItem
@echo "Installing StartupItem..."
$(INSTALL_DIRECTORY) $(DSTROOT)$(SYSTEM_STARTUP_DIR)/$(AEP_StartupItem)
$(INSTALL_SCRIPT) $(StartupItem) $(DSTROOT)$(SYSTEM_STARTUP_DIR)/$(AEP_StartupItem)
$(INSTALL_FILE) StartupParameters.plist $(DSTROOT)$(SYSTEM_STARTUP_DIR)/$(AEP_StartupItem)
$(INSTALL_DIRECTORY) $(DSTROOT)$(SYSTEM_STARTUP_DIR)/$(AEP_StartupItem)/Resources/English.lproj
$(INSTALL_FILE) Localizable.strings $(DSTROOT)$(SYSTEM_STARTUP_DIR)/$(AEP_StartupItem)/Resources/English.lproj
endif
install-open-source-files::
@echo "Installing Apple-internal open-source documentation..."
if [ -e $(SRCROOT)/$(ProjectName).plist ]; then \
$(MKDIR) $(DSTROOT)/$(OSVDIR); \
$(INSTALL_FILE) $(SRCROOT)/$(ProjectName).plist $(DSTROOT)/$(OSVDIR)/$(ProjectName).plist; \
else \
echo "WARNING: No open-source file for this project!"; \
fi
if [ -e $(AEP_LicenseFile) ]; then \
$(MKDIR) $(DSTROOT)/$(OSLDIR); \
$(INSTALL_FILE) $(AEP_LicenseFile) $(DSTROOT)/$(OSLDIR)/$(ProjectName).txt; \
else \
echo "WARNING: No open-source file for this project!"; \
fi
install-top-level-man-pages::
ifdef AEP_ManPages
@echo "Installing top-level man pages..."
for _page in $(AEP_ManPages); do \
_section_dir=$(Install_Man)/man$${_page##*\.}; \
$(INSTALL_DIRECTORY) $(DSTROOT)$${_section_dir}; \
$(INSTALL_FILE) $${_page} $(DSTROOT)$${_section_dir}; \
done
endif
install-configuration-files::
ifdef AEP_ConfigFiles
@echo "Installing configuration files..."
$(INSTALL_DIRECTORY) $(DSTROOT)$(AEP_ConfigDir)
for file in $(AEP_ConfigFiles); \
do \
$(INSTALL_FILE) $${file} $(DSTROOT)$(AEP_ConfigDir); \
$(CHMOD) u+w $(DSTROOT)$(AEP_ConfigDir)/$${file}; \
if [ "${file##*.}" != "default" ]; then \
$(INSTALL_FILE) $${file} $(DSTROOT)$(AEP_ConfigDir)/$${file}.default; \
fi; \
done
endif
clean::
$(_v) if [ -d $(Sources) ]; then \
cd $(Sources) && make clean; \
fi
$(DSTROOT) $(DSTROOT)$(AEP_ConfigDir) $(SYMROOT) $(TMPDIR):
$(MKDIR) $@
DESTDIR = $(DSTROOT)
Install_Flags = DESTDIR="$(DSTROOT)" INSTALL_ROOT="$(DSTROOT)"
Install_Target = install
$(GNUConfigStamp): post-extract-source
post-extract-source: extract-source
@echo "Overlaying phpized build files..."
cd $(Sources)/.. && tar xzf $(SRCROOT)/xdebug-phpized.tar.gz
install-macosx:
@echo "Archiving binaries..."
$(_v) for file in $(addprefix $(DSTROOT),$(AEP_Binaries)); \
do \
$(CP) $${file} $(SYMROOT); \
$(DSYMUTIL) --out=$(SYMROOT)/$${file##*/}.dSYM $${file};\
done