├── .gitattributes ├── .github └── workflows │ ├── continuous-integration.yml │ └── release-validation.yml ├── .gitignore ├── LICENSE.libsrt.txt ├── LICENSE.openssl.txt ├── LICENSE.txt ├── README-old.md ├── README.md ├── build-all.ps1 ├── build-installer.ps1 ├── build-srt.ps1 ├── get-srt-version.ps1 ├── install-libsrt.ps1 ├── install-nsis.ps1 ├── install-openssl.ps1 ├── libsrt.nsi └── libsrt.props /.gitattributes: -------------------------------------------------------------------------------- 1 | # Text files to always convert to native line endings on checkout. 2 | .gitignore text 3 | .gitattributes text 4 | *.txt text 5 | *.md text 6 | 7 | # Text files that will always have CRLF line endings on checkout. 8 | *.ps1 text eol=crlf 9 | *.psm1 text eol=crlf 10 | *.nsi text eol=crlf 11 | *.sln text eol=crlf 12 | *.props text eol=crlf 13 | *.vcxproj text eol=crlf 14 | 15 | # Binary file, do not modify on convert, whatever your git settings are. 16 | *.exe binary 17 | *.bin binary 18 | *.png binary 19 | *.jpg binary 20 | *.ico binary 21 | *.xcf binary 22 | -------------------------------------------------------------------------------- /.github/workflows/continuous-integration.yml: -------------------------------------------------------------------------------- 1 | # GitHub Actions configuration file : Continuous Integration 2 | 3 | name: Continuous integration 4 | 5 | # Trigger the workflow on push or pull request, for master branch only. 6 | on: 7 | push: 8 | branches: 9 | - master 10 | pull_request: 11 | branches: 12 | - master 13 | 14 | jobs: 15 | windows-build: 16 | name: Test Windows build 17 | runs-on: windows-latest 18 | steps: 19 | - uses: actions/checkout@master 20 | - name: Install NSIS 21 | run: .\install-nsis.ps1 -NoPause 22 | - name: Install OpenSSL 23 | run: .\install-openssl.ps1 -NoPause 24 | - name: Build libsrt 25 | run: .\build-all.ps1 -NoPause 26 | - name: Test installer 27 | run: | 28 | Get-ChildItem installers 29 | $bin = Get-ChildItem installers -Recurse -Include 'libsrt*.exe' | Select-Object -Last 1 30 | Start-Process -FilePath $bin.FullName -ArgumentList @("/S") -Wait 31 | Get-ChildItem 'C:\Program Files*\libsrt' -Recurse 32 | -------------------------------------------------------------------------------- /.github/workflows/release-validation.yml: -------------------------------------------------------------------------------- 1 | # GitHub Actions configuration file : Validate published releases 2 | 3 | name: Release validation 4 | 5 | # Trigger the workflow on published releases 6 | on: 7 | release: 8 | types: [published] 9 | 10 | jobs: 11 | install-release: 12 | name: Test installation of latest published release 13 | runs-on: windows-latest 14 | steps: 15 | - uses: actions/checkout@master 16 | - name: Install libsrt 17 | run: .\install-libsrt.ps1 -GitHubActions -NoPause 18 | - name: Check installation 19 | run: | 20 | # Check if the environment variable is correctly passed from job to job. 21 | Write-Output "LIBSRT='$($env:LIBSRT)'" 22 | Get-ChildItem 'C:\Program Files*\libsrt' 23 | Get-ChildItem $($env:LIBSRT) 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | external 2 | installers 3 | *.a 4 | *.o 5 | *.so 6 | *.exe 7 | *.dll 8 | *.lib 9 | *.obj 10 | *.user 11 | *.user.* 12 | [Rr]elease 13 | [Rr]elease-* 14 | [Dd]ebug 15 | [Dd]ebug-* 16 | x64 17 | *.sdf 18 | *.suo 19 | *.opensdf 20 | .vs 21 | ipch 22 | *.VC.db 23 | *.VC.dbopen 24 | *.VC.opendb 25 | *.deb 26 | *.rpm 27 | *.zip 28 | *.tgz 29 | *.gz 30 | *.bz2 31 | *.7z 32 | *.tmp 33 | *.log 34 | *.out 35 | core 36 | core.* 37 | vgcore.* 38 | *.stackdump 39 | *~ 40 | ~* 41 | .#* 42 | *.bak 43 | *.autosave 44 | .project 45 | doxy 46 | tmp 47 | cov-int 48 | *.bin 49 | *.ts 50 | *.trp 51 | .DS_Store 52 | ._* 53 | !release*.yml 54 | -------------------------------------------------------------------------------- /LICENSE.libsrt.txt: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /LICENSE.openssl.txt: -------------------------------------------------------------------------------- 1 | 2 | LICENSE ISSUES 3 | ============== 4 | 5 | The OpenSSL toolkit stays under a double license, i.e. both the conditions of 6 | the OpenSSL License and the original SSLeay license apply to the toolkit. 7 | See below for the actual license texts. 8 | 9 | OpenSSL License 10 | --------------- 11 | 12 | /* ==================================================================== 13 | * Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved. 14 | * 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted provided that the following conditions 17 | * are met: 18 | * 19 | * 1. Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer. 21 | * 22 | * 2. Redistributions in binary form must reproduce the above copyright 23 | * notice, this list of conditions and the following disclaimer in 24 | * the documentation and/or other materials provided with the 25 | * distribution. 26 | * 27 | * 3. All advertising materials mentioning features or use of this 28 | * software must display the following acknowledgment: 29 | * "This product includes software developed by the OpenSSL Project 30 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 31 | * 32 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 33 | * endorse or promote products derived from this software without 34 | * prior written permission. For written permission, please contact 35 | * openssl-core@openssl.org. 36 | * 37 | * 5. Products derived from this software may not be called "OpenSSL" 38 | * nor may "OpenSSL" appear in their names without prior written 39 | * permission of the OpenSSL Project. 40 | * 41 | * 6. Redistributions of any form whatsoever must retain the following 42 | * acknowledgment: 43 | * "This product includes software developed by the OpenSSL Project 44 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 45 | * 46 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 47 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 48 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 49 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 50 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 51 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 52 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 53 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 54 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 55 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 56 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 57 | * OF THE POSSIBILITY OF SUCH DAMAGE. 58 | * ==================================================================== 59 | * 60 | * This product includes cryptographic software written by Eric Young 61 | * (eay@cryptsoft.com). This product includes software written by Tim 62 | * Hudson (tjh@cryptsoft.com). 63 | * 64 | */ 65 | 66 | Original SSLeay License 67 | ----------------------- 68 | 69 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 70 | * All rights reserved. 71 | * 72 | * This package is an SSL implementation written 73 | * by Eric Young (eay@cryptsoft.com). 74 | * The implementation was written so as to conform with Netscapes SSL. 75 | * 76 | * This library is free for commercial and non-commercial use as long as 77 | * the following conditions are aheared to. The following conditions 78 | * apply to all code found in this distribution, be it the RC4, RSA, 79 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 80 | * included with this distribution is covered by the same copyright terms 81 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 82 | * 83 | * Copyright remains Eric Young's, and as such any Copyright notices in 84 | * the code are not to be removed. 85 | * If this package is used in a product, Eric Young should be given attribution 86 | * as the author of the parts of the library used. 87 | * This can be in the form of a textual message at program startup or 88 | * in documentation (online or textual) provided with the package. 89 | * 90 | * Redistribution and use in source and binary forms, with or without 91 | * modification, are permitted provided that the following conditions 92 | * are met: 93 | * 1. Redistributions of source code must retain the copyright 94 | * notice, this list of conditions and the following disclaimer. 95 | * 2. Redistributions in binary form must reproduce the above copyright 96 | * notice, this list of conditions and the following disclaimer in the 97 | * documentation and/or other materials provided with the distribution. 98 | * 3. All advertising materials mentioning features or use of this software 99 | * must display the following acknowledgement: 100 | * "This product includes cryptographic software written by 101 | * Eric Young (eay@cryptsoft.com)" 102 | * The word 'cryptographic' can be left out if the rouines from the library 103 | * being used are not cryptographic related :-). 104 | * 4. If you include any Windows specific code (or a derivative thereof) from 105 | * the apps directory (application code) you must include an acknowledgement: 106 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 107 | * 108 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 109 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 110 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 111 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 112 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 113 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 114 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 115 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 116 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 117 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 118 | * SUCH DAMAGE. 119 | * 120 | * The licence and distribution terms for any publically available version or 121 | * derivative of this code cannot be changed. i.e. this code cannot simply be 122 | * copied and put under another distribution licence 123 | * [including the GNU Public Licence.] 124 | */ 125 | 126 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | SRT library build procedures for Windows 4 | Copyright (c) 2020, Thierry Lelegard 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 21 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /README-old.md: -------------------------------------------------------------------------------- 1 | ## SRT Installer for Windows 2 | 3 | [SRT](https://www.srtalliance.org/) is the Secure Reliable Transport protocol. 4 | 5 | This repository contains scripts to build a binary installer for 6 | [libsrt](https://github.com/Haivision/srt/) on Windows systems for 7 | Visual Studio applications using SRT. 8 | 9 | This repository does not contain any third-party source code, neither libsrt 10 | nor any of its dependencies. It contains only scripts and configuration files 11 | which download third-party source code when necessary and build it. 12 | 13 | ### Rationale 14 | 15 | The SRT library is easily compiled on Unix systems. Most Linux distros already 16 | include a package for libsrt or are about to do it. On macOS, libsrt is available 17 | through Homebrew, the macOS installer for open-source projects. 18 | 19 | But, on Windows systems, including libsrt in an application is a pain, a huge pain. 20 | The intructions for building libsrt on Windows in the 21 | [README file](https://github.com/Haivision/srt/blob/master/README.md) 22 | are sloppy, not to say lousy. 23 | 24 | However, serious software engineering requires build automation and continuous 25 | integration. How can you setup build automation for a Windows application using 26 | libsrt? The answer is simple, you can't. 27 | 28 | This project tries to solves this issue by providing tools and scripts to build 29 | a binary installer for a development environment for libsrt, namely C/C++ header 30 | files and static libraries for 64 and 32 bits applications, in release and debug 31 | configurations. 32 | 33 | Why not providing libsrt DLL's in addition to static libraries? It is a choice which 34 | may change. On Windows, libsrt relies on OpenSSL. If a Windows application is linked 35 | against a libsrt DLL, deploying this application means embedding and deploying 36 | at least two third-party DLL's in addition to libsrt DLL's. This complicates 37 | the deployment and creates risks of inconsistencies. With static libraries, the 38 | application is fully autonomous and no third party DLL is necessary. 39 | 40 | ### Building Windows applications with libsrt 41 | 42 | After installing the libsrt binary, an environment variable named `LIBSRT` is 43 | defined to the installation root (typically `C:\Program Files (x86)\libsrt`). 44 | 45 | In this directory, there is a Visual Studio property file named `libsrt.props`. 46 | Simply reference this property file in your Visual Studio project to use libsrt. 47 | 48 | You can also do that manually by editing the application project file (the XML 49 | file named with a `.vcxproj` extension). Add the following line just before 50 | the end of the file: 51 | 52 | ~~~ 53 | 54 | ~~~ 55 | 56 | ### Building the installer 57 | 58 | The binary installers are available in the 59 | [release](https://github.com/tsduck/srt-win-installer/releases) 60 | section of this project. 61 | 62 | If you want to rebuild the installer yourself, follow these instructions. 63 | The first two steps need to be executed once only. Only the last step needs 64 | to be repeated each time a new version of libsrt is available. 65 | 66 | - Prerequisite 1: Install OpenSSL for Windows, both 64 and 32 bits. 67 | This can be done automatically by running the PowerShell script `install-openssl.ps1`. 68 | - Prerequisite 2: Install NSIS, the NullSoft Installation Scripting system. 69 | This can be done automatically by running the PowerShell script `install-nsis.ps1`. 70 | - Build the libsrt installer by running the PowerShell script `build-all.ps1`. 71 | 72 | That's all. It's just automation... 73 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## SRT Installer for Windows 2 | 3 | This repository is now obsolete. 4 | The core project [libsrt](https://github.com/Haivision/srt/) now creates binaries for Windows. 5 | 6 | The official Windows binaries for libsrt are now here: https://github.com/Haivision/srt/releases 7 | -------------------------------------------------------------------------------- /build-all.ps1: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------- 2 | # 3 | # SRT library build procedures for Windows 4 | # Copyright (c) 2020, Thierry Lelegard 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 2. Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | # THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | #----------------------------------------------------------------------------- 29 | 30 | <# 31 | .SYNOPSIS 32 | 33 | Build everything for the SRT static libraries installer for Windows. 34 | 35 | .PARAMETER BareVersion 36 | 37 | Use the "bare version" number from libsrt (in file version.h). This is the 38 | most recent official version number. Since there are likely some commits 39 | in the libsrt repository since the last commit, this may not be the most 40 | appropriate version number. By default, use a detailed version number 41 | (most recent version, number of commits since then, short commit SHA). 42 | 43 | .PARAMETER NoPause 44 | 45 | Do not wait for the user to press at end of execution. By default, 46 | execute a "pause" instruction at the end of execution, which is useful 47 | when the script was run from Windows Explorer. 48 | 49 | .PARAMETER Tag 50 | 51 | Specify the got tag or commit to build. By default, use the latest repo 52 | state. 53 | #> 54 | [CmdletBinding()] 55 | param( 56 | [switch]$BareVersion = $false, 57 | [switch]$NoPause = $false, 58 | [string]$Tag = "" 59 | ) 60 | 61 | & "$PSScriptRoot\build-srt.ps1" -BareVersion:$BareVersion -Tag $Tag -NoPause 62 | & "$PSScriptRoot\build-installer.ps1" -BareVersion:$BareVersion -NoPause:$NoPause 63 | -------------------------------------------------------------------------------- /build-installer.ps1: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------- 2 | # 3 | # SRT library build procedures for Windows 4 | # Copyright (c) 2020, Thierry Lelegard 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 2. Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | # THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | #----------------------------------------------------------------------------- 29 | 30 | <# 31 | .SYNOPSIS 32 | 33 | Build the SRT static libraries installer for Windows. 34 | 35 | .PARAMETER BareVersion 36 | 37 | Use the "bare version" number from libsrt (in file version.h). This is the 38 | most recent official version number. Since there are likely some commits 39 | in the libsrt repository since the last commit, this may not be the most 40 | appropriate version number. By default, use a detailed version number 41 | (most recent version, number of commits since then, short commit SHA). 42 | 43 | .PARAMETER NoPause 44 | 45 | Do not wait for the user to press at end of execution. By default, 46 | execute a "pause" instruction at the end of execution, which is useful 47 | when the script was run from Windows Explorer. 48 | #> 49 | [CmdletBinding()] 50 | param( 51 | [switch]$BareVersion = $false, 52 | [switch]$NoPause = $false 53 | ) 54 | 55 | Write-Output "SRT libraries installer build procedure" 56 | 57 | # Project directories. 58 | $RootDir = $PSScriptRoot 59 | 60 | # Get version strings. 61 | $Version = (& "$PSScriptRoot\get-srt-version.ps1" -BareVersion:$BareVersion) 62 | $VersionInfo = (& "$PSScriptRoot\get-srt-version.ps1" -BareVersion:$BareVersion -Windows) 63 | Write-Output "SRT version is $Version, Windows version info is $VersionInfo" 64 | 65 | # A function to exit this script. 66 | function Exit-Script([string]$Message = "") 67 | { 68 | $Code = 0 69 | if ($Message -ne "") { 70 | Write-Output "ERROR: $Message" 71 | $Code = 1 72 | } 73 | if (-not $NoPause) { 74 | pause 75 | } 76 | exit $Code 77 | } 78 | 79 | # Locate NSIS, the Nullsoft Scriptable Installation System. 80 | Write-Output "Searching NSIS ..." 81 | $NSIS = Get-Item "C:\Program Files*\NSIS\makensis.exe" | ForEach-Object { $_.FullName} | Select-Object -Last 1 82 | if (-not $NSIS) { 83 | Exit-Script "NSIS not found" 84 | } 85 | 86 | # Create the directory for installers when necessary. 87 | [void] (New-Item -Path "$RootDir\installers" -ItemType Directory -Force) 88 | 89 | # Build the binary installer. 90 | Write-Output "Building installer ..." 91 | & $NSIS /V2 /DVersion=$Version /DVersionInfo=$VersionInfo "$RootDir\libsrt.nsi" 92 | 93 | Exit-Script -NoPause:$NoPause 94 | -------------------------------------------------------------------------------- /build-srt.ps1: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------- 2 | # 3 | # SRT library build procedures for Windows 4 | # Copyright (c) 2020, Thierry Lelegard 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 2. Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | # THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | #----------------------------------------------------------------------------- 29 | 30 | <# 31 | .SYNOPSIS 32 | 33 | Build the SRT library for Windows. 34 | 35 | .PARAMETER BareVersion 36 | 37 | Use the "bare version" number from libsrt (in file version.h). This is the 38 | most recent official version number. Since there are likely some commits 39 | in the libsrt repository since the last commit, this may not be the most 40 | appropriate version number. By default, use a detailed version number 41 | (most recent version, number of commits since then, short commit SHA). 42 | 43 | .PARAMETER NoPause 44 | 45 | Do not wait for the user to press at end of execution. By default, 46 | execute a "pause" instruction at the end of execution, which is useful 47 | when the script was run from Windows Explorer. 48 | 49 | .PARAMETER Tag 50 | 51 | Specify the got tag or commit to build. By default, use the latest repo 52 | state. 53 | #> 54 | [CmdletBinding()] 55 | param( 56 | [switch]$BareVersion = $false, 57 | [switch]$NoPause = $false, 58 | [string]$Tag = "" 59 | ) 60 | 61 | Write-Output "SRT build procedure" 62 | $RepoUrl = "https://github.com/Haivision/srt.git" 63 | 64 | # A function to exit this script. 65 | function Exit-Script([string]$Message = "") 66 | { 67 | $Code = 0 68 | if ($Message -ne "") { 69 | Write-Output "ERROR: $Message" 70 | $Code = 1 71 | } 72 | if (-not $NoPause) { 73 | pause 74 | } 75 | exit $Code 76 | } 77 | 78 | # Local file names. 79 | $RootDir = $PSScriptRoot 80 | $ExtDir = "$RootDir\external" 81 | $RepoDir = "$ExtDir\srt" 82 | 83 | # Create the directory for external products when necessary. 84 | [void](New-Item -Path $ExtDir -ItemType Directory -Force) 85 | 86 | # Locate OpenSSL root from local installation. 87 | $SslRoot = @{ 88 | "x64" = "C:\Program Files\OpenSSL-Win64"; 89 | "Win32" = "C:\Program Files (x86)\OpenSSL-Win32" 90 | } 91 | 92 | # Verify a few files. 93 | $Missing = 0 94 | foreach ($file in @($SslRoot["x64"], $SslRoot["Win32"])) { 95 | if (-not (Test-Path $file)) { 96 | Write-Output "**** Missing $file" 97 | $Missing = $Missing + 1 98 | } 99 | } 100 | if ($Missing -gt 0) { 101 | Exit-Script "Missing $Missing files" 102 | } 103 | 104 | # Clone repository or update it. 105 | # Note that git outputs its log on stderr, so use --quiet. 106 | if (Test-Path "$RepoDir\.git") { 107 | # The repo is already cloned, just update it. 108 | Write-Output "Updating repository ..." 109 | Push-Location $RepoDir 110 | git checkout master --quiet 111 | git pull origin master 112 | Pop-Location 113 | } 114 | else { 115 | # Clone the repo. 116 | Write-Output "Cloning $RepoUrl ..." 117 | git clone --quiet $RepoUrl $RepoDir 118 | if (-not (Test-Path "$RepoDir\.git")) { 119 | Exit-Script "Failed to clone $RepoUrl" 120 | } 121 | } 122 | 123 | # Checkout the required tag. 124 | if ($Tag.Length -gt 0) { 125 | Write-Output "Checking out $Tag ..." 126 | Push-Location $RepoDir 127 | git checkout --quiet $Tag 128 | Pop-Location 129 | 130 | # Cleanup build areas to force a fresh cmake config. 131 | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$RepoDir.build.x64" 132 | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$RepoDir.build.Win32" 133 | } 134 | 135 | # Build the version number. 136 | $Version = (& "$PSScriptRoot\get-srt-version.ps1" -BareVersion:$BareVersion) 137 | Write-Output "==> SRT version is $Version" 138 | 139 | # Locate MSBuild and CMake, regardless of Visual Studio version. 140 | Write-Output "Searching MSBuild and CMake ..." 141 | $MSRoots = @("C:\Program Files*\MSBuild", "C:\Program Files*\Microsoft Visual Studio", "C:\Program Files*\CMake*") 142 | $MSBuild = Get-ChildItem -Recurse -Path $MSRoots -Include MSBuild.exe -ErrorAction Ignore | 143 | ForEach-Object { (Get-Command $_).FileVersionInfo } | 144 | Sort-Object -Unique -Property FileVersion | 145 | ForEach-Object { $_.FileName} | 146 | Select-Object -Last 1 147 | if (-not $MSBuild) { 148 | Exit-Script "MSBuild not found" 149 | } 150 | $CMake = Get-ChildItem -Recurse -Path $MSRoots -Include cmake.exe -ErrorAction Ignore | 151 | ForEach-Object { (Get-Command $_).FileVersionInfo } | 152 | Sort-Object -Unique -Property FileVersion | 153 | ForEach-Object { $_.FileName} | 154 | Select-Object -Last 1 155 | if (-not $CMake) { 156 | Exit-Script "CMake not found" 157 | } 158 | 159 | # Configure and build SRT library using CMake on two architectures. 160 | foreach ($Platform in @("x64", "Win32")) { 161 | 162 | # Build directory: 163 | $SrtBuildDir = "$RepoDir.build.$Platform" 164 | [void](New-Item -Path $SrtBuildDir -ItemType Directory -Force) 165 | 166 | Write-Output "Configuring build for platform $Platform ..." 167 | $SRoot = $SslRoot[$Platform] 168 | & $CMake -S $RepoDir -B $SrtBuildDir -A $Platform ` 169 | -DENABLE_STDCXX_SYNC=ON ` 170 | -DOPENSSL_ROOT_DIR="$SRoot" ` 171 | -DOPENSSL_LIBRARIES="$SRoot\lib\libssl_static.lib;$SRoot\lib\libcrypto_static.lib" ` 172 | -DOPENSSL_INCLUDE_DIR="$SRoot\include" 173 | 174 | # Patch version string in version.h 175 | if (-not $BareVersion) { 176 | Get-Content "$SrtBuildDir\version.h" | 177 | ForEach-Object { 178 | $_ -replace "#define *SRT_VERSION_STRING .*","#define SRT_VERSION_STRING `"$Version`"" 179 | } | 180 | Out-File "$SrtBuildDir\version.new" -Encoding ascii 181 | Move-Item "$SrtBuildDir\version.new" "$SrtBuildDir\version.h" -Force 182 | } 183 | 184 | Write-Output "Building for platform $Platform ..." 185 | foreach ($Conf in @("Release", "Debug")) { 186 | & $MSBuild "$SrtBuildDir\SRT.sln" /nologo /maxcpucount /property:Configuration=$Conf /property:Platform=$Platform /target:srt_static 187 | } 188 | } 189 | 190 | # Verify the presence of compiled libraries. 191 | Write-Output "Checking compiled libraries ..." 192 | $Missing = 0 193 | foreach ($Conf in @("Release", "Debug")) { 194 | foreach ($Platform in @("x64", "Win32")) { 195 | $Path = "$RepoDir.build.$Platform\$Conf\srt_static.lib" 196 | if (-not (Test-Path $Path)) { 197 | Write-Output "**** Missing $Path" 198 | $Missing = $Missing + 1 199 | } 200 | } 201 | } 202 | if ($Missing -gt 0) { 203 | Exit-Script "Missing $Missing files" 204 | } 205 | 206 | Exit-Script 207 | -------------------------------------------------------------------------------- /get-srt-version.ps1: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------- 2 | # 3 | # SRT library build procedures for Windows 4 | # Copyright (c) 2020, Thierry Lelegard 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 2. Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | # THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | #----------------------------------------------------------------------------- 29 | 30 | <# 31 | .SYNOPSIS 32 | 33 | Get the version string of the SRT library. 34 | 35 | .PARAMETER BareVersion 36 | 37 | Use the "bare version" number from libsrt (in file version.h). This is the 38 | most recent official version number. Since there are likely some commits 39 | in the libsrt repository since the last commit, this may not be the most 40 | appropriate version number. By default, use a detailed version number 41 | (most recent version, number of commits since then, short commit SHA). 42 | 43 | .PARAMETER Windows 44 | 45 | Return a "version info" string for Windows executable. 46 | #> 47 | [CmdletBinding()] 48 | param( 49 | [switch]$BareVersion = $false, 50 | [switch]$Windows = $false 51 | ) 52 | 53 | if ($BareVersion) { 54 | # Identify from latest version. 55 | $VersionFile = "$PSScriptRoot\external\srt.build.x64\version.h" 56 | $Major = ((Get-Content $VersionFile | Select-String -Pattern "#define SRT_VERSION_MAJOR ").ToString() -replace "#define SRT_VERSION_MAJOR *","") 57 | $Minor = ((Get-Content $VersionFile | Select-String -Pattern "#define SRT_VERSION_MINOR ").ToString() -replace "#define SRT_VERSION_MINOR *","") 58 | $Patch = ((Get-Content $VersionFile | Select-String -Pattern "#define SRT_VERSION_PATCH ").ToString() -replace "#define SRT_VERSION_PATCH *","") 59 | $Version = "${Major}.${Minor}.${Patch}" 60 | $VersionInfo = "${Major}.${Minor}.${Patch}.0" 61 | } 62 | else { 63 | Push-Location "$PSScriptRoot\external\srt" 64 | $Version = (git describe --tags ) -replace '^v','' -replace '-g','-' 65 | Pop-Location 66 | # Split version string in pieces and make sure it has at least four elements. 67 | $VField = ($Version -split "[-\. ]") + @("0", "0", "0", "0") | Select-String -Pattern '^\d*$' 68 | $VersionInfo = "$($VField[0]).$($VField[1]).$($VField[2]).$($VField[3])" 69 | } 70 | 71 | if ($Windows) { 72 | Write-Output $VersionInfo 73 | } 74 | else { 75 | Write-Output $Version 76 | } 77 | -------------------------------------------------------------------------------- /install-libsrt.ps1: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------- 2 | # 3 | # SRT library build procedures for Windows 4 | # Copyright (c) 2020, Thierry Lelegard 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 2. Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | # THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | #----------------------------------------------------------------------------- 29 | 30 | <# 31 | .SYNOPSIS 32 | 33 | Download and install the libsrt library for Windows. 34 | This script is provided as an example for Windows applications using 35 | libsrt which want to automate their build. 36 | 37 | .PARAMETER Destination 38 | 39 | Specifiy a local directory where the libsrt package will be downloaded. 40 | By default, use "external" subdirectory from this script. 41 | 42 | .PARAMETER ForceDownload 43 | 44 | Force a download even if the package is already downloaded. 45 | 46 | .PARAMETER GitHubActions 47 | 48 | When used in a GitHub Action workflow, make sure that the LIBSRT 49 | environment variable is propagated to subsequent jobs. 50 | 51 | .PARAMETER NoInstall 52 | 53 | Do not install the package. By default, libsrt is installed. 54 | 55 | .PARAMETER NoPause 56 | 57 | Do not wait for the user to press at end of execution. By default, 58 | execute a "pause" instruction at the end of execution, which is useful 59 | when the script was run from Windows Explorer. 60 | #> 61 | [CmdletBinding(SupportsShouldProcess=$true)] 62 | param( 63 | [string]$Destination = "$PSScriptRoot\external", 64 | [switch]$ForceDownload = $false, 65 | [switch]$GitHubActions = $false, 66 | [switch]$NoInstall = $false, 67 | [switch]$NoPause = $false 68 | ) 69 | 70 | Write-Output "libsrt download and installation procedure" 71 | 72 | # Web page for the latest releases of srt-win-installer. 73 | $ReleasePage = "https://github.com/tsduck/srt-win-installer/releases/latest" 74 | 75 | # A function to exit this script. 76 | function Exit-Script([string]$Message = "") 77 | { 78 | $Code = 0 79 | if ($Message -ne "") { 80 | Write-Output "ERROR: $Message" 81 | $Code = 1 82 | } 83 | if (-not $NoPause) { 84 | pause 85 | } 86 | exit $Code 87 | } 88 | 89 | # Without this, Invoke-WebRequest is awfully slow. 90 | $ProgressPreference = 'SilentlyContinue' 91 | 92 | # Get the HTML page for latest libsrt release. 93 | $status = 0 94 | $message = "" 95 | try { 96 | $response = Invoke-WebRequest -UseBasicParsing -UserAgent Download -Uri $ReleasePage 97 | $status = [int] [Math]::Floor($response.StatusCode / 100) 98 | } 99 | catch { 100 | $message = $_.Exception.Message 101 | } 102 | 103 | if ($status -ne 1 -and $status -ne 2) { 104 | # Error fetch NSIS download page. 105 | if ($message -eq "" -and (Test-Path variable:response)) { 106 | Exit-Script "Status code $($response.StatusCode), $($response.StatusDescription)" 107 | } 108 | else { 109 | Exit-Script "#### Error accessing ${ReleasePage}: $message" 110 | } 111 | } 112 | 113 | # Parse HTML page to locate the latest installer. 114 | $Ref = $response.Links.href | Where-Object { $_ -like "*/libsrt-*.exe" } | Select-Object -First 1 115 | 116 | if (-not $Ref) { 117 | Exit-Script "Could not find a reference to libsrt installer in ${ReleasePage}" 118 | } 119 | 120 | # Create the directory for external products when necessary. 121 | [void](New-Item -Path $Destination -ItemType Directory -Force) 122 | 123 | # Build the absolute URL's from base URL (the download page) and href links. 124 | $Url = New-Object -TypeName 'System.Uri' -ArgumentList ([System.Uri]$ReleasePage, $Ref) 125 | $InstallerName = (Split-Path -Leaf $Url.LocalPath) 126 | $InstallerPath = "$Destination\$InstallerName" 127 | 128 | # Download installer 129 | if (-not $ForceDownload -and (Test-Path $InstallerPath)) { 130 | Write-Output "$InstallerName already downloaded, use -ForceDownload to download again" 131 | } 132 | else { 133 | Write-Output "Downloading $Url ..." 134 | Invoke-WebRequest -UseBasicParsing -UserAgent Download -Uri $Url -OutFile $InstallerPath 135 | if (-not (Test-Path $InstallerPath)) { 136 | Exit-Script "$Url download failed" 137 | } 138 | } 139 | 140 | # Install libsrt 141 | if (-not $NoInstall) { 142 | Write-Output "Installing $InstallerName" 143 | Start-Process -FilePath $InstallerPath -ArgumentList @("/S") -Wait 144 | } 145 | 146 | # Propagate LIBSRT in next jobs for GitHub Actions. 147 | if ($GitHubActions) { 148 | $libsrt = [System.Environment]::GetEnvironmentVariable("LIBSRT","Machine") 149 | if ((-not -not $env:GITHUB_ENV) -and (Test-Path $env:GITHUB_ENV)) { 150 | # New version using environment file 151 | Write-Output "LIBSRT=$libsrt" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append 152 | } 153 | else { 154 | # Old version using command on stdout. 155 | Write-Output "::set-env name=LIBSRT::$libsrt" 156 | } 157 | } 158 | 159 | Exit-Script 160 | -------------------------------------------------------------------------------- /install-nsis.ps1: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------- 2 | # 3 | # SRT library build procedures for Windows 4 | # Copyright (c) 2020, Thierry Lelegard 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 2. Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | # THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | #----------------------------------------------------------------------------- 29 | 30 | <# 31 | .SYNOPSIS 32 | 33 | Download, expand and install NSIS, the NullSoft Installer Scripting. 34 | 35 | .PARAMETER ForceDownload 36 | 37 | Force a download even if NSIS is already downloaded. 38 | 39 | .PARAMETER NoInstall 40 | 41 | Do not install the NSIS package. By default, NSIS is installed. 42 | 43 | .PARAMETER NoPause 44 | 45 | Do not wait for the user to press at end of execution. By default, 46 | execute a "pause" instruction at the end of execution, which is useful 47 | when the script was run from Windows Explorer. 48 | #> 49 | [CmdletBinding(SupportsShouldProcess=$true)] 50 | param( 51 | [switch]$ForceDownload = $false, 52 | [switch]$NoInstall = $false, 53 | [switch]$NoPause = $false 54 | ) 55 | 56 | Write-Output "NSIS download and installation procedure" 57 | $NSISPage = "https://nsis.sourceforge.io/Download" 58 | $FallbackURL = "http://prdownloads.sourceforge.net/nsis/nsis-3.05-setup.exe?download" 59 | 60 | # A function to exit this script. 61 | function Exit-Script([string]$Message = "") 62 | { 63 | $Code = 0 64 | if ($Message -ne "") { 65 | Write-Output "ERROR: $Message" 66 | $Code = 1 67 | } 68 | if (-not $NoPause) { 69 | pause 70 | } 71 | exit $Code 72 | } 73 | 74 | # Local file names. 75 | $RootDir = $PSScriptRoot 76 | $ExtDir = "$RootDir\external" 77 | 78 | # Create the directory for external products when necessary. 79 | [void] (New-Item -Path $ExtDir -ItemType Directory -Force) 80 | 81 | # Without this, Invoke-WebRequest is awfully slow. 82 | $ProgressPreference = 'SilentlyContinue' 83 | 84 | # Get the HTML page for NSIS downloads. 85 | $status = 0 86 | $message = "" 87 | $Ref = $null 88 | try { 89 | $response = Invoke-WebRequest -UseBasicParsing -UserAgent Download -Uri $NSISPage 90 | $status = [int] [Math]::Floor($response.StatusCode / 100) 91 | } 92 | catch { 93 | $message = $_.Exception.Message 94 | } 95 | 96 | if ($status -ne 1 -and $status -ne 2) { 97 | # Error fetch NSIS download page. 98 | if ($message -eq "" -and (Test-Path variable:response)) { 99 | Write-Output "Status code $($response.StatusCode), $($response.StatusDescription)" 100 | } 101 | else { 102 | Write-Output "#### Error accessing ${NSISPage}: $message" 103 | } 104 | } 105 | else { 106 | # Parse HTML page to locate the latest installer. 107 | $Ref = $response.Links.href | Where-Object { $_ -like "*/nsis-*-setup.exe?download" } | Select-Object -First 1 108 | } 109 | 110 | if (-not $Ref) { 111 | # Could not find a reference to NSIS installer. 112 | $Url = [System.Uri]$FallbackURL 113 | } 114 | else { 115 | # Build the absolute URL's from base URL (the download page) and href links. 116 | $Url = New-Object -TypeName 'System.Uri' -ArgumentList ([System.Uri]$NSISPage, $Ref) 117 | } 118 | 119 | $InstallerName = (Split-Path -Leaf $Url.LocalPath) 120 | $InstallerPath = "$ExtDir\$InstallerName" 121 | 122 | # Download installer 123 | if (-not $ForceDownload -and (Test-Path $InstallerPath)) { 124 | Write-Output "$InstallerName already downloaded, use -ForceDownload to download again" 125 | } 126 | else { 127 | Write-Output "Downloading $Url ..." 128 | Invoke-WebRequest -UseBasicParsing -UserAgent Download -Uri $Url -OutFile $InstallerPath 129 | if (-not (Test-Path $InstallerPath)) { 130 | Exit-Script "$Url download failed" 131 | } 132 | } 133 | 134 | # Install NSIS 135 | if (-not $NoInstall) { 136 | Write-Output "Installing $InstallerName" 137 | Start-Process -FilePath $InstallerPath -ArgumentList @("/S") -Wait 138 | } 139 | 140 | Exit-Script 141 | -------------------------------------------------------------------------------- /install-openssl.ps1: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------- 2 | # 3 | # SRT library build procedures for Windows 4 | # Copyright (c) 2020, Thierry Lelegard 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # 2. Redistributions in binary form must reproduce the above copyright 13 | # notice, this list of conditions and the following disclaimer in the 14 | # documentation and/or other materials provided with the distribution. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | # THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | #----------------------------------------------------------------------------- 29 | 30 | <# 31 | .SYNOPSIS 32 | 33 | Download, expand and install OpenSSL for Windows. 34 | 35 | .PARAMETER ForceDownload 36 | 37 | Force a download even if the OpenSSL installers are already downloaded. 38 | 39 | .PARAMETER NoInstall 40 | 41 | Do not install the OpenSSL packages. By default, OpenSSL is installed. 42 | 43 | .PARAMETER NoPause 44 | 45 | Do not wait for the user to press at end of execution. By default, 46 | execute a "pause" instruction at the end of execution, which is useful 47 | when the script was run from Windows Explorer. 48 | #> 49 | [CmdletBinding(SupportsShouldProcess=$true)] 50 | param( 51 | [switch]$ForceDownload = $false, 52 | [switch]$NoInstall = $false, 53 | [switch]$NoPause = $false 54 | ) 55 | 56 | Write-Output "OpenSSL download and installation procedure" 57 | $OpenSSLHomePage = "http://slproweb.com/products/Win32OpenSSL.html" 58 | 59 | # A function to exit this script. 60 | function Exit-Script([string]$Message = "") 61 | { 62 | $Code = 0 63 | if ($Message -ne "") { 64 | Write-Output "ERROR: $Message" 65 | $Code = 1 66 | } 67 | if (-not $NoPause) { 68 | pause 69 | } 70 | exit $Code 71 | } 72 | 73 | # Local file names. 74 | $RootDir = $PSScriptRoot 75 | $ExtDir = "$RootDir\external" 76 | 77 | # Create the directory for external products when necessary. 78 | [void] (New-Item -Path $ExtDir -ItemType Directory -Force) 79 | 80 | # Without this, Invoke-WebRequest is awfully slow. 81 | $ProgressPreference = 'SilentlyContinue' 82 | 83 | # Get the HTML page for OpenSSL downloads. 84 | $status = 0 85 | $message = "" 86 | try { 87 | $response = Invoke-WebRequest -UseBasicParsing -UserAgent Download -Uri $OpenSSLHomePage 88 | $status = [int] [Math]::Floor($response.StatusCode / 100) 89 | } 90 | catch { 91 | $message = $_.Exception.Message 92 | } 93 | if ($status -ne 1 -and $status -ne 2) { 94 | if ($message -eq "" -and (Test-Path variable:response)) { 95 | Exit-Script "Status code $($response.StatusCode), $($response.StatusDescription)" 96 | } 97 | else { 98 | Exit-Script "#### Error accessing ${OpenSSLHomePage}: $message" 99 | } 100 | } 101 | 102 | # Parse HTML page to locate the latest MSI files. 103 | $Ref32 = $response.Links.href | Where-Object { $_ -like "*/Win32OpenSSL-*.msi" } | Select-Object -First 1 104 | $Ref64 = $response.Links.href | Where-Object { $_ -like "*/Win64OpenSSL-*.msi" } | Select-Object -First 1 105 | 106 | # Build the absolute URL's from base URL (the download page) and href links. 107 | $Url32 = New-Object -TypeName 'System.Uri' -ArgumentList ([System.Uri]$OpenSSLHomePage, $Ref32) 108 | $Url64 = New-Object -TypeName 'System.Uri' -ArgumentList ([System.Uri]$OpenSSLHomePage, $Ref64) 109 | 110 | # Download and install one MSI package. 111 | function Download-Install([string]$Url) 112 | { 113 | $MsiName = (Split-Path -Leaf $Url.toString()) 114 | $MsiPath = "$ExtDir\$MsiName" 115 | 116 | if (-not $ForceDownload -and (Test-Path $MsiPath)) { 117 | Write-Output "$MsiName already downloaded, use -ForceDownload to download again" 118 | } 119 | else { 120 | Write-Output "Downloading $Url ..." 121 | Invoke-WebRequest -UseBasicParsing -UserAgent Download -Uri $Url -OutFile $MsiPath 122 | } 123 | 124 | if (-not (Test-Path $MsiPath)) { 125 | Exit-Script "$Url download failed" 126 | } 127 | 128 | if (-not $NoInstall) { 129 | Write-Output "Installing $MsiName" 130 | Start-Process msiexec.exe -ArgumentList @("/i", $MsiPath, "/qn", "/norestart") -Wait 131 | } 132 | } 133 | 134 | # Download and install the two MSI packages. 135 | Download-Install $Url32 136 | Download-Install $Url64 137 | Exit-Script 138 | -------------------------------------------------------------------------------- /libsrt.nsi: -------------------------------------------------------------------------------- 1 | ;----------------------------------------------------------------------------- 2 | ; 3 | ; SRT library build procedures for Windows 4 | ; Copyright (c) 2020, Thierry Lelegard 5 | ; All rights reserved. 6 | ; 7 | ; Redistribution and use in source and binary forms, with or without 8 | ; modification, are permitted provided that the following conditions are met: 9 | ; 10 | ; 1. Redistributions of source code must retain the above copyright notice, 11 | ; this list of conditions and the following disclaimer. 12 | ; 2. Redistributions in binary form must reproduce the above copyright 13 | ; notice, this list of conditions and the following disclaimer in the 14 | ; documentation and/or other materials provided with the distribution. 15 | ; 16 | ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | ; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | ; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | ; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | ; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | ; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | ; THE POSSIBILITY OF SUCH DAMAGE. 27 | ; 28 | ;----------------------------------------------------------------------------- 29 | ; 30 | ; NSIS script to build the SRT binary installer for Windows. 31 | ; Do not invoke NSIS directly, use PowerShell script build-installer.ps1. 32 | ; 33 | ; Required command-line definitions: 34 | ; - Version : Product version. 35 | ; - VersionInfo : Product version info in Windows format. 36 | ; 37 | ;----------------------------------------------------------------------------- 38 | 39 | Name "SRT" 40 | Caption "SRT Libraries Installer" 41 | 42 | !verbose push 43 | !verbose 0 44 | !include "MUI2.nsh" 45 | !include "Sections.nsh" 46 | !include "TextFunc.nsh" 47 | !include "FileFunc.nsh" 48 | !include "WinMessages.nsh" 49 | !include "x64.nsh" 50 | !verbose pop 51 | 52 | !define ProductName "libsrt" 53 | !define InstallerDir "installers" 54 | !define RepoDir "external\srt" 55 | !define Build32Dir "external\srt.build.Win32" 56 | !define Build64Dir "external\srt.build.x64" 57 | !define SSL32Dir "C:\Program Files (x86)\OpenSSL-Win32" 58 | !define SSL64Dir "C:\Program Files\OpenSSL-Win64" 59 | 60 | ; Installer file information. 61 | ; Legal note: The libsrt copyright is held by Haivision. 62 | VIProductVersion ${VersionInfo} 63 | VIAddVersionKey ProductName "${ProductName}" 64 | VIAddVersionKey ProductVersion "${Version}" 65 | VIAddVersionKey Comments "The SRT static libraries for Visual C++ on Windows" 66 | VIAddVersionKey LegalCopyright "Copyright (c) 2018 Haivision Systems Inc." 67 | VIAddVersionKey FileVersion "${VersionInfo}" 68 | VIAddVersionKey FileDescription "SRT Installer" 69 | 70 | ; Name of binary installer file. 71 | OutFile "${InstallerDir}\${ProductName}-${Version}.exe" 72 | 73 | ; Generate a Unicode installer (default is ANSI). 74 | Unicode true 75 | 76 | ; Registry key for environment variables 77 | !define EnvironmentKey '"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' 78 | 79 | ; Registry entry for product info and uninstallation info. 80 | !define ProductKey "Software\${ProductName}" 81 | !define UninstallKey "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ProductName}" 82 | 83 | ; Use XP manifest. 84 | XPStyle on 85 | 86 | ; Request administrator privileges for Windows Vista and higher. 87 | RequestExecutionLevel admin 88 | 89 | ; "Modern User Interface" (MUI) settings. 90 | !define MUI_ABORTWARNING 91 | 92 | ; Default installation folder. 93 | InstallDir "$PROGRAMFILES\${ProductName}" 94 | 95 | ; Get installation folder from registry if available from a previous installation. 96 | InstallDirRegKey HKLM "${ProductKey}" "InstallDir" 97 | 98 | ; Installer pages. 99 | !insertmacro MUI_PAGE_DIRECTORY 100 | !insertmacro MUI_PAGE_INSTFILES 101 | 102 | ; Uninstaller pages. 103 | !insertmacro MUI_UNPAGE_CONFIRM 104 | !insertmacro MUI_UNPAGE_INSTFILES 105 | 106 | ; Languages. 107 | !insertmacro MUI_LANGUAGE "English" 108 | 109 | ; Installation initialization. 110 | function .onInit 111 | ; In 64-bit installers, don't use registry redirection. 112 | ${If} ${RunningX64} 113 | SetRegView 64 114 | ${EndIf} 115 | functionEnd 116 | 117 | ; Uninstallation initialization. 118 | function un.onInit 119 | ; In 64-bit installers, don't use registry redirection. 120 | ${If} ${RunningX64} 121 | SetRegView 64 122 | ${EndIf} 123 | functionEnd 124 | 125 | ; Installation section 126 | Section "Install" 127 | 128 | ; Work on "all users" context, not current user. 129 | SetShellVarContext all 130 | 131 | ; Delete obsolete files from previous versions. 132 | Delete "$INSTDIR\LICENSE.pthread.txt" 133 | Delete "$INSTDIR\include\srt\srt4udt.h" 134 | Delete "$INSTDIR\include\srt\udt.h" 135 | Delete "$INSTDIR\lib\Release-x64\pthread.lib" 136 | Delete "$INSTDIR\lib\Release-Win32\pthread.lib" 137 | Delete "$INSTDIR\lib\Debug-x64\srt.pdb" 138 | Delete "$INSTDIR\lib\Debug-x64\pthread.pdb" 139 | Delete "$INSTDIR\lib\Debug-x64\pthread.lib" 140 | Delete "$INSTDIR\lib\Debug-Win32\srt.pdb" 141 | Delete "$INSTDIR\lib\Debug-Win32\pthread.pdb" 142 | Delete "$INSTDIR\lib\Debug-Win32\pthread.lib" 143 | 144 | ; Visual Studio property files. 145 | SetOutPath "$INSTDIR" 146 | File LICENSE.libsrt.txt 147 | File LICENSE.openssl.txt 148 | File "libsrt.props" 149 | 150 | ; Header files. 151 | CreateDirectory "$INSTDIR\include\srt" 152 | SetOutPath "$INSTDIR\include\srt" 153 | File "${RepoDir}\srtcore\logging_api.h" 154 | File "${RepoDir}\srtcore\platform_sys.h" 155 | File "${RepoDir}\srtcore\srt.h" 156 | File "${Build64Dir}\version.h" 157 | 158 | CreateDirectory "$INSTDIR\include\win" 159 | SetOutPath "$INSTDIR\include\win" 160 | File "${RepoDir}\common\win\syslog_defs.h" 161 | 162 | ; Libraries. 163 | CreateDirectory "$INSTDIR\lib" 164 | 165 | CreateDirectory "$INSTDIR\lib\Release-x64" 166 | SetOutPath "$INSTDIR\lib\Release-x64" 167 | File /oname=srt.lib "${Build64Dir}\Release\srt_static.lib" 168 | File /oname=libcrypto.lib "${SSL64Dir}\lib\VC\static\libcrypto64MD.lib" 169 | File /oname=libssl.lib "${SSL64Dir}\lib\VC\static\libssl64MD.lib" 170 | 171 | CreateDirectory "$INSTDIR\lib\Debug-x64" 172 | SetOutPath "$INSTDIR\lib\Debug-x64" 173 | File /oname=srt.lib "${Build64Dir}\Debug\srt_static.lib" 174 | File /oname=libcrypto.lib "${SSL64Dir}\lib\VC\static\libcrypto64MDd.lib" 175 | File /oname=libssl.lib "${SSL64Dir}\lib\VC\static\libssl64MDd.lib" 176 | 177 | CreateDirectory "$INSTDIR\lib\Release-Win32" 178 | SetOutPath "$INSTDIR\lib\Release-Win32" 179 | File /oname=srt.lib "${Build32Dir}\Release\srt_static.lib" 180 | File /oname=libcrypto.lib "${SSL32Dir}\lib\VC\static\libcrypto32MD.lib" 181 | File /oname=libssl.lib "${SSL32Dir}\lib\VC\static\libssl32MD.lib" 182 | 183 | CreateDirectory "$INSTDIR\lib\Debug-Win32" 184 | SetOutPath "$INSTDIR\lib\Debug-Win32" 185 | File /oname=srt.lib "${Build32Dir}\Debug\srt_static.lib" 186 | File /oname=libcrypto.lib "${SSL32Dir}\lib\VC\static\libcrypto32MDd.lib" 187 | File /oname=libssl.lib "${SSL32Dir}\lib\VC\static\libssl32MDd.lib" 188 | 189 | ; Add an environment variable to installation root. 190 | WriteRegStr HKLM ${EnvironmentKey} "LIBSRT" "$INSTDIR" 191 | 192 | ; Store installation folder in registry. 193 | WriteRegStr HKLM "${ProductKey}" "InstallDir" $INSTDIR 194 | 195 | ; Create uninstaller 196 | WriteUninstaller "$INSTDIR\Uninstall.exe" 197 | 198 | ; Declare uninstaller in "Add/Remove Software" control panel 199 | WriteRegStr HKLM "${UninstallKey}" "DisplayName" "${ProductName}" 200 | WriteRegStr HKLM "${UninstallKey}" "DisplayVersion" "${Version}" 201 | WriteRegStr HKLM "${UninstallKey}" "DisplayIcon" "$INSTDIR\Uninstall.exe" 202 | WriteRegStr HKLM "${UninstallKey}" "UninstallString" "$INSTDIR\Uninstall.exe" 203 | 204 | ; Get estimated size of installed files 205 | ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 206 | IntFmt $0 "0x%08X" $0 207 | WriteRegDWORD HKLM "${UninstallKey}" "EstimatedSize" "$0" 208 | 209 | ; Notify applications of environment modifications 210 | SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 211 | 212 | SectionEnd 213 | 214 | ; Uninstallation section 215 | Section "Uninstall" 216 | 217 | ; Work on "all users" context, not current user. 218 | SetShellVarContext all 219 | 220 | ; Get installation folder from registry 221 | ReadRegStr $0 HKLM "${ProductKey}" "InstallDir" 222 | 223 | ; Delete product registry entries 224 | DeleteRegKey HKCU "${ProductKey}" 225 | DeleteRegKey HKLM "${ProductKey}" 226 | DeleteRegKey HKLM "${UninstallKey}" 227 | DeleteRegValue HKLM ${EnvironmentKey} "LIBSRT" 228 | 229 | ; Delete product files. 230 | RMDir /r "$0\include" 231 | RMDir /r "$0\lib" 232 | Delete "$0\libsrt.props" 233 | Delete "$0\LICENSE.libsrt.txt" 234 | Delete "$0\LICENSE.openssl.txt" 235 | Delete "$0\Uninstall.exe" 236 | RMDir "$0" 237 | 238 | ; Notify applications of environment modifications 239 | SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 240 | 241 | SectionEnd 242 | -------------------------------------------------------------------------------- /libsrt.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | $(LIBSRT)\include;%(AdditionalIncludeDirectories) 11 | 12 | 13 | srt.lib;libssl.lib;libcrypto.lib;crypt32.lib;ws2_32.lib;%(AdditionalDependencies) 14 | $(LIBSRT)\lib\$(Configuration)-$(Platform);%(AdditionalLibraryDirectories) 15 | /ignore:4099 %(AdditionalOptions) 16 | 17 | 18 | 19 | 20 | --------------------------------------------------------------------------------