Apply autotools on build system 60/143760/19
authorHoyub Lee <hoyub.lee@samsung.com>
Fri, 11 Aug 2017 07:10:02 +0000 (16:10 +0900)
committerHoyub Lee <hoyub.lee@samsung.com>
Tue, 22 Aug 2017 05:35:03 +0000 (14:35 +0900)
Applying autotools on build system provides following benefits:

  - Many open source projects are using autotools, so with autotools
    applied, open source developers can easily understand our project's
    build system.

  - Autotools provides many powerful features like powerful
    cross-compilation, diverse and useful command options for build,
    configure many parts automatically, and so on.

  - Human errors on writing Makefile can be reduced.

Change-Id: I62a6129fa4a9a0fb6ab48509ef163ea7fc0369b9
Signed-off-by: Hoyub Lee <hoyub.lee@samsung.com>
Signed-off-by: SooChan Lim <sc1.lim@samsung.com>
Makefile [deleted file]
Makefile.am [new file with mode: 0644]
configure.ac [new file with mode: 0644]
packaging/libtpl-egl.spec
pkgconfig/CMakeLists.txt [deleted file]
pkgconfig/Makefile.am [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/tpl_internal.h
src/wayland-egl/Makefile [deleted file]
src/wayland-egl/Makefile.am [new file with mode: 0644]
src/wayland-vulkan/Makefile [deleted file]

diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 422bd67..0000000
--- a/Makefile
+++ /dev/null
@@ -1,136 +0,0 @@
-#$(call is-feature-enabled,featurename)
-#returns non-empty string if enabled, empty if not
-define is-feature-enabled
-$(findstring -$1-,-$(TPL_OPTIONS)-)
-endef
-
-SRC_DIR = ./src
-SO_NAME = libtpl-egl.so.$(TPL_VERSION_MAJOR)
-BIN_NAME = $(SO_NAME).$(TPL_VERSION_MINOR).$(TPL_VERSION_PATCH)
-INST_DIR = $(libdir)
-
-CC ?= gcc
-
-CFLAGS += -Wall -fPIC -I$(SRC_DIR)
-LDFLAGS +=
-
-CFLAGS += `pkg-config --cflags libtbm dlog`
-LDFLAGS += `pkg-config --libs libtbm dlog`
-
-ifneq ($(call is-feature-enabled,winsys_dri2),)
-       CFLAGS += -DTPL_WINSYS_DRI2
-       LDFLAGS += `pkg-config --libs libdrm libdri2 xext xfixes x11 x11-xcb xcb xcb-dri3 xcb-sync xcb-present xshmfence`
-endif
-ifneq ($(call is-feature-enabled,winsys_dri3),)
-       CFLAGS += -DTPL_WINSYS_DRI3
-       LDFLAGS += `pkg-config --libs libdrm libdri2 xext xfixes x11 x11-xcb xcb xcb-dri3 xcb-sync xcb-present xshmfence`
-endif
-
-ifneq ($(call is-feature-enabled,winsys_wl),)
-       CFLAGS += -DTPL_WINSYS_WL=1
-       CFLAGS += `pkg-config --cflags gbm libtdm-client glib-2.0`
-       LDFLAGS += `pkg-config --libs gbm wayland-tbm-client wayland-tbm-server libtdm-client glib-2.0`
-endif
-
-ifneq ($(call is-feature-enabled,winsys_tbm),)
-       CFLAGS += -DTPL_WINSYS_TBM=1
-endif
-
-ifneq ($(call is-feature-enabled,ttrace),)
-       CFLAGS += -DTTRACE_ENABLE=1
-       CFLAGS += `pkg-config --cflags ttrace`
-       LDFLAGS += `pkg-config --libs ttrace`
-endif
-ifneq ($(call is-feature-enabled,dlog),)
-       CFLAGS += -DDLOG_DEFAULT_ENABLE
-endif
-ifneq ($(call is-feature-enabled,default_log),)
-       CFLAGS += -DLOG_DEFAULT_ENABLE
-endif
-ifneq ($(call is-feature-enabled,default_dump),)
-       CFLAGS += -DDEFAULT_DUMP_ENABLE
-endif
-ifneq ($(call is-feature-enabled,object_hash_check),)
-       CFLAGS += -DOBJECT_HASH_CHECK
-endif
-
-ifneq ($(call is-feature-enabled,arm_atomic_operation),)
-       CFLAGS += -DARM_ATOMIC_OPERATION
-endif
-
-ifneq ($(call is-feature-enabled,wl_thread),)
-       CFLAGS += -DWL_THREAD_DEFAULT_ENABLE=1
-endif
-
-WAYLAND_EGL_OBJ_PATH = ../src/wayland-egl/wayland-egl.o
-
-TPL_HEADERS += $(SRC_DIR)/tpl.h
-TPL_HEADERS += $(SRC_DIR)/tpl_internal.h
-TPL_HEADERS += $(SRC_DIR)/tpl_utils.h
-
-TPL_SRCS += $(SRC_DIR)/tpl.c
-TPL_SRCS += $(SRC_DIR)/tpl_display.c
-TPL_SRCS += $(SRC_DIR)/tpl_object.c
-TPL_SRCS += $(SRC_DIR)/tpl_surface.c
-TPL_SRCS += $(SRC_DIR)/tpl_utils_hlist.c
-TPL_SRCS += $(SRC_DIR)/tpl_utils_map.c
-
-ifneq ($(call is-feature-enabled,winsys_wl),)
-TPL_HEADERS += $(SRC_DIR)/tpl_worker_thread.h
-TPL_HEADERS += $(SRC_DIR)/tpl_wayland_egl_thread.h
-TPL_SRCS += $(SRC_DIR)/tpl_wayland_egl.c
-TPL_SRCS += $(SRC_DIR)/tpl_wl_egl_thread.c
-TPL_SRCS += $(SRC_DIR)/tpl_wayland_egl_thread.c
-TPL_SRCS += $(SRC_DIR)/tpl_wayland_vk_wsi.c
-TPL_SRCS += $(SRC_DIR)/tpl_gbm.c
-TPL_SRCS += $(SRC_DIR)/protocol/tizen-surface-protocol.c
-TPL_SRCS += $(SRC_DIR)/tpl_worker_thread.c
-TPL_SRCS += $(SRC_DIR)/wayland-vulkan/wayland-vulkan-protocol.c
-endif
-
-ifneq ($(call is-feature-enabled,winsys_dri2),)
-TPL_HEADERS += $(SRC_DIR)/tpl_x11_internal.h
-
-TPL_SRCS += $(SRC_DIR)/tpl_x11_common.c
-TPL_SRCS += $(SRC_DIR)/tpl_x11_dri2.c
-endif
-
-ifneq ($(call is-feature-enabled,winsys_dri3),)
-TPL_HEADERS += $(SRC_DIR)/tpl_x11_internal.h
-
-TPL_SRCS += $(SRC_DIR)/tpl_x11_common.c
-TPL_SRCS += $(SRC_DIR)/tpl_x11_dri3.c
-endif
-
-ifneq ($(call is-feature-enabled,winsys_tbm),)
-TPL_SRCS += $(SRC_DIR)/tpl_tbm.c
-endif
-
-OBJS = $(TPL_SRCS:%.c=%.o)
-
-################################################################################
-all: $(BIN_NAME)
-
-$(BIN_NAME) : $(OBJS) $(TPL_HEADERS)
-       $(CC) -o $@ $(OBJS) -shared -Wl,-soname,$(SO_NAME) $(CFLAGS) $(LDFLAGS)
-
-%.o: %.c
-       $(CC) -c -o $@ $< $(CFLAGS)
-
-#Make for test file
-#glib_wl_test : $(OBJS) $(WAYLAND_EGL_OBJ_PATH) $(TPL_HEADERS)
-#      $(CC) -o glib_wl_test $(SRC_DIR)/tpl_wayland_egl_thread.c -O0 $(CFLAGS)  $(LDFLAGS)
-
-clean:
-       find . -name "*.o" -exec rm -vf {} \;
-       find . -name "*~" -exec rm -vf {} \;
-       rm -vf $(BIN_NAME)
-#      rm -vf glib_wl_test
-
-install: all
-       cp -va $(BIN_NAME) $(INST_DIR)/
-#      cp glib_wl_test $(bindir)/
-
-uninstall:
-       rm -f $(INST_DIR)/$(BIN_NAME)
-#      rm -f $(bindir)/glib_wl_test
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..d3be4f4
--- /dev/null
@@ -0,0 +1,4 @@
+SUBDIRS = src \
+          src/wayland-egl \
+          pkgconfig
+
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..f6af5f8
--- /dev/null
@@ -0,0 +1,178 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.69])
+AC_INIT([libtpl-egl], [TPL_VERSION_MAJOR.TPL_VERSION_MINOR.TPL_VERSION_PATCH])
+AC_CONFIG_SRCDIR([src/tpl.c])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
+
+# Initialize libtool
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_CC
+AC_PATH_PROG([WL_SCANNER], [wayland-scanner])
+if test -z "$WL_SCANNER"; then
+       AC_MSG_ERROR([wayland-scanner is not found])
+fi
+
+# Checks for libraries.
+AC_CHECK_LIB([dl], [dlopen])
+AC_CHECK_LIB([pthread], [pthread_create])
+
+# Checks for header files.
+AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h unistd.h])
+
+# pkg-config
+PKG_PROG_PKG_CONFIG
+if test "${PKG_CONFIG}" = "" ; then
+   AC_MSG_ERROR([pkg-config tool not found. Install it or set PKG_CONFIG environment variable to that path tool. Exiting...])
+fi
+
+PKG_CHECK_MODULES([TPL_ESSENTIAL], [libtbm])
+
+# Checks for features
+AC_ARG_WITH([arch],
+   [AS_HELP_STRING([--with-arch=armv7l|aarch64],[Set target architecture.])],
+   [],
+   [])
+
+AS_IF([test "${with_arch}" = "aarch64"],
+         [TPL_CFLAGS+=" -DARM_ATOMIC_OPERATION "],
+         [])
+
+AC_ARG_WITH([wayland],
+   [AS_HELP_STRING([--with-wayland=yes|no],[Sets the backend of tpl as wayland. @<:@default=enabled@:>@])],
+   [],
+   [with_wayland=yes])
+
+AS_IF([test "${with_wayland}" = "yes" || test "${with_wayland}" = "1"],
+         [PKG_CHECK_MODULES([TPL_WL], [gbm libtdm-client wayland-tbm-client wayland-tbm-server glib-2.0])
+          TPL_CFLAGS+="$TPL_WL_CFLAGS"
+          TPL_CFLAGS+=" -DTPL_WINSYS_WL=1 "
+          TPL_LIBS+="$TPL_WL_LIBS"],
+          [])
+
+AM_CONDITIONAL([WITH_WAYLAND], [test "${with_wayland}" = "yes" || test "${with_wayland}" = "1"])
+
+AC_ARG_WITH([tbm],
+   [AS_HELP_STRING([--with-tbm=yes|no],[Sets the backend of tpl as tbm. @<:@default=enabled@:>@])],
+   [],
+   [with_tbm=yes])
+
+AS_IF([test "${with_tbm}" = "yes" || test "${with_tbm}" = "1"],
+         [TPL_CFLAGS+=" -DTPL_WINSYS_TBM=1 "],
+         [])
+
+AM_CONDITIONAL([WITH_TBM], [test "${with_tbm}" = "yes" || test "${with_tbm}" = "1"])
+
+AC_ARG_ENABLE([wayland-thread],
+   [AS_HELP_STRING([--enable-wayland-thread=yes|no],[Sets the backend of tpl as wayland-thread.])],
+   [],
+   [])
+
+AS_IF([test "${enable_wayland_thread}" = "yes" || test "${enable_wayland_thread}" = "1"],
+         [TPL_CFLAGS+=" -DWL_THREAD_DEFAULT_ENABLE=1 "],
+         [])
+
+AM_CONDITIONAL([ENABLE_WAYLAND_THREAD], [test "${enable_wayland_thread}" = "yes" || test "${enable_wayland_thread}" = "1"])
+
+AC_ARG_ENABLE([dlog],
+   [AS_HELP_STRING([--enable-dlog=yes|no],[Enable dlog. @<:@default=enabled@:>@])],
+   [],
+   [enable_dlog=yes])
+
+AS_IF([test "${enable_dlog}" = "yes" || test "${enable_dlog}" = "1"],
+         [PKG_CHECK_MODULES([DLOG], [dlog])
+          TPL_CFLAGS+="$DLOG_CFLAGS"
+          TPL_CFLAGS+=" -DDLOG_DEFAULT_ENABLE "
+          TPL_LIBS+="$DLOG_LIBS"],
+         [])
+
+AM_CONDITIONAL([ENABLE_DLOG], [test "${enable_dlog}" = "yes" || test "${enable_dlog}" = "1"])
+
+AC_ARG_ENABLE([dlog-default],
+   [AS_HELP_STRING([--enable-dlog-default=yes|no],[Enable printing dlog by default. @<:@default=disabled@:>@])],
+   [],
+   [])
+
+AS_IF([test "${enable_dlog_default}" = "yes" || test "${enable_dlog_default}" = "1"],
+         [TPL_CFLAGS+=" -DLOG_DEFAULT_ENABLE "],
+         [])
+
+AM_CONDITIONAL([ENABLE_DLOG_DEFAULT], [test "${enable_dlog_default}" = "yes" || test "${enable_dlog_default}" = "1"])
+
+AC_ARG_ENABLE([dump],
+   [AS_HELP_STRING([--enable-dump=yes|no],[Enable creating dump by default. @<:@default=disabled@:>@])],
+   [],
+   [])
+
+AS_IF([test "${enable_dump}" = "yes" || test "${enable_dump}" = "1"],
+         [TPL_CFLAGS+=" -DDEFAULT_DUMP_ENABLE "],
+         [])
+
+AM_CONDITIONAL([ENABLE_DUMP], [test "${enable_dump}" = "yes" || test "${enable_dump}" = "1"])
+
+AC_ARG_ENABLE([object-hash-check],
+   [AS_HELP_STRING([--enable-object-hash-check=yes|no],[Enable object hash check. @<:@default=disabled@:>@])],
+   [],
+   [])
+
+AS_IF([test "${enable_object_hash_check}" = "yes" || test "${enable_object_hash_check}" = "1"],
+         [TPL_CFLAGS+=" -DOBJECT_HASH_CHECK "],
+         [])
+
+AM_CONDITIONAL([ENABLE_OBJECT_HASH_CHECK], [test "${enable_object_hash_check}" = "yes" || test "${enable_object_hash_check}" = "1"])
+
+AC_ARG_ENABLE([ttrace],
+   [AS_HELP_STRING([--enable-ttrace=yes|no],[Enable ttrace.])],
+   [],
+   [])
+
+AS_IF([test "${enable_ttrace}" = "yes" || test "${enable_ttrace}" = "1"],
+         [PKG_CHECK_MODULES([TTRACE], [ttrace])
+         TPL_CFLAGS+="$TTRACE_CFLAGS"
+         TPL_LIBS+="$TTRACE_LIBS"],
+         [])
+
+AM_CONDITIONAL([ENABLE_TTRACE], [test "${enable_ttrace}" = "yes" || test "${enable_ttrace}" = "1"])
+
+TPL_CFLAGS+="$TPL_ESSENTIAL_CFLAGS"
+TPL_LIBS+="$TPL_ESSENTIAL_LIBS"
+
+AC_SUBST([TPL_CFLAGS])
+AC_SUBST([TPL_LIBS])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_INLINE
+AC_TYPE_INT32_T
+AC_TYPE_INT64_T
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT64_T
+AC_TYPE_UINT8_T
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_STRERROR_R
+AC_CHECK_FUNCS([clock_gettime memset])
+
+# Set output files
+AC_CONFIG_FILES([
+                                Makefile
+                                src/Makefile
+                                src/wayland-egl/Makefile
+                                pkgconfig/Makefile
+                                pkgconfig/tpl-egl.pc
+                                pkgconfig/wayland-egl.pc
+                                ])
+
+AC_OUTPUT
+
+# TODO: TC
+# AC_CONFIG_SUBDIRS([tc/]) ... like this
+
index 7225ac9..2a62f58 100644 (file)
@@ -125,137 +125,36 @@ Development header files for use with Wayland protocol
 %setup -q
 
 %build
