diff --git a/patches/openlitespeed-1.4.24.local.patch b/patches/openlitespeed-1.4.24.local.patch
index a0cd9b5..bab2d49 100644
--- a/patches/openlitespeed-1.4.24.local.patch
+++ b/patches/openlitespeed-1.4.24.local.patch
@@ -1,5 +1,57 @@
+--- openlitespeed-1.4.24/src/util/gsendfile.h.orig	2016-12-02 19:51:11.000000000 +0000
++++ openlitespeed-1.4.24/src/util/gsendfile.h	2017-02-11 15:37:19.976655229 +0000
+@@ -83,7 +83,7 @@
+ #endif
+ 
+ #if defined(linux) || defined(__linux) || defined(__linux__) || \
+-    defined(__gnu_linux__)
++    defined(__gnu_linux__) || defined(__midipix__)
+ #include <sys/sendfile.h>
+ #define gsendfile ::sendfile
+ #endif
+--- openlitespeed-1.4.24/src/util/pcutil.h.orig	2016-12-02 19:51:11.000000000 +0000
++++ openlitespeed-1.4.24/src/util/pcutil.h	2017-02-11 15:39:02.736901419 +0000
+@@ -18,7 +18,7 @@
+ #ifndef PCUTIL_H
+ #define PCUTIL_H
+ 
+-#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
++#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) || defined(__midipix__)
+ #include <sched.h>
+ # define SET_AFFINITY(pid, size, mask) sched_setaffinity(0, size, mask)
+ # define GET_AFFINITY(pid, size, mask) sched_getaffinity(0, size, mask)
+--- openlitespeed-1.4.24/src/main/lshttpdmain.cpp.orig	2016-12-02 19:51:11.000000000 +0000
++++ openlitespeed-1.4.24/src/main/lshttpdmain.cpp	2017-02-11 15:50:52.882605886 +0000
+@@ -45,7 +45,9 @@
+ #include <util/stringlist.h>
+ #include <util/signalutil.h>
+ #include <util/vmembuf.h>
++#ifndef __midipix__
+ #include <sys/sysctl.h>
++#endif
+ 
+ #include <extensions/cgi/cgidworker.h>
+ #include <extensions/registry/extappregistry.h>
+@@ -1428,7 +1430,7 @@
+ #ifdef LSWS_NO_SET_AFFINITY
+     return 2;
+ #else
+-#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
++#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) || defined(__midipix__)
+     return sysconf(_SC_NPROCESSORS_ONLN);
+ #else
+     int nm[2];
 --- openlitespeed-1.4.24/configure.orig	2016-12-02 19:52:25.745807731 +0000
-+++ openlitespeed-1.4.24/configure	2017-02-11 15:09:26.176648560 +0000
++++ openlitespeed-1.4.24/configure	2017-02-11 21:11:39.234979798 +0000
+@@ -11292,7 +11292,7 @@
+   ;;
+ 
+ # This must be glibc/ELF.
+-linux* | k*bsd*-gnu | kopensolaris*-gnu)
++linux* | k*bsd*-gnu | kopensolaris*-gnu | midipix)
+   version_type=linux # correct to gnu/linux during the next big refactor
+   need_lib_prefix=no
+   need_version=no
 @@ -15863,16 +15863,8 @@
  
  
@@ -49,46 +101,199 @@
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking lib pcre" >&5
  $as_echo_n "checking lib pcre... " >&6; }
  PCRE_LDFLAGS=
---- openlitespeed-1.4.24/src/util/gsendfile.h.orig	2016-12-02 19:51:11.000000000 +0000
-+++ openlitespeed-1.4.24/src/util/gsendfile.h	2017-02-11 15:37:19.976655229 +0000
-@@ -83,7 +83,7 @@
- #endif
+--- openlitespeed-1.4.24/src/util/pcutil.cpp.orig	2016-12-02 19:51:11.000000000 +0000
++++ openlitespeed-1.4.24/src/util/pcutil.cpp	2017-02-12 20:09:45.817635783 +0000
+@@ -21,6 +21,8 @@
+ #include <ctype.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#include <string.h>
++#include <pthread.h>
  
