From 212de9a3a887a4b202102bbd3e2b0ae890e39cc6 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 12 Feb 2016 21:44:00 -0500 Subject: [PATCH] Add basic files for building common-c --- Makefile | 30 ++++++++++++++++++++++++++++++ common-c.mk | 29 +++++++++++++++++++++++++++++ libchelper.c | 18 ++++++++++++++++++ make.bat | 1 + 4 files changed, 78 insertions(+) create mode 100644 Makefile create mode 100644 common-c.mk create mode 100644 libchelper.c create mode 100644 make.bat diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..59d2436 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +VALID_TOOLCHAINS := newlib pnacl + +TARGET = moonlight-chrome + +include $(NACL_SDK_ROOT)/tools/common.mk + +# Include Moonlight-Common-C makefile +include common-c.mk + +LIBS = ppapi pthread + +CFLAGS = -Wall -Wno-missing-braces +SOURCES = \ + $(COMMON_C_SOURCE) \ + libchelper.c \ + +# Build rules generated by macros from common.mk: + +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS)))) + +# The PNaCl workflow uses both an unstripped and finalized/stripped binary. +# On NaCl, only produce a stripped binary for Release configs (not Debug). +ifneq (,$(or $(findstring pnacl,$(TOOLCHAIN)),$(findstring Release,$(CONFIG)))) +$(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS))) +$(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped)) +else +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) +endif + +$(eval $(call NMF_RULE,$(TARGET),)) diff --git a/common-c.mk b/common-c.mk new file mode 100644 index 0000000..38b0c54 --- /dev/null +++ b/common-c.mk @@ -0,0 +1,29 @@ +COMMON_C_DIR := moonlight-common-c/limelight-common +OPENAES_DIR := $(COMMON_C_DIR)/OpenAES + +OPENAES_SOURCE := \ + $(OPENAES_DIR)/oaes_base64.c \ + $(OPENAES_DIR)/oaes_lib.c \ + +OPENAES_INCLUDE := $(OPENAES_DIR) + +COMMON_C_SOURCE := \ + $(COMMON_C_DIR)/AudioStream.c \ + $(COMMON_C_DIR)/ByteBuffer.c \ + $(COMMON_C_DIR)/Connection.c \ + $(COMMON_C_DIR)/ControlStream.c \ + $(COMMON_C_DIR)/FakeCallbacks.c \ + $(COMMON_C_DIR)/InputStream.c \ + $(COMMON_C_DIR)/LinkedBlockingQueue.c \ + $(COMMON_C_DIR)/Misc.c \ + $(COMMON_C_DIR)/Platform.c \ + $(COMMON_C_DIR)/PlatformSockets.c \ + $(COMMON_C_DIR)/RtpReorderQueue.c \ + $(COMMON_C_DIR)/RtspConnection.c \ + $(COMMON_C_DIR)/RtspParser.c \ + $(COMMON_C_DIR)/SdpGenerator.c \ + $(COMMON_C_DIR)/VideoDepacketizer.c \ + $(COMMON_C_DIR)/VideoStream.c \ + $(OPENAES_SOURCE) \ + +COMMON_C_INCLUDE := $(COMMON_C_DIR) $(OPENAES_INCLUDE) \ No newline at end of file diff --git a/libchelper.c b/libchelper.c new file mode 100644 index 0000000..5981db0 --- /dev/null +++ b/libchelper.c @@ -0,0 +1,18 @@ +#include +#include + +// This function is defined but not implemented by newlib +int ftime(struct timeb *tp) { + struct timeval tv; + + if (gettimeofday(&tv, NULL) < 0) { + return -1; + } + + tp->time = tv.tv_sec; + tp->millitm = tv.tv_usec / 1000; + tp->timezone = 0; + tp->dstflag = 0; + + return 0; +} \ No newline at end of file diff --git a/make.bat b/make.bat new file mode 100644 index 0000000..dadca55 --- /dev/null +++ b/make.bat @@ -0,0 +1 @@ +@%NACL_SDK_ROOT%\tools\make.exe %*