Skip to content

Commit

Permalink
Add basic files for building common-c
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed Feb 13, 2016
1 parent 695d7bd commit 212de9a
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
30 changes: 30 additions & 0 deletions 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),))
29 changes: 29 additions & 0 deletions 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)
18 changes: 18 additions & 0 deletions libchelper.c
@@ -0,0 +1,18 @@
#include <sys/timeb.h>
#include <sys/time.h>

// 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;
}
1 change: 1 addition & 0 deletions make.bat
@@ -0,0 +1 @@
@%NACL_SDK_ROOT%\tools\make.exe %*

0 comments on commit 212de9a

Please sign in to comment.