Added NetWare changes

This commit is contained in:
Anantha Kesari H Y 2002-07-12 12:55:56 +00:00
parent 93f9acbffa
commit 2af885d467
2 changed files with 183 additions and 2 deletions

168
ext/mysql/mysql.mak Normal file
View File

@ -0,0 +1,168 @@
# Temporarily here -- later may go into some batch file
# which will set this as an environment variable
PROJECT_ROOT = ..\..
# Module details
MODULE_NAME = phpmysql
MODULE_DESC = "PHP MySQL Extension"
VMAJ = 0
VMIN = 60
VREV = 0
#include the common settings
include $(PROJECT_ROOT)/netware/common.mif
# MYSQL stuff
MYSQL_DIR = P:/APPS/script/sw/mysql
# Build type defaults to 'release'
ifndef BUILD
BUILD = release
endif
# Extensions of all input and output files
.SUFFIXES:
.SUFFIXES: .nlm .lib .obj .cpp .c .msg .mlc .mdb .xdc .d
# Source files
C_SRC = php_mysql.c \
start.c
CPP_SRC_NODIR = $(notdir $(CPP_SRC))
C_SRC_NODIR = $(notdir $(C_SRC))
SRC_DIR = $(dir $(CPP_SRC) $(C_SRC))
# Library files
LIBRARY = $(MYSQL_DIR)/lib/libmysqlclient.lib
# Destination directories and files
OBJ_DIR = $(BUILD)
FINAL_DIR = $(BUILD)
OBJECTS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.obj) $(C_SRC_NODIR:.c=.obj))
DEPDS = $(addprefix $(OBJ_DIR)/,$(CPP_SRC_NODIR:.c=.d) $(C_SRC_NODIR:.c=.d))
# Binary file
ifndef BINARY
BINARY=$(FINAL_DIR)\$(MODULE_NAME).nlm
endif
# Compile flags
C_FLAGS = -c -maxerrors 25 -msgstyle gcc -wchar_t on -bool on -processor Pentium -align 1
C_FLAGS += -nostdinc -nosyspath
C_FLAGS += -DNETWARE -DZTS -DNEW_LIBC -DUSE_OLD_FUNCTIONS -DCOMPILE_DL=1
C_FLAGS += -I. -I$(PROJECT_ROOT)/main -I$(PROJECT_ROOT)/ext/standard -I$(PROJECT_ROOT) -I$(PROJECT_ROOT)/netware
C_FLAGS += -I$(PROJECT_ROOT)/zend -I$(PROJECT_ROOT)/tsrm
C_FLAGS += -I- -I$(SDK_DIR)/include -I$(MWCIncludes)
C_FLAGS += -I$(MYSQL_DIR)/include -DCOMPILE_DL_MYSQL=1
C_FLAGS += -I$(WINSOCK_DIR)/include/nlm -I$(WINSOCK_DIR)/include
# Extra stuff based on debug / release builds
ifeq '$(BUILD)' 'debug'
SYM_FILE = $(FINAL_DIR)\$(MODULE_NAME).sym
C_FLAGS += -inline smart -sym on -sym codeview4 -opt off -opt intrinsics -DDEBUGGING -DDKFBPON
C_FLAGS += -exc cw -DZEND_DEBUG=1
LD_FLAGS += -sym on -sym codeview4 -osym $(SYM_FILE)
export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtld.lib
else
C_FLAGS += -opt speed -inline on -inline smart -inline auto -sym off -opt intrinsics
C_FLAGS += -opt level=4 -DZEND_DEBUG=0
LD_FLAGS += -sym off
export MWLibraryFiles=$(SDK_DIR)/imports/libcpre.o;mwcrtl.lib
endif
# Dependencies
MODULE = LibC \
phplib
IMPORT = @$(SDK_DIR)/imports/libc.imp \
@$(SDK_DIR)/imports/ws2nlm.imp \
@$(MPK_DIR)/import/mpkOrg.imp \
@$(PROJECT_ROOT)/netware/phplib.imp
#EXPORT = mysql_functions \
# mysql_module_entry \
# ($(MODULE_NAME).nlm) get_module
EXPORT = ($(MODULE_NAME)) get_module
API = OutputToScreen
# Virtual paths
vpath %.cpp .
vpath %.c . ..\..\netware
vpath %.obj $(OBJ_DIR)
all: prebuild project
.PHONY: all
prebuild:
@if not exist $(OBJ_DIR) md $(OBJ_DIR)
project: $(BINARY)
@echo Build complete.
$(OBJ_DIR)/%.d: %.cpp
@echo Building Dependencies for $(<F)
@$(CC) -M $< $(C_FLAGS) -o $@
$(OBJ_DIR)/%.d: %.c
@echo Building Dependencies for $(<F)
@$(CC) -M $< $(C_FLAGS) -o $@
$(OBJ_DIR)/%.obj: %.cpp
@echo Compiling $?...
@$(CC) $< $(C_FLAGS) -o $@
$(OBJ_DIR)/%.obj: %.c
@echo Compiling $?...
@$(CC) $< $(C_FLAGS) -o $@
$(BINARY): $(DEPDS) $(OBJECTS)
@echo Import $(IMPORT) > $(basename $@).def
ifdef API
@echo Import $(API) >> $(basename $@).def
endif
@echo Module $(MODULE) >> $(basename $@).def
ifdef EXPORT
@echo Export $(EXPORT) >> $(basename $@).def
endif
@echo AutoUnload >> $(basename $@).def
ifeq '$(BUILD)' 'debug'
@echo Debug >> $(basename $@).def
endif
@echo Flag_On 0x00000008 >> $(basename $@).def
@echo Start _NonAppStart >> $(basename $@).def
@echo Exit _NonAppStop >> $(basename $@).def
@echo Linking $@...
@echo $(LD_FLAGS) -commandfile $(basename $@).def > $(basename $@).link
@echo $(LIBRARY) $(OBJECTS) >> $(basename $@).link
@$(LINK) @$(basename $@).link
.PHONY: clean
clean: cleand cleanobj cleanbin
.PHONY: cleand
cleand:
@echo Deleting all dependency files...
-@del "$(OBJ_DIR)\*.d"
.PHONY: cleanobj
cleanobj:
@echo Deleting all object files...
-@del "$(OBJ_DIR)\*.obj"
.PHONY: cleanbin
cleanbin:
@echo Deleting binary files...
-@del "$(FINAL_DIR)\$(MODULE_NAME).nlm"
@echo Deleting MAP, DEF files, etc....
-@del "$(FINAL_DIR)\$(MODULE_NAME).map"
-@del "$(FINAL_DIR)\$(MODULE_NAME).def"
-@del "$(FINAL_DIR)\$(MODULE_NAME).link"
ifeq '$(BUILD)' 'debug'
-@del $(FINAL_DIR)\$(MODULE_NAME).sym
endif