- #if defined(linux) || defined(__linux) || defined(__linux__) || \
--    defined(__gnu_linux__)
-+    defined(__gnu_linux__) || defined(__midipix__)
- #include <sys/sendfile.h>
- #define gsendfile ::sendfile
+ #ifdef __linux
+ #include <sched.h>
+@@ -72,7 +74,7 @@
+ 
+     if (s_nCpu > 0)
+         return s_nCpu;
+-#if defined(linux) || defined(__linux) || defined(__linux__)
++#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__midipix__)
+     s_nCpu = sysconf(_SC_NPROCESSORS_ONLN);
+ #else
+     int mib[2];
+@@ -116,7 +118,7 @@
+ #ifdef __FreeBSD__
+     return cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1,
+                               sizeof(cpu_set_t), mask);
+-#elif defined(linux) || defined(__linux) || defined(__linux__)
++#elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__midipix__)
+     return pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), mask);
+     //return sched_setaffinity(0, sizeof(cpu_set_t), mask);
  #endif
---- openlitespeed-1.4.24/src/util/pcutil.h.orig	2016-12-02 19:51:11.000000000 +0000
-+++ openlitespeed-1.4.24/src/util/pcutil.h	2017-02-11 15:39:02.736901419 +0000
-@@ -18,7 +18,7 @@
- #ifndef PCUTIL_H
- #define PCUTIL_H
+--- openlitespeed-1.4.24/src/util/sysinfo/partitioninfo.cpp.orig	2016-12-02 19:51:11.000000000 +0000
++++ openlitespeed-1.4.24/src/util/sysinfo/partitioninfo.cpp	2017-02-12 20:11:21.637846476 +0000
+@@ -17,6 +17,9 @@
+ *****************************************************************************/
+ #include "partitioninfo.h"
+ #include <lsdef.h>
++#ifdef __midipix__
++#include <sys/statfs.h>
++#endif
  