-#libtpl-egl build
-TPL_OPTIONS=${TPL_OPTIONS}-winsys_tbm
-
-%if "%{TPL_WINSYS}" == "DRI2"
-TPL_OPTIONS=${TPL_OPTIONS}-winsys_dri2
-%endif
-%if "%{TPL_WINSYS}" == "DRI3"
-TPL_OPTIONS=${TPL_OPTIONS}-winsys_dri3
-%endif
-%if "%{TPL_WINSYS}" == "WL"
-TPL_OPTIONS=${TPL_OPTIONS}-winsys_wl
-%endif
-
-%if "%{ENABLE_TTRACE}" == "1"
-TPL_OPTIONS=${TPL_OPTIONS}-ttrace
-%endif
-
-%if "%{ENABLE_DLOG}" == "1"
-TPL_OPTIONS=${TPL_OPTIONS}-dlog
-%endif
-
-%if "%{ENABLE_DEFAULT_LOG}" == "1"
-TPL_OPTIONS=${TPL_OPTIONS}-default_log
-%endif
-
-%if "%{ENABLE_DEFAULT_DUMP}" == "1"
-TPL_OPTIONS=${TPL_OPTIONS}-default_dump
-%endif
-
-%if "%{ENABLE_OBJECT_HASH_CHECK}" == "1"
-TPL_OPTIONS=${TPL_OPTIONS}-object_hash_check
-%endif
-
-%if "%{ENABLE_DEFAULT_WL_THREAD}" == "1"
-TPL_OPTIONS=${TPL_OPTIONS}-wl_thread
-%endif
-
-%ifarch %arm aarch64
-TPL_OPTIONS=${TPL_OPTIONS}-arm_atomic_operation
-%endif
-
-# do not change the following line
-export TPL_OPTIONS=${TPL_OPTIONS}-
-
 export TPL_VERSION_MAJOR=%{TPL_VERSION_MAJOR}
 export TPL_VERSION_MINOR=%{TPL_VERSION_MINOR}
 export TPL_VERSION_PATCH=%{TPL_VERSION_PATCH}
 
