Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

Commit

Permalink
fixed this hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Farrell committed Aug 11, 2014
1 parent 846e1bc commit e0e97d8
Show file tree
Hide file tree
Showing 9 changed files with 2,199 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,3 +8,4 @@ src/*.swp
src/RS3.so
src/RcppExports.o
src/s3.o
src/build/
6 changes: 4 additions & 2 deletions README.md
Expand Up @@ -5,6 +5,8 @@ RS3 is a interface to S3 using libs3. Using RS3 you can do many tasks including
* set-acl on bucket
* get/set-logging on bucket

It currently does not work with Windows. It is a work in progress.
In order to use RS3 you must make sure the libs3 library is installed. The library is located [here](https://aws.amazon.com/developertools/1648).
Installing on Linux

Make sure that libxml2-dev and libcurl3-dev is installed

In R, install devtools and run install_github.com("RS3", "Gastrograph")
10 changes: 9 additions & 1 deletion src/Makevars
@@ -1,2 +1,10 @@
PKG_CXXFLAGS= -I../inst/include
PKG_LIBS= $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) -Llibs3/build/lib -ls3
PKG_LIBS= $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) -Lbuild/lib -ls3

.PHONY: all
all: $(SHLIB)

$(SHLIB): libs3.so

libs3.so:
(cd libs3; make DESTDIR=../build install)
290 changes: 290 additions & 0 deletions src/libs3-win/Makefile
@@ -0,0 +1,290 @@
# GNUmakefile.mingw
#
# Copyright 2008 Bryan Ischo <bryan@ischo.com>
#
# This file is part of libs3.
#
# libs3 is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, version 3 of the License.
#
# In addition, as a special exception, the copyright holders give
# permission to link the code of this library and its programs with the
# OpenSSL library, and distribute linked combinations including the two.
#
# libs3 is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License version 3
# along with libs3, in a file named COPYING. If not, see
# <http://www.gnu.org/licenses/>.

# I tried to use the autoconf/automake/autolocal/etc (i.e. autohell) tools
# but I just couldn't stomach them. Since this is a Makefile for POSIX
# systems, I will simply do away with autohell completely and use a GNU
# Makefile. GNU make ought to be available pretty much everywhere, so I
# don't see this being a significant issue for portability.

# All commands assume a GNU compiler. For systems which do not use a GNU
# compiler, write scripts with the same names as these commands, and taking
# the same arguments, and translate the arguments and commands into the
# appropriate non-POSIX ones as needed. libs3 assumes a GNU toolchain as
# the most portable way to build software possible. Non-POSIX, non-GNU
# systems can do the work of supporting this build infrastructure.


# --------------------------------------------------------------------------
# Set libs3 version number, unless it is already set.

LIBS3_VER_MAJOR ?= 2
LIBS3_VER_MINOR ?= 0
LIBS3_VER := $(LIBS3_VER_MAJOR).$(LIBS3_VER_MINOR)


# -----------------------------------------------------------------------------
# Determine verbosity. VERBOSE_SHOW should be prepended to every command which
# should only be displayed if VERBOSE is set. QUIET_ECHO may be used to
# echo text only if VERBOSE is not set. Typically, a VERBOSE_SHOW command will
# be paired with a QUIET_ECHO command, to provide a command which is displayed
# in VERBOSE mode, along with text which is displayed in non-VERBOSE mode to
# describe the command.
#
# No matter what VERBOSE is defined to, it ends up as true if it's defined.
# This will be weird if you defined VERBOSE=false in the environment, and we
# switch it to true here; but the meaning of VERBOSE is, "if it's defined to
# any value, then verbosity is turned on". So don't define VERBOSE if you
# don't want verbosity in the build process.
# -----------------------------------------------------------------------------

ifdef VERBOSE
VERBOSE = true
VERBOSE_ECHO = @ echo
VERBOSE_SHOW =
QUIET_ECHO = @ echo >nul
else
VERBOSE = false
VERBOSE_ECHO = @ echo >nul
VERBOSE_SHOW = @
QUIET_ECHO = @ echo
endif


# --------------------------------------------------------------------------
# BUILD directory
ifndef BUILD
ifdef DEBUG
BUILD := build-debug
else
BUILD := build
endif
endif


# --------------------------------------------------------------------------
# DESTDIR directory
ifndef DESTDIR
DESTDIR := libs3-$(LIBS3_VER)
endif


# --------------------------------------------------------------------------
# Acquire configuration information for libraries that libs3 depends upon

ifndef CURL_LIBS
CURL_LIBS := -Lc:\libs3-libs\bin -lcurl
endif

ifndef CURL_CFLAGS
CURL_CFLAGS := -Ic:\libs3-libs\include
endif

ifndef LIBXML2_LIBS
LIBXML2_LIBS := -Lc:\libs3-libs\bin -lxml2
endif

ifndef LIBXML2_CFLAGS
LIBXML2_CFLAGS := -Ic:\libs3-libs\include
endif


# --------------------------------------------------------------------------
# These CFLAGS assume a GNU compiler. For other compilers, write a script
# which converts these arguments into their equivalent for that particular
# compiler.

ifndef CFLAGS
ifdef DEBUG
CFLAGS := -g
else
CFLAGS := -O3
endif
endif

CFLAGS += -Wall -Werror -Wshadow -Wextra -Iinc \
$(CURL_CFLAGS) $(LIBXML2_CFLAGS) \
-DLIBS3_VER_MAJOR=\"$(LIBS3_VER_MAJOR)\" \
-DLIBS3_VER_MINOR=\"$(LIBS3_VER_MINOR)\" \
-DLIBS3_VER=\"$(LIBS3_VER)\" \
-D__STRICT_ANSI__ \
-D_ISOC99_SOURCE \
-D_POSIX_C_SOURCE=200112L \
-Dsleep=Sleep -DSLEEP_UNITS_PER_SECOND=1000 \
-DFOPEN_EXTRA_FLAGS=\"b\" \
-Iinc/mingw -include windows.h

LDFLAGS = $(CURL_LIBS) $(LIBXML2_LIBS)

# --------------------------------------------------------------------------
# Default targets are everything

.PHONY: all
all: exported test


# --------------------------------------------------------------------------
# Exported targets are the library and driver program

.PHONY: exported
exported: libs3 headers


# --------------------------------------------------------------------------
# Install target

.PHONY: install
install: exported
$(QUIET_ECHO) $(DESTDIR)/bin/libs3/dll: Installing dynamic library
$(VERBOSE_SHOW) copy $(BUILD)\bin\libs3.dll $(DESTDIR)\bin\libs3.dll >nul
$(QUIET_ECHO) $(DESTDIR)/lib/libs3.a: Installing static library
- @ mkdir $(DESTDIR)\lib 2>&1 | echo >nul
$(VERBOSE_SHOW) copy $(BUILD)\lib\libs3.a $(DESTDIR)\lib\libs3.a >nul
$(QUIET_ECHO) $(DESTDIR)/lib/libs3.def: Installing def file
$(VERBOSE_SHOW) copy mswin\libs3.def $(DESTDIR)\lib\libs3.def >nul
- @ mkdir $(DESTDIR)\include 2>&1 | echo >nul
$(QUIET_ECHO) $(DESTDIR)/include/libs3.h: Copying header
$(VERBOSE_SHOW) copy $(BUILD)\include\libs3.h \
$(DESTDIR)\include\libs3.h >nul
$(QUIET_ECHO) $(DESTDIR)/LICENSE: Copying license
$(VERBOSE_SHOW) copy LICENSE $(DESTDIR)\LICENSE >nul
$(QUIET_ECHO) $(DESTDIR)/COPYING: Copying license
$(VERBOSE_SHOW) copy COPYING $(DESTDIR)\COPYING >nul


# --------------------------------------------------------------------------
# Uninstall target

.PHONY: uninstall
uninstall:
$(QUIET_ECHO) Installed files: Uninstalling
$(VERBOSE_SHOW) \
del $(DESTDIR)\bin\s3.exe \
$(DESTDIR)\bin\libs3.dll \
$(DESTDIR)\lib\libs3.a \
$(DESTDIR)\lib\libs3.def \
$(DESTDIR)\include\libs3.h \
$(DESTDIR)\LICENSE \
$(DESTDIR)\COPYING


# --------------------------------------------------------------------------
# Compile target patterns

$(BUILD)/obj/%.o: src/%.c
$(QUIET_ECHO) $@: Compiling object
- @ mkdir $(subst /,\,$(dir $(BUILD)/dep/$<)) 2>&1 | echo >nul
@ gcc $(CFLAGS) -M -MG -MQ $@ -DCOMPILINGDEPENDENCIES \
-o $(BUILD)/dep/$(<:%.c=%.d) -c $<
- @ mkdir $(subst /,\,$(dir $@)) 2>&1 | echo >nul
$(VERBOSE_SHOW) gcc $(CFLAGS) -o $@ -c $<


# --------------------------------------------------------------------------
# libs3 library targets

LIBS3_SHARED = $(BUILD)/bin/libs3.dll
LIBS3_STATIC = $(BUILD)/lib/libs3.a

.PHONY: libs3
libs3: $(LIBS3_SHARED) $(BUILD)/lib/libs3.a

LIBS3_SOURCES := src/acl.c src/bucket.c src/error_parser.c src/general.c \
src/object.c src/request.c src/request_context.c \
src/response_headers_handler.c src/service_access_logging.c \
src/service.c src/simplexml.c src/util.c src/mingw_functions.c

$(LIBS3_SHARED): $(LIBS3_SOURCES:src/%.c=$(BUILD)/obj/%.o)
$(QUIET_ECHO) $@: Building dynamic library
- @ mkdir $(subst /,\,$(dir $@)) 2>&1 | echo >nul
$(VERBOSE_SHOW) gcc -shared -o $@ $^ $(LDFLAGS) -lws2_32

$(LIBS3_STATIC): $(LIBS3_SHARED)
$(QUIET_ECHO) $@: Building static library
- @ mkdir $(subst /,\,$(dir $@)) 2>&1 | echo >nul
$(VERBOSE_SHOW) dlltool --def mswin\libs3.def --dllname $(subst /,\,$<) \
--output-lib $(subst /,\,$@)


# --------------------------------------------------------------------------
# Driver program targets

.PHONY: s3
s3: $(BUILD)/bin/s3.exe

$(BUILD)/bin/s3.exe: $(BUILD)/obj/s3.o $(BUILD)/obj/mingw_s3_functions.o \
$(BUILD)/lib/libs3.a
$(QUIET_ECHO) $@: Building executable
- @ mkdir $(subst /,\,$(dir $@)) 2>&1 | echo >nul
$(VERBOSE_SHOW) gcc -o $@ $^ $(LDFLAGS) -lws2_32


# --------------------------------------------------------------------------
# libs3 header targets

.PHONY: headers
headers: $(BUILD)\include\libs3.h

$(BUILD)\include\libs3.h: inc\libs3.h
$(QUIET_ECHO) $@: Copying header
- @ mkdir $(subst /,\,$(dir $@)) 2>&1 | echo >nul
$(VERBOSE_SHOW) copy $< $@


# --------------------------------------------------------------------------
# Test targets

.PHONY: test
test: $(BUILD)/bin/testsimplexml

$(BUILD)/bin/testsimplexml: $(BUILD)/obj/testsimplexml.o \
$(BUILD)/obj/simplexml.o
$(QUIET_ECHO) $@: Building executable
- @ mkdir $(subst /,\,$(dir $@)) 2>&1 | echo >nul
$(VERBOSE_SHOW) gcc -o $@ $^ $(LIBXML2_LIBS)


# --------------------------------------------------------------------------
# Clean target

.PHONY: clean
clean:
$(QUIET_ECHO) $(BUILD): Cleaning
$(VERBOSE_SHOW) mswin\rmrf.bat $(BUILD)


# --------------------------------------------------------------------------
# Clean dependencies target

.PHONY: cleandeps
cleandeps:
$(QUIET_ECHO) $(BUILD)/dep: Cleaning dependencies
$(VERBOSE_SHOW) mswin\rmrf.bat $(BUILD)\dep


# --------------------------------------------------------------------------
# Dependencies

ALL_SOURCES := $(LIBS3_SOURCES) s3.c testsimplexml.c

$(foreach i, $(ALL_SOURCES), $(eval -include $(BUILD)/dep/src/$(i:%.c=%.d)))
18 changes: 2 additions & 16 deletions src/libs3/GNUmakefile
Expand Up @@ -148,17 +148,14 @@ all: exported test
# Exported targets are the library and driver program

.PHONY: exported
exported: libs3 s3 headers
exported: libs3 headers


# --------------------------------------------------------------------------
# Install target

.PHONY: install
install: exported
$(QUIET_ECHO) $(DESTDIR)/bin/s3: Installing executable
$(VERBOSE_SHOW) install -Dps -m u+rwx,go+rx $(BUILD)/bin/s3 \
$(DESTDIR)/bin/s3
$(QUIET_ECHO) \
$(DESTDIR)/lib/libs3.so.$(LIBS3_VER): Installing shared library
$(VERBOSE_SHOW) install -Dps -m u+rw,go+r \
Expand All @@ -185,7 +182,6 @@ install: exported
uninstall:
$(QUIET_ECHO) Installed files: Uninstalling
$(VERBOSE_SHOW) \
rm -f $(DESTDIR)/bin/s3 \
$(DESTDIR)/include/libs3.h \
$(DESTDIR)/lib/libs3.a \
$(DESTDIR)/lib/libs3.so \
Expand Down Expand Up @@ -239,16 +235,6 @@ $(LIBS3_STATIC): $(LIBS3_SOURCES:%.c=$(BUILD)/obj/%.o)
$(VERBOSE_SHOW) $(AR) cr $@ $^


# --------------------------------------------------------------------------
# Driver program targets

.PHONY: s3
s3: $(BUILD)/bin/s3

$(BUILD)/bin/s3: $(BUILD)/obj/s3.o $(LIBS3_SHARED)
$(QUIET_ECHO) $@: Building executable
@ mkdir -p $(dir $@)
$(VERBOSE_SHOW) gcc -o $@ $^ $(LDFLAGS)


# --------------------------------------------------------------------------
Expand Down Expand Up @@ -296,7 +282,7 @@ cleandeps:
# --------------------------------------------------------------------------
# Dependencies

ALL_SOURCES := $(LIBS3_SOURCES) s3.c testsimplexml.c
ALL_SOURCES := $(LIBS3_SOURCES) testsimplexml.c

$(foreach i, $(ALL_SOURCES), $(eval -include $(BUILD)/dep/src/$(i:%.c=%.d)))
$(foreach i, $(ALL_SOURCES), $(eval -include $(BUILD)/dep/src/$(i:%.c=%.dd)))
Expand Down

0 comments on commit e0e97d8

Please sign in to comment.