View File

@ -39,6 +39,9 @@
#ifdef PHP_WIN32
#include <winsock.h>
#define signal(a, b) NULL
#elif defined(NETWARE)
#include <sys/socket.h>
#define signal(a, b) NULL
#else
#include "build-defs.h"
#if HAVE_SIGNAL_H
@ -304,7 +307,7 @@ static void _close_mysql_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
static PHP_INI_MH(OnMySQLPort)
{
if (new_value==NULL) { /* default port */
#ifndef PHP_WIN32
#if !defined (PHP_WIN32) && ! defined (NETWARE)
struct servent *serv_ptr;
char *env;
@ -439,7 +442,7 @@ PHP_MINFO_FUNCTION(mysql)
sprintf(buf, "%ld", MySG(num_links));
php_info_print_table_row(2, "Active Links", buf);
php_info_print_table_row(2, "Client API version", mysql_get_client_info());
#ifndef PHP_WIN32
#if !defined (PHP_WIN32) && !defined (NETWARE)
php_info_print_table_row(2, "MYSQL_MODULE_TYPE", PHP_MYSQL_TYPE);
php_info_print_table_row(2, "MYSQL_SOCKET", MYSQL_UNIX_ADDR);
php_info_print_table_row(2, "MYSQL_INCLUDE", PHP_MYSQL_INCLUDE);
@ -1114,11 +1117,16 @@ PHP_FUNCTION(mysql_create_db)
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
convert_to_string_ex(db);
#ifndef NETWARE
if (mysql_create_db(&mysql->conn, Z_STRVAL_PP(db))==0) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
#else
php_error(E_WARNING, "mysql_create_db is not supported on NetWare");
RETURN_FALSE;
#endif
}
/* }}} */
@ -1153,11 +1161,16 @@ PHP_FUNCTION(mysql_drop_db)
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink);
convert_to_string_ex(db);
#ifndef NETWARE
if (mysql_drop_db(&mysql->conn, Z_STRVAL_PP(db))==0) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
#else
php_error(E_WARNING, "mysql_drop_db is not supported on NetWare");
RETURN_FALSE;
#endif
}
/* }}} */
#endif