-#wayland-vulkan build
-%if "%{TPL_WINSYS}" == "WL"
-cd src/wayland-vulkan
-make
-cd -
-%endif
-
-make all
-
-#libwayland-egl build
-%if "%{TPL_WINSYS}" == "WL"
-cd src/wayland-egl
 export WL_EGL_VERSION_MAJOR=%{WL_EGL_VERSION_MAJOR}
 export WL_EGL_VERSION_MINOR=%{WL_EGL_VERSION_MINOR}
 export WL_EGL_VERSION_PATCH=%{WL_EGL_VERSION_PATCH}
-make
-cd ../../
-%endif
 
-%if "%{ENABLE_WORKER_TEST_ONLY}" == "1"
-cd worker_test/
-make
-cd ../
+%reconfigure   \
+%ifarch aarch64
+       --with-arch=aarch64     \
 %endif
-
-#tpl-test build
-%if "%{ENABLE_TPL_TEST}" == "1"
-cd tc/
-make
-cd ../
+%if "%{TPL_WINSYS}" == "WL"
+       --with-wayland=yes      \
+       --enable-wayland-thread=%{ENABLE_DEFAULT_WL_THREAD}     \
 %endif
+       --enable-dlog=%{ENABLE_DLOG}                                                    \
+       --enable-dlog-default=%{ENABLE_DEFAULT_LOG}                             \
+       --enable-dump=%{ENABLE_DEFAULT_DUMP}                                    \
+       --enable-object-hash-check=%{ENABLE_OBJECT_HASH_CHECK}  \
+       --enable-ttrace=%{ENABLE_TTRACE}
 
