cmake: build .gmo files & copy them in VLC.app
authorRafaël Carré <funman@videolan.org>
Thu, 7 Feb 2008 09:43:29 +0000 (09:43 +0000)
committerRafaël Carré <funman@videolan.org>
Thu, 7 Feb 2008 09:43:29 +0000 (09:43 +0000)
extras/buildsystem/cmake/CMakeLists/po_CMakeLists.txt [new file with mode: 0644]
extras/buildsystem/cmake/CMakeLists/root_CMakeLists.txt
extras/buildsystem/cmake/include/config.cmake
extras/buildsystem/cmake/scripts/convert_vlc_to_cmake.sh

diff --git a/extras/buildsystem/cmake/CMakeLists/po_CMakeLists.txt b/extras/buildsystem/cmake/CMakeLists/po_CMakeLists.txt
new file mode 100644 (file)
index 0000000..54f9f83
--- /dev/null
@@ -0,0 +1,84 @@
+#TODO:
+# disable NLS on demand
+# installation
+# update-po
+# rebuild *.po if vlc.pot has changed (include POTFILES.in)
+
+
+#FIXME: detection ?
+set( GMSGFMT            msgfmt )
+set( MSGFMT             msgfmt )
+set( XGETTEXT           xgettext )
+set( MSGMERGE_UPDATE    msgmerge --update )
+set( MSGINIT            msginit )
+set( MSGCONV            msgconv )
+set( MSGFILTER          msgfilter )
+
+set( POFILES
+    af
+       ar
+       bn
+       ca
+       co
+       cs
+       da
+       de
+       el
+       en_GB
+       es
+       eu
+       fa
+       fi
+       fr
+       fur
+       gl
+       he
+       hi
+       hu
+       it
+       ja
+       ka
+       ko
+       lt
+       lv
+       ms
+       my
+       ne
+       nl
+       no
+       oc
+       pa
+       pl
+       ps
+       pt_BR
+       pt_PT
+       ro
+       ru
+       sk
+       sl
+       sq
+       sv
+       tet
+       th
+       tl
+       tr
+       zh_CN
+       zh_TW
+)
+
+FOREACH( pofile ${POFILES} )
+    set( po-target ${po-target} ${pofile}.gmo )
+ENDFOREACH( pofile)
+
+ADD_CUSTOM_TARGET( all-po ALL
+    DEPENDS ${po-target}
+)
+
+foreach( pofile ${POFILES} )
+    add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${pofile}.gmo
+        COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/${pofile}.gmo
+        COMMAND ${GMSGFMT} -c --statistics -o ${CMAKE_CURRENT_BINARY_DIR}/t-${pofile}.gmo ${CMAKE_CURRENT_SOURCE_DIR}/${pofile}.po
+        COMMAND mv ${CMAKE_CURRENT_BINARY_DIR}/t-${pofile}.gmo ${CMAKE_CURRENT_BINARY_DIR}/${pofile}.gmo
+        DEPENDS ${pofile}.po
+    )
+endforeach( pofile )
index c8881eb..277a4f0 100644 (file)
@@ -24,7 +24,7 @@ include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include)
 # our sources:
 add_subdirectory(src)
 add_subdirectory(modules)
-
+add_subdirectory(po)
 
 
 
index 6b07e68..80c9e44 100644 (file)
@@ -155,6 +155,7 @@ if(APPLE)
 
     add_executable(VLC MACOSX_BUNDLE src/vlc.c)
     target_link_libraries(VLC libvlc)
+    set( MacOS ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/MacOS )
     add_custom_command(
         TARGET VLC
         POST_BUILD
@@ -167,15 +168,16 @@ if(APPLE)
         COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx && xcodebuild -target vlc | grep -vE '^\([ \\t]|$$\)' && cd ../../../../ && cp ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx/build/Default/VLC.bundle/Contents/Info.plist ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents && cp -R ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx/build/Default/VLC.bundle/Contents/Resources/English.lproj ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/Resources
         COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/extras/package/macosx/Resources ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents
         COMMAND find -d ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/Resources -type d -name \\.svn -exec rm -rf {} "\;"
-        COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/MacOS/modules
-        COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/MacOS/modules
-        COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/MacOS/share #remove the link if it exists
-        COMMAND ln -s ${CMAKE_CURRENT_SOURCE_DIR}/share ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/MacOS/share
-        COMMAND find ${CMAKE_CURRENT_BINARY_DIR}/modules -name *.so -exec sh -c \"ln -s {} ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/MacOS/modules/\\`basename {}\\`\" "\;"
-        COMMAND ln -sf VLC ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/MacOS/clivlc #useless?
+        COMMAND rm -rf ${MacOS}/modules ${MacOS}/locale
+        COMMAND mkdir ${MacOS}/modules
+        COMMAND rm -f ${MacOS}/share #remove the link if it exists
+        COMMAND ln -s ${CMAKE_CURRENT_SOURCE_DIR}/share ${MacOS}/share
+        COMMAND find ${CMAKE_CURRENT_BINARY_DIR}/modules -name *.so -exec sh -c \"ln -s {} ${MacOS}/modules/\\`basename {}\\`\" "\;"
+        COMMAND find ${CMAKE_BINARY_DIR}/po -name *.gmo -exec sh -c \"mkdir -p ${MacOS}/locale/\\`basename {}|sed s/\\.gmo//\\`/LC_MESSAGES\; ln -s {} ${MacOS}/locale/\\`basename {}|sed s/\\.gmo//\\`/LC_MESSAGES/vlc.mo\" "\;"
+        COMMAND ln -sf VLC ${MacOS}/clivlc #useless?
         COMMAND printf "APPLVLC#" > ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/PkgInfo
-        #TODO: po/ > VLC.app/locale
     )
+    set( MacOS )
 
 endif(APPLE)
 
@@ -202,8 +204,8 @@ set( VLC_COMPILER "${CMAKE_C_COMPILER}" )
 set(PACKAGE "vlc")
 set(PACKAGE_STRING "vlc")
 set(VERSION_MESSAGE "vlc-0.9.0-svn")
-set(COPYRIGHT_MESSAGE "Copyright VLC Team")
-set(COPYRIGHT_YEARS "2001-2007")
+set(COPYRIGHT_MESSAGE "Copyright © the VideoLAN team")
+set(COPYRIGHT_YEARS "2001-2008")
 
 ###########################################################
 # Options
index 48085de..32ebd63 100755 (executable)
@@ -19,6 +19,9 @@ ln -sf ../$cmake_dir/CMakeLists/src_CMakeLists.txt src/CMakeLists.txt
 echo "Installing modules/CMakeLists.txt"
 ln -s ../$cmake_dir/CMakeLists/modules_CMakeLists.txt modules/CMakeLists.txt
 
+echo "Installing po/CMakeLists.txt"
+ln -s ../$cmake_dir/CMakeLists/po_CMakeLists.txt po/CMakeLists.txt
+
 echo "Installing include/config.h.cmake"
 ln -sf ../$cmake_dir/config.h.cmake include/config.h.cmake