find $(win32_destdir) -type f \( -name "*xml" -or -name "*html" -or -name '*js' -or -name '*css' -or -name '*hosts' -or -iname '*txt' -or -name '*.cfg' -or -name '*.lua' \) -exec $(U2D) {} \;
#Enable DEP and ASLR for all the binaries
-if USE_PEFLAGS
- find $(win32_destdir) -type f \( -name '*$(LIBEXT)' -print -o -name '*$(EXEEXT)' -print \) -exec $(PEFLAGS) --dynamicbase=true --nxcompat=true {} \;
-endif
+ find $(win32_destdir) -type f \( -name '*$(LIBEXT)' -print -o -name '*$(EXEEXT)' -print \) -exec $(top_srcdir)/extras/package/win32/peflags.py {} \;
find $(win32_destdir)/plugins/ -type f \( -name '*.a' -or -name '*.la' \) -exec rm -rvf {} \;
package-win-base: package-win-common
VLC_ADD_LDFLAGS([vlc],[-mwindows])
VLC_ADD_LIBS([win32text],[-lgdi32])
VLC_ADD_LIBS([cdda vcdx sdl_image vout_sdl],[-lwinmm])
- dnl
- dnl DEP and ASLR options
- dnl
- AC_ARG_WITH(peflags,
- [AS_HELP_STRING([--with-peflags],
- [use peflags (default enabled on Windows)])])
- if test "${with_peflags}" != "no" ; then
- AC_PATH_TOOL(PEFLAGS, peflags, :)
- fi
AC_CHECK_PROGS(U2D, [unix2dos todos], unix2dos)
ac_default_prefix="`pwd`/_win32"
DESTDIR="`pwd`/_win32/"
AM_CONDITIONAL(HAVE_WIN64, test "${HAVE_WIN64}" = "1")
AM_CONDITIONAL(HAVE_WINCE, test "${SYS}" = "mingwce")
AM_CONDITIONAL(HAVE_SYMBIAN, test "${SYS}" = "symbian")
-AM_CONDITIONAL(USE_PEFLAGS, test "${with_peflags}" = "yes")
dnl
dnl Sadly autoconf doesn't think about testing foo.exe when ask to test
vcdimager, cdio -- why are they used only in osx binaries, do we really need them?
build tools -- (autotools, libtool, yasm...) see extras/tools
-
-# Windows
-
-peflags -- a build tool, only a single .c file; we should rather put it in git
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+#
+# Copyright © 2011 Rafaël Carré <funman at videolanorg>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+#
+
+from os import SEEK_CUR
+from sys import argv
+
+def get_le(f, n):
+ array = bytearray(f.read(n))
+ if len(array) != n:
+ raise Exception('Reading failed!')
+ shift = 0
+ ret = 0
+ for c in array:
+ ret = ret + (c << shift)
+ shift = shift + 8
+ return ret
+
+###
+
+if len(argv) != 2:
+ exit(1)
+
+f = open(argv[1], 'r+b')
+
+f.seek(0x3c)
+f.seek(get_le(f, 4))
+
+if get_le(f, 4) != 0x00004550: # IMAGE_NT_SIGNATURE
+ raise Exception('Not a NT executable')
+
+f.seek(20 + 70, SEEK_CUR)
+
+flags = get_le(f, 2)
+f.seek(-2, SEEK_CUR)
+flags |= 0x100 # NX Compat
+flags |= 0x40 # Dynamic Base
+
+f.write(bytearray([flags & 0xff, (flags >> 8) & 0xff ]))
+
+f.close