-#pkgconfig configure
-cd pkgconfig
-cmake .
-cd ..
+make %{?_smp_mflags}
 
 %install
 rm -fr %{buildroot}
-mkdir -p %{buildroot}
-mkdir -p %{buildroot}%{_libdir}
-mkdir -p %{buildroot}%{_includedir}
-mkdir -p %{buildroot}%{_libdir}/pkgconfig
-
-export TPL_VERSION_MAJOR=%{TPL_VERSION_MAJOR}
-export TPL_VERSION_MINOR=%{TPL_VERSION_MINOR}
-export TPL_VERSION_PATCH=%{TPL_VERSION_PATCH}
-
-make install libdir=%{buildroot}%{_libdir}
+%make_install
 
-ln -sf libtpl-egl.so.%{TPL_VERSION} %{buildroot}%{_libdir}/libtpl-egl.so
-
-cp -a src/tpl.h                                %{buildroot}%{_includedir}/
-cp -a pkgconfig/tpl-egl.pc             %{buildroot}%{_libdir}/pkgconfig/
-
-%if "%{TPL_WINSYS}" == "WL"
-cd src/wayland-egl
-ln -sf libwayland-egl.so.%{WL_EGL_VERSION} %{buildroot}%{_libdir}/libwayland-egl.so
-export WL_EGL_VERSION_MAJOR=%{WL_EGL_VERSION_MAJOR}
-export WL_EGL_VERSION_MINOR=%{WL_EGL_VERSION_MINOR}
-export WL_EGL_VERSION_PATCH=%{WL_EGL_VERSION_PATCH}
-%makeinstall
-cd -
-
-cd src/wayland-vulkan
-%makeinstall
-cd -
-%endif
-
-%if "%{ENABLE_WORKER_TEST_ONLY}" == "1"
-mkdir -p %{buildroot}%{_bindir}
-cp -arp ./worker_test/worker_test %{buildroot}%{_bindir}/worker_test
-%endif
-
-#tpl-test install
-%if "%{ENABLE_TPL_TEST}" == "1"
-mkdir -p %{buildroot}/opt/usr/tpl-test
-cp -arp ./tc/tpl-test %{buildroot}/opt/usr/tpl-test
-
-# License of Google Test which is BSD-3-Clause
-mkdir -p %{buildroot}/%{TZ_SYS_RO_SHARE}/licenses/googletest
-cp -a %{_builddir}/%{buildsubdir}/tc/libs/gtest/googletest/LICENSE %{buildroot}/%{TZ_SYS_RO_SHARE}/licenses/googletest/LICENSE
-%endif
+%clean
+rm -rf %{buildroot}
 
 %post -p /sbin/ldconfig
 %postun -p /sbin/ldconfig