--#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
-+#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) || defined(__midipix__)
- #include <sched.h>
- # define SET_AFFINITY(pid, size, mask) sched_setaffinity(0, size, mask)
- # define GET_AFFINITY(pid, size, mask) sched_getaffinity(0, size, mask)
---- openlitespeed-1.4.24/src/main/lshttpdmain.cpp.orig	2016-12-02 19:51:11.000000000 +0000
-+++ openlitespeed-1.4.24/src/main/lshttpdmain.cpp	2017-02-11 15:50:52.882605886 +0000
-@@ -45,7 +45,9 @@
- #include <util/stringlist.h>
- #include <util/signalutil.h>
- #include <util/vmembuf.h>
-+#ifndef __midipix__
- #include <sys/sysctl.h>
+ PartitionInfo::PartitionInfo()
+ {
+@@ -33,7 +36,7 @@
+ int PartitionInfo::getPartitionInfo(const char *path, uint64_t *outTotal,
+                                     uint64_t *outFree)
+ {
+-#if defined(__linux) || defined(sun)
++#if defined(__linux) || defined(sun) || defined(__midipix__)
+     struct statvfs st;
+     if (statvfs(path, &st) != 0)
+     {
+--- openlitespeed-1.4.24/src/util/sysinfo/siocglif_nicdetect.cpp.orig	2016-12-02 19:51:11.000000000 +0000
++++ openlitespeed-1.4.24/src/util/sysinfo/siocglif_nicdetect.cpp	2017-02-12 20:14:43.894291205 +0000
+@@ -18,6 +18,9 @@
+ struct ifi_info *
+ NICDetect::get_ifi_info(int family, int doaliases)
+ {
++#ifdef __midipix__
++    return NULL;
++#else
+     struct ifi_info     *ifi, *ifihead, **ifipnext;
+     int                 sockfd, len, lastlen, flags, myflags;
+     char                *buf, lastname[IFNAMSIZ], *cptr;
+@@ -163,5 +166,6 @@
+     close(sockfd);
+     free(buf);
+     return (ifihead);   /* pointer to first structure in linked list */
 +#endif
+ }
  
- #include <extensions/cgi/cgidworker.h>
- #include <extensions/registry/extappregistry.h>
-@@ -1428,7 +1430,7 @@
- #ifdef LSWS_NO_SET_AFFINITY
-     return 2;
- #else
--#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
-+#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__) || defined(__midipix__)
-     return sysconf(_SC_NPROCESSORS_ONLN);
- #else
-     int nm[2];
+--- openlitespeed-1.4.24/src/modules/Makefile.in.orig	2016-12-02 19:52:23.711814564 +0000
++++ openlitespeed-1.4.24/src/modules/Makefile.in	2017-02-12 20:16:36.002537713 +0000
+@@ -185,7 +185,7 @@
+   done | $(am__uniquify_input)`
+ ETAGS = etags
+ CTAGS = ctags
+-DIST_SUBDIRS = cache uploadprogress modinspector lua
++DIST_SUBDIRS = lua
+ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ am__relativize = \
+   dir0=`pwd`; \
+@@ -361,8 +361,8 @@
+ AM_CPPFLAGS = -I$(top_srcdir)/openssl/include/ -I$(top_srcdir)/include -I$(top_srcdir)/src
+ libmodules_a_METASOURCES = AUTO
+ libmodules_a_SOURCES = modgzip/modgzip.cpp
+-@HAVE_LIBLUA_FALSE@SUBDIRS = cache uploadprogress modinspector
+-@HAVE_LIBLUA_TRUE@SUBDIRS = cache uploadprogress lua modinspector
++@HAVE_LIBLUA_FALSE@SUBDIRS = 
++@HAVE_LIBLUA_TRUE@SUBDIRS = lua
+ all: all-recursive
+ 
+ .SUFFIXES:
+--- openlitespeed-1.4.24/dist/install.sh.orig	2016-12-02 19:51:11.000000000 +0000
++++ openlitespeed-1.4.24/dist/install.sh	2017-02-12 20:39:56.309734680 +0000
+@@ -1,84 +1,5 @@
+ #!/bin/sh
+ 
+-inst_admin_php()
+-{
+-    # detect download method
+-    OS=`uname -s`
+-    OSTYPE=`uname -m`
+-
+-    DLCMD="wget -nv -O"
+-    if [ "x$OS" = "xFreeBSD" ] ; then
+-        DL=`which fetch`
+-        DLCMD="$DL -o"
+-    fi
+-    if [ "x$DLCMD" = "x" ] ; then
+-        DL=`which wget`
+-        DLCMD="$DL -nv -O"
+-    fi
+-    if [ "x$DLCMD" = "x" ] ; then
+-        DL=`which curl`
+-        DLCMD="$DL -L -o"
+-    fi
+-
+-    echo "DLCMD is $DLCMD"
+-    echo
+-
+-    HASADMINPHP=n
+-    if [ -f "$LSWS_HOME/admin/fcgi-bin/admin_php" ] ; then
+-        mv "$LSWS_HOME/admin/fcgi-bin/admin_php" "$LSWS_HOME/admin/fcgi-bin/admin_php.bak"
+-        echo "admin_php found and mv to admin_php.bak"
+-    fi
+-
+-    if [ ! -d "$LSWS_HOME/admin/fcgi-bin/" ] ; then
+-        mkdir -p "$LSWS_HOME/admin/fcgi-bin/"
+-        echo "Mkdir $LSWS_HOME/admin/fcgi-bin/ for installing admni_php"
+-    fi
+-        
+-    if [ "x$OS" = "xLinux" ] ; then
+-        if [ "x$OSTYPE" != "xx86_64" ] ; then
+-            $DLCMD $LSWS_HOME/admin/fcgi-bin/admin_php http://www.litespeedtech.com/packages/lsphp5_bin/i386/lsphp5
+-        else
+-            $DLCMD $LSWS_HOME/admin/fcgi-bin/admin_php http://www.litespeedtech.com/packages/lsphp5_bin/x86_64/lsphp5
+-        fi
+-        
+-        if [ $? = 0 ] ; then 
+-            HASADMINPHP=y
+-            echo "admin_php downloaded."
+-        fi
+-        
+-#        if [ -f  "$LSWS_HOME/admin/fcgi-bin/admin_php" ] ; then
+-#            HASADMINPHP=y
+-#        fi
+-
+-    elif [ "x$OS" = "xFreeBSD" ] ; then
+-        if [ "x$OSTYPE" != "xamd64" ] ; then
+-           $DLCMD $LSWS_HOME/admin/fcgi-bin/admin_php http://www.litespeedtech.com/packages/lsphp5_bin/i386-freebsd/lsphp5
+-        else
+-           $DLCMD $LSWS_HOME/admin/fcgi-bin/admin_php http://www.litespeedtech.com/packages/lsphp5_bin/x86_64-freebsd/lsphp5
+-        fi
+-       
+-        if [ $? = 0 ] ; then 
+-           HASADMINPHP=y
+-           echo "admin_php downloaded."
+-        fi
+-    fi
+-
+-    if [ "x$HASADMINPHP" = "xn" ] ; then
+-        echo -e "\033[38;5;148mStart to build php, this may take several minutes, please waiting ...\033[39m"
+-        $LSWS_HOME/admin/misc/build_admin_php.sh
+-    else
+-        chmod "$EXEC_MOD" "$LSWS_HOME/admin/fcgi-bin/admin_php"
+-    fi
+-
+-    #final checking of existence of admin_php
+-    if [ ! -f "$LSWS_HOME/admin/fcgi-bin/admin_php" ] ; then
+-        echo -e "\033[38;5;148mFinal checking found admin_php not exists, installation abort.\033[39m"
+-        exit 1
+-    fi
+-}
+-
+-
+-
+ #script start here
+ cd `dirname "$0"`
+ source ./functions.sh 2>/dev/null
+@@ -169,7 +90,6 @@
+     echo
+     
+     echo -e "\033[38;5;148m$LSWS_HOME/conf/httpd_config.xml exists, will be converted to $LSWS_HOME/conf/httpd_config.conf!\033[39m"
+-    inst_admin_php
+     PHP_INSTALLED=y
+     
+     if [ -e "$LSWS_HOME/conf/httpd_config.conf" ] ; then
+@@ -238,9 +158,6 @@
+ buildConfigFiles
+ installation
+ 
+-if [ "x$PHP_INSTALLED" = "xn" ] ; then
+-    inst_admin_php
+-fi
+ 
+ rm $LSWS_HOME/bin/lshttpd
+ ln -sf ./openlitespeed $LSWS_HOME/bin/lshttpd
diff --git a/vars/build.vars b/vars/build.vars
index 553f896..b01bb13 100644
--- a/vars/build.vars
+++ b/vars/build.vars
@@ -719,8 +719,11 @@ LEAF_PACKAGES_PREFIX="${PREFIX_NATIVE}";
 : ${PKG_OPENLITESPEED_SHA256SUM:=c2dd2a42a86994433e1f7e48f1a336201c4f7f79b204c837e56911fd60f08a1f};
 : ${PKG_OPENLITESPEED_VERSION:=1.4.24};
 : ${PKG_OPENLITESPEED_URL:=http://open.litespeedtech.com/packages/openlitespeed-${PKG_OPENLITESPEED_VERSION}.tgz};
-: ${PKG_OPENLITESPEED_CONFIGURE_ARGS_EXTRA:="--with-openssl=${PREFIX_NATIVE} --with-zlib=${PREFIX_NATIVE}"};
+: ${PKG_OPENLITESPEED_BUILD_DIR:=openlitespeed-${PKG_OPENLITESPEED_VERSION}};
+: ${PKG_OPENLITESPEED_SUBDIR:=${PKG_OPENLITESPEED_BUILD_DIR}};
+: ${PKG_OPENLITESPEED_CONFIGURE_ARGS:="-C --host=${TARGET} --prefix=/usr/lsws --target=${TARGET} --with-openssl=${PREFIX_NATIVE} --with-zlib=${PREFIX_NATIVE}"};
 : ${PKG_OPENLITESPEED_CXXFLAGS_CONFIGURE_EXTRA:="-D_GNU_SOURCE"};
+: ${PKG_OPENLITESPEED_MAKEFLAGS_BUILD:=-j1};
 : ${PKG_OPENSSH_SHA256SUM:=3ffb989a6dcaa69594c3b550d4855a5a2e1718ccdde7f5e36387b424220fbecc};
 : ${PKG_OPENSSH_VERSION:=7.3p1};
 : ${PKG_OPENSSH_URL:=http://artfiles.org/openbsd/OpenSSH/portable/openssh-${PKG_OPENSSH_VERSION}.tar.gz};