diff --git a/x11-servers/Makefile b/x11-servers/Makefile
index a207ff552e50..113f390e96f4 100644
--- a/x11-servers/Makefile
+++ b/x11-servers/Makefile
@@ -5,6 +5,7 @@
SUBDIR += Xfstt
SUBDIR += mga_hal
+ SUBDIR += x11rdp
SUBDIR += x2vnc
SUBDIR += x2x
SUBDIR += xephyr
diff --git a/x11-servers/x11rdp/Makefile b/x11-servers/x11rdp/Makefile
new file mode 100644
index 000000000000..d25e79b71008
--- /dev/null
+++ b/x11-servers/x11rdp/Makefile
@@ -0,0 +1,44 @@
+# Created by: Koichiro IWAO
+# $FreeBSD$
+
+PORTNAME= x11rdp
+PORTVERSION= 0.5.0.${X11RDPREVISION}
+CATEGORIES= x11-servers
+MASTER_SITES= http://www.club.kyutech.ac.jp/~meta/distfiles/:x11rdp
+DISTNAME= ${PORTNAME}_xorg71
+DISTFILES= ${PORTNAME}_xorg71_r${X11RDPREVISION}.tar.gz:x11rdp
+DIST_SUBDIR= xrdp
+
+MAINTAINER= meta+ports@vmeta.jp
+COMMENT= X11 server for xrdp
+
+LICENSE= MIT
+
+RUN_DEPENDS= xorg-fonts>=0:${PORTSDIR}/x11-fonts/xorg-fonts
+
+# SVN revision of x11rdp
+X11RDPREVISION= 299
+
+USES= gmake pkgconfig perl5
+USE_OPENSSL= yes
+CONFLICTS_INSTALL= xrdp-devel-[0-9]* x11rdp-devel-[0-9]*
+
+PLIST_FILES= bin/X11rdp
+
+post-extract:
+ @${MKDIR} ${WRKSRC}/build_dir
+
+post-patch:
+ @${REINPLACE_CMD} -e "s|%%LOCALBASE%%|${LOCALBASE}|g" ${WRKSRC}/buildx.sh
+ @${REINPLACE_CMD} -e "s|%%CC%%|${CC}|g" ${WRKSRC}/buildx.sh
+ @${REINPLACE_CMD} -e "s|%%CXX%%|${CXX}|g" ${WRKSRC}/buildx.sh
+ @${REINPLACE_CMD} -e "s|%%CPP%%|${CPP}|g" ${WRKSRC}/buildx.sh
+ @${REINPLACE_CMD} -e "s|%%GMAKE%%|${GMAKE}|g" ${WRKSRC}/buildx.sh
+
+do-build:
+ @cd ${WRKSRC} && GNUMAKE=${GMAKE} ${SH} ${WRKSRC}/buildx.sh ${WRKSRC}/build_dir
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/build_dir/bin/X11rdp ${STAGEDIR}${PREFIX}/bin/
+
+.include
diff --git a/x11-servers/x11rdp/distinfo b/x11-servers/x11rdp/distinfo
new file mode 100644
index 000000000000..16f0427e9131
--- /dev/null
+++ b/x11-servers/x11rdp/distinfo
@@ -0,0 +1,2 @@
+SHA256 (xrdp/x11rdp_xorg71_r299.tar.gz) = 0a7bde7ef146b54686d6b42fa0497e563d1e6e98119bae80aa6020dbbde86bfc
+SIZE (xrdp/x11rdp_xorg71_r299.tar.gz) = 51051954
diff --git a/x11-servers/x11rdp/files/patch-buildx_sh b/x11-servers/x11rdp/files/patch-buildx_sh
new file mode 100644
index 000000000000..06c479d4c750
--- /dev/null
+++ b/x11-servers/x11rdp/files/patch-buildx_sh
@@ -0,0 +1,626 @@
+--- buildx.sh.orig 2013-01-28 16:29:10.000000000 +0000
++++ buildx.sh 2013-11-13 03:40:47.787496851 +0000
+@@ -1,6 +1,10 @@
+ #!/bin/sh
+
+-export CPPFLAGS=-D_GNU_SOURCE
++export CPPFLAGS=-D_BSD_SOURCE
++export CC=%%CC%%
++export CXX=%%CXX%%
++export CPP=%%CPP%%
++export GMAKE=%%GMAKE%%
+
+ print_help()
+ {
+@@ -48,8 +52,8 @@
+ echo "error xf86dri"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xf86driproto"
+@@ -65,8 +69,8 @@
+ echo "error glproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping glproto"
+@@ -82,8 +86,8 @@
+ echo "error randrproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping randrproto"
+@@ -99,8 +103,8 @@
+ echo "error renderproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping renderproto"
+@@ -116,8 +120,8 @@
+ echo "error fixesproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping fixesproto"
+@@ -133,8 +137,8 @@
+ echo "error damageproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping damageproto"
+@@ -150,8 +154,8 @@
+ echo "error xcmiscproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xcmiscproto"
+@@ -167,8 +171,8 @@
+ echo "error xextproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xextproto"
+@@ -184,8 +188,8 @@
+ echo "error xproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xproto"
+@@ -201,8 +205,8 @@
+ echo "error xtrans"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xtrans"
+@@ -218,8 +222,8 @@
+ echo "error xf86miscproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xf86miscproto"
+@@ -235,8 +239,8 @@
+ echo "error xf86vidmodeproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xf86vidmodeproto"
+@@ -252,8 +256,8 @@
+ echo "error xf86bigfontproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xf86bigfontproto"
+@@ -269,8 +273,8 @@
+ echo "error scrnsaverproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping scrnsaverproto"
+@@ -286,8 +290,8 @@
+ echo "error bigreqsproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping bigreqsproto"
+@@ -303,8 +307,8 @@
+ echo "error resourceproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping resourceproto"
+@@ -320,8 +324,8 @@
+ echo "error fontsproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping fontsproto"
+@@ -337,8 +341,8 @@
+ echo "error inputproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping inputproto"
+@@ -354,8 +358,8 @@
+ echo "error xf86dgaproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xf86dgaproto"
+@@ -371,8 +375,8 @@
+ echo "error videoproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping videoproto"
+@@ -388,8 +392,8 @@
+ echo "error compositeproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping compositeproto"
+@@ -405,8 +409,8 @@
+ echo "error trapproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping trapproto"
+@@ -422,8 +426,8 @@
+ echo "error recordproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping recordproto"
+@@ -439,8 +443,8 @@
+ echo "error xineramaproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xineramaproto"
+@@ -456,8 +460,8 @@
+ echo "error ice"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping ice"
+@@ -473,8 +477,8 @@
+ echo "error sm"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping sm"
+@@ -490,8 +494,8 @@
+ echo "error xau"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xau"
+@@ -507,8 +511,8 @@
+ echo "error kbproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping kbproto"
+@@ -524,28 +528,28 @@
+ echo "error Xdmcp"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xdmcp"
+ fi
+
+-# x11
+-if ! test -f $PCFILEDIR/x11.pc
++# X11
++if ! test -f $PCFILEDIR/X11.pc
+ then
+ cd libX11-X11R7.1-1.0.1
+ ./configure --prefix=$PREFIXDIR
+ if ! test $? -eq 0
+ then
+- echo "error x11"
++ echo "error X11"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+- echo "skipping x11"
++ echo "skipping X11"
+ fi
+
+ # xt
+@@ -558,8 +562,8 @@
+ echo "error xt"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xt"
+@@ -575,8 +579,8 @@
+ echo "error evieext"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping evieproto"
+@@ -592,8 +596,8 @@
+ echo "error xkbfile"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xkbfile"
+@@ -609,8 +613,8 @@
+ echo "error fontcacheproto"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping fontcacheproto"
+@@ -626,8 +630,8 @@
+ echo "error fontenc"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping fontenc"
+@@ -643,8 +647,8 @@
+ echo "error freetype"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping freetype"
+@@ -660,13 +664,13 @@
+ echo "error xfont"
+ exit 1
+ fi
+- make
++ ${GMAKE}
+ if ! test $? -eq 0
+ then
+ echo "error make xfont"
+ exit 1
+ fi
+- make install
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xfont"
+@@ -682,8 +686,8 @@
+ echo "error Xext"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xext"
+@@ -699,8 +703,8 @@
+ echo "error xmu"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xmu"
+@@ -716,8 +720,8 @@
+ echo "error xkbui"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xkbui"
+@@ -733,8 +737,8 @@
+ echo "error xxf86misc"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xxf86misc"
+@@ -750,8 +754,8 @@
+ echo "error xxf86vm"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xxf86vm"
+@@ -767,8 +771,8 @@
+ echo "error xpm"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xpm"
+@@ -784,8 +788,8 @@
+ echo "error xaw7"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xaw7"
+@@ -801,8 +805,8 @@
+ echo "error libdrm"
+ exit 1
+ fi
+- make
+- make install
++ ${GMAKE}
++ ${GMAKE} install
+ cd ..
+ else
+ echo "skipping libdrm"
+@@ -812,19 +816,28 @@
+ if ! test -f $PCFILEDIR/xorg-server.pc
+ then
+ cd xorg-server-X11R7.1-1.1.0
+- ./configure --prefix=$PREFIXDIR --enable-xglx --with-mesa-source=$SRCDIR/Mesa-6.5 --disable-dmx
++ ./configure \
++ --prefix=$PREFIXDIR \
++ --enable-static \
++ --enable-xglx \
++ --with-mesa-source=$SRCDIR/Mesa-6.5 \
++ --disable-dmx \
++ --enable-xprint=no \
++ --with-fontdir=%%LOCALBASE%%/lib/X11/fonts \
++ --with-xkb-path=%%LOCALBASE%%/share/X11/xkb
++ find . -name Makefile|xargs sed -i".bak" -e "s|-I%%LOCALBASE%%/include||g"
+ if ! test $? -eq 0
+ then
+ echo "error xorg-server"
+ exit 1
+ fi
+- make
++ ${GMAKE}
+ if ! test $? -eq 0
+ then
+ echo "error make xorg-server"
+ exit 1
+ fi
+- make install
++# ${GMAKE} install
+ cd ..
+ else
+ echo "skipping xorg-server"
+@@ -833,7 +846,7 @@
+ # X11rdp
+ cd xorg-server-X11R7.1-1.1.0/hw/rdp
+ export X11RDPBASE=$PREFIXDIR
+-make
++${GMAKE}
+ if ! test $? -eq 0
+ then
+ echo "error make X11rdp"
+@@ -844,31 +857,31 @@
+
+ # this will copy the build X server with the other X server binaries
+ cp $SRCDIR/xorg-server-X11R7.1-1.1.0/hw/rdp/X11rdp $X11RDPBASE/bin
+-strip $X11RDPBASE/bin/X11rdp
++#strip $X11RDPBASE/bin/X11rdp
+
+ # make a symboloc link to your local xkbcomp
+-if ! test -f $X11RDPBASE/bin/xkbcomp
+-then
+- if test -f /usr/bin/xkbcomp
+- then
+- ln -s /usr/bin/xkbcomp $X11RDPBASE/bin/xkbcomp
+- elif test -f /usr/X11R6/bin/xkbcomp
+- then
+- ln -s /usr/X11R6/bin/xkbcomp $X11RDPBASE/bin/xkbcomp
+- fi
+-fi
++#if ! test -f $X11RDPBASE/bin/xkbcomp
++#then
++# if test -f /usr/bin/xkbcomp
++# then
++# ln -s /usr/bin/xkbcomp $X11RDPBASE/bin/xkbcomp
++# elif test -f /usr/X11R6/bin/xkbcomp
++# then
++# ln -s /usr/X11R6/bin/xkbcomp $X11RDPBASE/bin/xkbcomp
++# fi
++#fi
+
+ # make a symbolic link to your local font directory
+-if ! test -d $X11RDPBASE/lib/X11/fonts
+-then
+- if test -d /usr/share/fonts/X11
+- then
+- ln -s /usr/share/fonts/X11 $X11RDPBASE/lib/X11/fonts
+- elif test -d /usr/share/X11/fonts
+- then
+- ln -s /usr/share/X11/fonts $X11RDPBASE/lib/X11/fonts
+- elif test -d /usr/X11R6/lib/X11/fonts
+- then
+- ln -s /usr/X11R6/lib/X11/fonts $X11RDPBASE/lib/X11/fonts
+- fi
+-fi
++#if ! test -d $X11RDPBASE/lib/X11/fonts
++#then
++# if test -d /usr/share/fonts/X11
++# then
++# ln -s /usr/share/fonts/X11 $X11RDPBASE/lib/X11/fonts
++# elif test -d /usr/share/X11/fonts
++# then
++# ln -s /usr/share/X11/fonts $X11RDPBASE/lib/X11/fonts
++# elif test -d /usr/X11R6/lib/X11/fonts
++# then
++# ln -s /usr/X11R6/lib/X11/fonts $X11RDPBASE/lib/X11/fonts
++# fi
++#fi
diff --git a/x11-servers/x11rdp/files/patch-xorg-server-X11R7.1-1.1.0__hw__common__compiler.h b/x11-servers/x11rdp/files/patch-xorg-server-X11R7.1-1.1.0__hw__common__compiler.h
new file mode 100644
index 000000000000..a9eb24b85c56
--- /dev/null
+++ b/x11-servers/x11rdp/files/patch-xorg-server-X11R7.1-1.1.0__hw__common__compiler.h
@@ -0,0 +1,11 @@
+--- xorg-server-X11R7.1-1.1.0/hw/xfree86/common/compiler.h.orig 2013-12-19 04:09:03.884558740 +0000
++++ xorg-server-X11R7.1-1.1.0/hw/xfree86/common/compiler.h 2013-12-19 04:10:29.576270046 +0000
+@@ -1364,7 +1364,7 @@
+
+ # if !defined(__SUNPRO_C)
+ # if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__)
+-# ifdef GCCUSESGAS
++# ifdef __GNUC__
+
+ /*
+ * If gcc uses gas rather than the native assembler, the syntax of these
diff --git a/x11-servers/x11rdp/files/patch-xorg-server-X11R7.1-1.1.0__hw__rdp__Makefile b/x11-servers/x11rdp/files/patch-xorg-server-X11R7.1-1.1.0__hw__rdp__Makefile
new file mode 100644
index 000000000000..22c27a75d071
--- /dev/null
+++ b/x11-servers/x11rdp/files/patch-xorg-server-X11R7.1-1.1.0__hw__rdp__Makefile
@@ -0,0 +1,19 @@
+--- xorg-server-X11R7.1-1.1.0/hw/rdp/Makefile.orig 2013-01-28 16:28:24.000000000 +0000
++++ xorg-server-X11R7.1-1.1.0/hw/rdp/Makefile 2013-11-13 05:21:49.199495983 +0000
+@@ -25,7 +25,7 @@
+ librdp.a \
+ -lfreetype -lz -lm -lXfont -lXau -lXdmcp
+
+-CFLAGS = -O2 -fno-strength-reduce -ansi -pedantic \
++CFLAGS = -O2 -fno-strength-reduce -ansi -pedantic \
+ -I../../include \
+ -I../../cfb \
+ -I../../mfb \
+@@ -37,6 +37,7 @@
+ -I$(INCBASE)/xorg \
+ -I../../os \
+ -I../../render \
++ -I../../randr \
+ -I../xfree86/common \
+ -I../xfree86/os-support \
+ -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_REENTRANT \
diff --git a/x11-servers/x11rdp/files/patch-xorg-server-X11R7.1-1.1.0__hw__rdp__rdp.h b/x11-servers/x11rdp/files/patch-xorg-server-X11R7.1-1.1.0__hw__rdp__rdp.h
new file mode 100644
index 000000000000..68e19fb1b55d
--- /dev/null
+++ b/x11-servers/x11rdp/files/patch-xorg-server-X11R7.1-1.1.0__hw__rdp__rdp.h
@@ -0,0 +1,14 @@
+--- xorg-server-X11R7.1-1.1.0/hw/rdp/rdp.h.orig 2013-01-28 10:50:46.908229086 +0000
++++ xorg-server-X11R7.1-1.1.0/hw/rdp/rdp.h 2013-01-28 11:01:31.760225231 +0000
+@@ -23,6 +23,11 @@
+ #define __arm32__
+ #endif
+
++#ifdef __FreeBSD__
++#undef _POSIX_SOURCE
++#define PF_INET AF_INET
++#endif
++
+ #include "xorg-server.h"
+ #include
+ #include
diff --git a/x11-servers/x11rdp/pkg-descr b/x11-servers/x11rdp/pkg-descr
new file mode 100644
index 000000000000..3abf984b718b
--- /dev/null
+++ b/x11-servers/x11rdp/pkg-descr
@@ -0,0 +1,3 @@
+X11rdp is an X server for xrdp.
+
+WWW: http://www.xrdp.org/