@@ -269,21 +168,9 @@ cp -a %{_builddir}/%{buildsubdir}/tc/libs/gtest/googletest/LICENSE %{buildroot}/
 %manifest packaging/libtpl-egl.manifest
 %license COPYING
 %defattr(-,root,root,-)
+%{_libdir}/libtpl-egl.so.%{TPL_VERSION_MAJOR}
 %{_libdir}/libtpl-egl.so.%{TPL_VERSION}
 
-%if "%{ENABLE_WORKER_TEST_ONLY}" == "1"
-%{_bindir}/worker_test
-%endif
-
-#tpl-test files
-%if "%{ENABLE_TPL_TEST}" == "1"
-%dir /opt/usr/tpl-test/
-/opt/usr/tpl-test/tpl-test
-
-# License of Google Test which is BSD-3-Clause
-%{TZ_SYS_RO_SHARE}/licenses/googletest/LICENSE
-%endif
-
 %files devel
 %defattr(-,root,root,-)
 %{_includedir}/tpl.h
diff --git a/pkgconfig/CMakeLists.txt b/pkgconfig/CMakeLists.txt
deleted file mode 100644 (file)
index 680e0b6..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(libtpl-egl_package_config)
-
-SET(BUILD_ARCH "$ENV{RPM_ARCH}")
-
-IF(${BUILD_ARCH} MATCHES "aarch64")
-SET(LIB "lib64")
-SET(LIBDIR "/usr/lib64")
-ELSEIF(${BUILD_ARCH} MATCHES "x86_64")
-SET(LIB "lib64")
-SET(LIBDIR "/usr/lib64")
-ELSE(${BUILD_ARCH} MATCHES "aarch64")
-SET(LIB "lib")
-SET(LIBDIR "/usr/lib")
-ENDIF(${BUILD_ARCH} MATCHES "aarch64")
-
-#################################################################
-# Build Package Config File
-# ------------------------------
-CONFIGURE_FILE(tpl-egl.pc.in tpl-egl.pc @ONLY)
-CONFIGURE_FILE(wayland-egl.pc.in wayland-egl.pc @ONLY)
diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am
new file mode 100644 (file)
index 0000000..9f4a13e
--- /dev/null
@@ -0,0 +1,3 @@
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = tpl-egl.pc wayland-egl.pc
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..6c5141c
--- /dev/null
@@ -0,0 +1,55 @@
+libtpl_egl_la_LTLIBRARIES = libtpl-egl.la
+libtpl_egl_ladir = $(libdir)
+
+libtpl_egl_lainclude_HEADERS = tpl.h
+libtpl_egl_laincludedir = $(includedir)
+
+libtpl_egl_la_CFLAGS = -I$(srcdir)     \
+                       @TPL_CFLAGS@
+
+libtpl_egl_la_LIBADD = @TPL_LIBS@
+libtpl_egl_la_LDFLAGS = -version-number $(TPL_VERSION_MAJOR):$(TPL_VERSION_MINOR):$(TPL_VERSION_PATCH)
+
+# Default sources
+libtpl_egl_la_SOURCES  = tpl.c \
+                         tpl_display.c \
+                         tpl_object.c \
+                         tpl_surface.c \
+                         tpl_utils_hlist.c \
+                         tpl_utils_map.c
+
+# Wayland
+if WITH_WAYLAND
+libtpl_egl_la_SOURCES += tpl_wayland_egl.c \
+                         tpl_gbm.c \
+                         protocol/tizen-surface-protocol.c \
+                         tpl_wl_egl_thread.c \
+                         tpl_wayland_egl_thread.c \
+                         tpl_wayland_vk_wsi.c \
+                         tpl_worker_thread.c \
+                         wayland-vulkan/wayland-vulkan-protocol.c
+endif
+
+# TBM
+if WITH_TBM
+libtpl_egl_la_SOURCES += tpl_tbm.c
+endif
+
+nodist_libtpl_egl_la_SOURCES = wayland-vulkan/wayland-vulkan-server-protocol.h \
+                               wayland-vulkan/wayland-vulkan-client-protocol.h
+
+BUILT_SOURCES = wayland-vulkan/wayland-vulkan-server-protocol.h \
+                wayland-vulkan/wayland-vulkan-client-protocol.h \
+                wayland-vulkan/wayland-vulkan-protocol.c
+
+WAYLAND_VULKAN_PROTOCOLS = wayland-vulkan/wayland-vulkan-protocol.xml
+
+wayland-vulkan/wayland-vulkan-protocol.c : $(WAYLAND_VULKAN_PROTOCOLS)
+               wayland-scanner code < $< > $@
+
+wayland-vulkan/wayland-vulkan-server-protocol.h : $(WAYLAND_VULKAN_PROTOCOLS)
+               wayland-scanner server-header < $< > $@
+
+wayland-vulkan/wayland-vulkan-client-protocol.h : $(WAYLAND_VULKAN_PROTOCOLS)
+               wayland-scanner client-header < $< > $@
+
index c72fde6..2fa642f 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef TPL_INTERNAL_H
 #define TPL_INTERNAL_H
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "tpl.h"
 #include <stdlib.h>
 #include <pthread.h>
