fossil: add package
authorLuka Perkov <luka@openwrt.org>
Sun, 1 Nov 2015 12:18:15 +0000 (13:18 +0100)
committerLuka Perkov <luka@openwrt.org>
Sun, 1 Nov 2015 15:31:59 +0000 (16:31 +0100)
Signed-off-by: Luka Perkov <luka@openwrt.org>
net/fossil/Makefile [new file with mode: 0644]
net/fossil/files/fossil.config [new file with mode: 0644]
net/fossil/files/fossil.init [new file with mode: 0644]
net/fossil/patches/no_https.patch [new file with mode: 0644]

diff --git a/net/fossil/Makefile b/net/fossil/Makefile
new file mode 100644 (file)
index 0000000..656c83c
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=fossil
+PKG_VERSION:=1.33
+PKG_RELEASE:=1
+
+PKG_LICENSE:=BSD-2-Clause
+PKG_MAINTAINER:=Luka Perkov <luka@openwrt.org>
+
+PKG_SOURCE:=$(PKG_NAME)-src-${PKG_VERSION}.tar.gz
+PKG_SOURCE_URL:=http://www.fossil-scm.org/download/
+PKG_MD5SUM:=53f8145084a2065d6cb734980c172c7e
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-src-$(PKG_VERSION)
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fossil
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Version Control Systems
+  TITLE:=Simple distributed software configuration management
+  URL:=http://www.fossil-scm.org
+  DEPENDS:=+zlib
+endef
+
+define Package/fossil/description
+  Fossil is a distributed version control system, bug tracking system
+  and wiki software server for use in software development.
+endef
+
+MAKE_FLAGS := \
+       TCC="$(TARGET_CC)" \
+       CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -DFOSSIL_ENABLE_JSON" \
+       LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath=$(TOOLCHAIN_DIR)/lib -L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
+
+undefine Build/Configure
+
+define Build/Compile
+       $(call Build/Compile/Default, \
+               -f Makefile.classic $(MAKE_FLAGS) all \
+       )
+endef
+
+undefine Build/Install
+
+define Package/fossil/conffiles
+/etc/config/fossil
+endef
+
+define Package/fossil/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/fossil.init $(1)/etc/init.d/fossil
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/fossil.config $(1)/etc/config/fossil
+endef
+
+$(eval $(call BuildPackage,fossil))
diff --git a/net/fossil/files/fossil.config b/net/fossil/files/fossil.config
new file mode 100644 (file)
index 0000000..f35876c
--- /dev/null
@@ -0,0 +1,5 @@
+config server 'dummy'
+       option repository '/tmp/fossil/dummy'
+       option port 8008
+       option localhost 0
+       option create 1
diff --git a/net/fossil/files/fossil.init b/net/fossil/files/fossil.init
new file mode 100644 (file)
index 0000000..f5a17b9
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2015 OpenWrt.org
+
+START=90
+USE_PROCD=1
+
+start_instance() {
+       local cfg="$1"
+
+       config_get repository "$cfg" repository
+       if [ -z "$repository" ]; then
+               echo "repository is not defined in $1, skipping"
+               return
+       fi
+
+       config_get_bool create "$cfg" create 0
+
+       if [ "$create" -eq 0 -a ! -f "$repository" ]; then
+               echo "in $1 create option is '$create' and repository '$repository' is not a regular file, skipping"
+               return
+       fi
+
+       if [ "$create" -eq 1 -a ! -d `dirname $repository` ]; then
+               mkdir -p `dirname $repository`
+               if [ "$?" -ne 0 ]; then
+                       echo "could not create directory, skipping"
+                       return
+               fi
+       fi
+
+       config_get port "$cfg" port ""
+       if [ -z "$port" ]; then
+               echo "port is not defined in $1, skipping"
+               return
+       fi
+
+       config_get_bool debug "$cfg" debug 0
+       config_get_bool localhost "$cfg" localhost 1
+       config_get_bool scgi "$cfg" scgi 0
+
+       procd_open_instance
+       procd_set_param command /usr/bin/fossil server "$repository" --port $port
+       [ "$debug" -eq 1 ] && procd_append_param command --th-trace
+       [ "$create" -eq 1 ] && procd_append_param command --user root --create
+       [ "$localhost" -eq 1 ] && procd_append_param command --localhost
+       [ "$scgi" -eq 1 ] && procd_append_param command --scgi
+       procd_set_param respawn
+       procd_close_instance
+}
+
+start_service() {
+       config_load 'fossil'
+       config_foreach start_instance 'server'
+}
diff --git a/net/fossil/patches/no_https.patch b/net/fossil/patches/no_https.patch
new file mode 100644 (file)
index 0000000..411504f
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/Makefile.classic
++++ b/Makefile.classic
+@@ -41,9 +41,6 @@ TCC = gcc -g -Os -Wall
+ # FOSSIL_ENABLE_MINIZ = 1
+ # TCC += -DFOSSIL_ENABLE_MINIZ
+-# To add support for HTTPS
+-TCC += -DFOSSIL_ENABLE_SSL
+-
+ #### Extra arguments for linking the finished binary.  Fossil needs
+ #    to link against the Z-Lib compression library unless the miniz
+ #    library in the source tree is being used.  There are no other
+@@ -58,9 +55,6 @@ ZLIB_LIB.  = $(ZLIB_LIB.0)
+ # If using zlib:
+ LIB = $(ZLIB_LIB.$(FOSSIL_ENABLE_MINIZ)) $(LDFLAGS)
+-# If using HTTPS:
+-LIB += -lcrypto -lssl
+-
+ #### Tcl shell for use in running the fossil testsuite.  If you do not
+ #    care about testing the end result, this can be blank.
+ #