1# MediaInfoLib/Release/PrepareSource.sh 2# Prepare the source of MediaInfoLib 3 4# Copyright (c) MediaArea.net SARL. All Rights Reserved. 5# Use of this source code is governed by a BSD-style license that can 6# be found in the License.html file in the root of the source tree. 7 8function _get_source () { 9 10 # Determine where are the sources of the project 11 if [ $(b.opt.get_opt --source-path) ]; then 12 MIL_source=$(sanitize_arg $(b.opt.get_opt --source-path)) 13 else 14 if [ $(b.opt.get_opt --repo-url) ]; then 15 RepoURL=$(sanitize_arg $(b.opt.get_opt --repo-url)) 16 else 17 RepoURL="https://github.com/MediaArea/" 18 fi 19 getRepo MediaInfoLib $RepoURL $Path 20 MIL_source=$Path/$Project 21 fi 22 23 # Dependency : ZenLib 24 if [ $(b.opt.get_opt --repo-url) ]; then 25 RepoURL=$(sanitize_arg $(b.opt.get_opt --repo-url)) 26 else 27 RepoURL="https://github.com/MediaArea/" 28 fi 29 echo 30 getRepo ZenLib $RepoURL $Path 31 ZL_source=$Path/ZenLib 32 33 # Dependency : zlib 34 echo 35 getRepo zlib https://github.com/madler/ $Path 36 zlib_source=$Path/zlib 37 38} 39 40function _linux_compil () { 41 42 echo 43 echo "Create the archive for compilation on Linux:" 44 echo "1: copy what is wanted..." 45 46 cd $Path 47 mkdir MediaInfo_DLL_${Version}_GNU_FromSource 48 cd MediaInfo_DLL_${Version}_GNU_FromSource 49 50 cp -r $ZL_source . 51 cp -r $MIL_source . 52 mv MediaInfoLib/Project/GNU/Library/AddThisToRoot_DLL_compile.sh SO_Compile.sh 53 # TODO: call the function who build a clean ZenLib compil archive 54 55 mkdir -p Shared/Project/_Common 56 cp -r $zlib_source Shared/Project 57 #cp -r $curl_source Shared/Project 58 59 echo "2: remove what isn't wanted..." 60 cd MediaInfoLib 61 rm -f .cvsignore .gitignore 62 rm -fr .git 63 rm -f ToDo.txt 64 rm -f ReadMe.txt 65 rm -fr debian 66 cd Project 67 rm -f GNU/libmediainfo.dsc GNU/libmediainfo.spec 68 rm -fr Solaris 69 rm -fr BCB CMake CodeBlocks Coverity Delphi Java NetBeans 70 rm -fr MSCS2008 MSCS2010 MSJS MSVB MSVB2010 71 rm -fr MSVC2005 MSVC2008 MSVC2010 MSVC2012 MSVC2013 72 rm -fr PureBasic 73 cd .. 74 rm -fr Contrib 75 rm -fr Release 76 #cd Release 77 # rm -f CleanUp.bat Example.ogg ReadMe_DLL_Windows.txt 78 # rm -f Release_DLL_GNU_Prepare.bat Release_Lib_GNU_Prepare.bat 79 # rm -f Release_DLL_Windows_i386.bat Release_DLL_Windows_x64.bat 80 # rm -f Release_Source.bat UpgradeVersion.sh 81 #cd .. 82 cd Source 83 rm -f Doc/setlocale.txt 84 rm -fr Install 85 rm -fr PreRelease 86 rm -fr RegressionTest 87 rm -fr Resource 88 rm -f MediaInfoDLL/MediaInfoDLL.def 89 rm -f MediaInfoDLL/MediaInfoDLL.jsl 90 rm -f MediaInfoDLL/MediaInfoDLL.pas 91 rm -f MediaInfoDLL/MediaInfoDLL.pb 92 rm -f MediaInfoDLL/MediaInfoDLL.vb 93 rm -f ThirdParty/aes-gladman/aes_amd64.asm 94 rm -f ThirdParty/aes-gladman/aes.txt 95 rm -f ThirdParty/aes-gladman/aes_x86_v1.asm 96 rm -f ThirdParty/aes-gladman/aes_x86_v2.asm 97 rm -f ThirdParty/aes-gladman/via_ace.txt 98 cd .. 99 cd .. 100 101 if $MakeArchives; then 102 echo "3: compressing..." 103 cd $Path 104 mkdir archives 105 # To specify the compression level 106 #$(/bin/tar -cf MediaInfo_Lib_Source.tar MediaInfoLib/) 107 (GZIP=-9 tar -czf archives/MediaInfo_DLL_${Version}_GNU_FromSource.tgz MediaInfo_DLL_${Version}_GNU_FromSource) 108 (BZIP=-9 tar -cjf archives/MediaInfo_DLL_${Version}_GNU_FromSource.tbz MediaInfo_DLL_${Version}_GNU_FromSource) 109 (XZ_OPT=-9e tar -cJf archives/MediaInfo_DLL_${Version}_GNU_FromSource.txz MediaInfo_DLL_${Version}_GNU_FromSource) 110 fi 111 112} 113 114function btask.PrepareSource.run () { 115 116 Project=MediaInfoLib 117 Path=/tmp/ma 118 119 LinuxCompil=false 120 if b.opt.has_flag? --linux-compil; then 121 LinuxCompil=true 122 fi 123 WindowsCompil=false 124 if b.opt.has_flag? --windows-compil; then 125 WindowsCompil=true 126 fi 127 LinuxPackages=false 128 if b.opt.has_flag? --linux-packages; then 129 LinuxPackages=true 130 fi 131 AllTarget=false 132 if b.opt.has_flag? --all; then 133 AllTarget=true 134 fi 135 MakeArchives=true 136 if b.opt.has_flag? --no-archives; then 137 MakeArchives=false 138 fi 139 #CleanUp=true 140 #if [ $(b.opt.get_opt --no-cleanup) ]; then 141 # CleanUp=false 142 #fi 143 144 #mkdir $Path 145 cd $Path 146 rm -fr archives 147 rm -fr MediaInfo_DLL_${Version}_GNU_FromSource 148 149 if $LinuxCompil || $WindowsCompil || $LinuxPackages || $AllTarget; then 150 _get_source 151 else 152 echo "Besides --project and --version, you must specify at least" 153 echo "one of this options:" 154 echo 155 echo "--linux-compil|-lc" 156 echo " Create the archive for compilation on Linux" 157 echo 158 echo "--windows-compil|-wc" 159 echo " Create the archive for compilation on Windows" 160 echo 161 echo "--linux-packages|-lp|--linux-package" 162 echo " Create the archive for Linux packages creation" 163 echo 164 echo "--all|-a" 165 echo " Create all the targets for this project" 166 fi 167 if $LinuxCompil; then 168 _linux_compil 169 fi 170 if $WindowsCompil; then 171 echo _windows_compil 172 fi 173 if $LinuxPackages; then 174 echo _linux_packages 175 fi 176 if $AllTarget; then 177 _linux_compil 178 echo _windows_compil 179 echo _linux_packages 180 fi 181 182 #..\..\Shared\Binary\Windows_i386\7-zip\7z a -r -t7z -mx9 libmediainfo__AllInclusive.7z MediaInfoLib\* ZenLib\* zlib\* 183 # unix (look the man): 184 #7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1 185 186 187 # Clean up 188 # TODO: ??? existing in Release_Source.bat but not in Release_Source.sh 189 190 #unset -v MIL_files index MIL_source 191} 192