diff --git a/src/wayland-egl/Makefile b/src/wayland-egl/Makefile
deleted file mode 100644 (file)
index 7a4607f..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-WL_EGL_SO_NAME = libwayland-egl.so.$(WL_EGL_VERSION_MAJOR)
-WL_EGL_BIN_NAME = $(WL_EGL_SO_NAME).$(WL_EGL_VERSION_MINOR).$(WL_EGL_VERSION_PATCH)
-SRC_DIR = ./
-
-#CROSS_COMPILE ?= arm-none-linux-gnueabi-
-TARGET_CC ?= $(CROSS_COMPILE)gcc
-TARGET_AR ?= $(CROSS_COMPILE)ar
-CFLAGS += -Wall -fno-strict-aliasing -Wno-strict-aliasing -Wno-long-long -O3 -fPIC
-
-#wayland-egl sources
-WAYLAND_EGL_SRCS +=  \
-                        $(SRC_DIR)/wayland-egl.c
-
-WAYLAND_EGL_HEADERS  += $(SRC_DIR)/wayland-egl-tizen.h
-
-WAYLAND_EGL_OBJS := $(WAYLAND_EGL_SRCS:.c=.o)
-
-all: $(WL_EGL_BIN_NAME)
-
-$(WL_EGL_BIN_NAME) : $(WAYLAND_EGL_OBJS) $(WAYLAND_EGL_HEADERS)
-       $(TARGET_CC) -o $@ $(WAYLAND_EGL_OBJS) -shared -Wl,-soname,$(WL_EGL_SO_NAME) $(CFLAGS)
-
-%.o: %.c
-       $(TARGET_CC) -c -o $@ $< $(CFLAGS)
-
-.DEFAULT_GOAL = all
-
-clean:
-       -rm -f $(WAYLAND_EGL_OBJS) $(WL_EGL_BIN_NAME)
-
-install: all
-       cp  ../../pkgconfig/wayland-egl.pc $(libdir)/pkgconfig/
-       cp  $(WAYLAND_EGL_HEADERS) $(includedir)
-       cp  $(WL_EGL_BIN_NAME) $(libdir)/
-
-uninstall:
-       -rm  -f $(libdir)/pkgconfig/wayland-egl.pc
-       -rm  -f $(libdir)/$(WL_EGL_BIN_NAME)
diff --git a/src/wayland-egl/Makefile.am b/src/wayland-egl/Makefile.am
new file mode 100644 (file)
index 0000000..854d38d
--- /dev/null
@@ -0,0 +1,11 @@
+libwayland_egl_la_LTLIBRARIES = libwayland-egl.la
+libwayland_egl_ladir = $(libdir)
+
+libwayland_egl_lainclude_HEADERS = wayland-egl-tizen.h
+libwayland_egl_laincludedir = $(includedir)
+
+libwayland_egl_la_CFLAGS = -I$(srcdir)
+libwayland_egl_la_LIBADD =
+libwayland_egl_la_LDFLAGS = -version-number $(WL_EGL_VERSION_MAJOR):$(WL_EGL_VERSION_MINOR):$(WL_EGL_VERSION_PATCH)
+libwayland_egl_la_SOURCES = wayland-egl.c
+
diff --git a/src/wayland-vulkan/Makefile b/src/wayland-vulkan/Makefile
deleted file mode 100644 (file)
index 8300a88..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-.SUFFIXES: .c .o .a
-
-CFLAGS += -Wall -fno-strict-aliasing -Wno-strict-aliasing -Wno-long-long -O3 -fPIC
-
-WAYLAND_VULKAN_PROTOCOLS = wayland-vulkan-protocol.xml
-
-wayland-vulkan-protocol.c : $(WAYLAND_VULKAN_PROTOCOLS)
-               wayland-scanner code < $< > $@
-
-wayland-vulkan-server-protocol.h : $(WAYLAND_VULKAN_PROTOCOLS)
-               wayland-scanner server-header < $< > $@
-
-wayland-vulkan-client-protocol.h : $(WAYLAND_VULKAN_PROTOCOLS)
-               wayland-scanner client-header < $< > $@
-
-.PHONY: all clean client server
-.DEFAULT_GOAL = all
-all: client server
-
-client: wayland-vulkan-protocol.c wayland-vulkan-client-protocol.h
-
-server: wayland-vulkan-protocol.c wayland-vulkan-server-protocol.h
-
-clean:
-               rm -rf wayland-vulkan-protocol.c \
-                       wayland-vulkan-server-protocol.h \
-                       wayland-vulkan-client-protocol.h
-
-install: all
-