language: c
-os:
- - linux
- - osx
- - windows
-
addons:
homebrew:
packages:
- apache2-dev
before_install:
- - if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install apache-httpd --params '/installLocation:C:\' ; fi
- cd mod_authnz_external
-script:
- - if [ "$TRAVIS_OS_NAME" != "windows" ]; then make ; fi
- - if [ "$TRAVIS_OS_NAME" = "windows" ]; then export PATH="/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/:$PATH" ; fi
- - if [ "$TRAVIS_OS_NAME" = "windows" ]; then ls "/c/Program Files (x86)/Windows Kits/10/Include" ; fi
- - if [ "$TRAVIS_OS_NAME" = "windows" ]; then curl https://raw.githubusercontent.com/traviscross/apr/master/include/apr_perms_set.h -o C:\\Apache24\\include\\apr_perms_set.h ; fi
- - if [ "$TRAVIS_OS_NAME" = "windows" ]; then cl mod_authnz_external.c -c -D_WINDOWS -IC:\\Apache24\\include -I"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\include" -I"C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.16299.0\\shared" -I"C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.16299.0\\ucrt" -I"C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.16299.0\\um" ; fi
- - if [ "$TRAVIS_OS_NAME" = "windows" ]; then link /out:C:\\Apache24\\modules\\mod_authnz_external.so /libpath:C:\\Apache24\\lib /libpath:"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.16299.0\\ucrt\\x64" /libpath:"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.16299.0\\um\\x64" /libpath:"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\lib\\amd64" -DLL libhttpd.lib libapr-1.lib libaprutil-1.lib mod_authnz_external.obj ; fi
- - if [ "$TRAVIS_OS_NAME" != "windows" ]; then sudo make install ; fi
- - if [ "$TRAVIS_OS_NAME" = "windows" ]; then echo "LoadModule authnz_external_module modules/mod_authnz_external.so" >> /c/Apache24/conf/httpd.conf ; fi
- - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo service apache2 restart ; fi
- - if [ "$TRAVIS_OS_NAME" = "osx" ]; then sudo brew services restart httpd ; fi
- - if [ "$TRAVIS_OS_NAME" = "windows" ]; then sc stop Apache; sleep 60; sc start Apache ; sleep 60; sc query Apache ; fi
\ No newline at end of file
+matrix:
+ include:
+ - name: "Linux Build"
+ os: linux
+ script:
+ - make
+ - sudo make install
+ - sudo service apache2 restart
+ - name: "Mac OS X Build"
+ os: osx
+ script:
+ - make
+ - sudo make install
+ - sudo brew services restart httpd
+ cache:
+ directories:
+ - $HOME/Library/Caches/Homebrew
+ - /usr/local/Homebrew
+ before_cache:
+ - brew cleanup
+ # Credit https://discourse.brew.sh/t/best-practice-for-homebrew-on-travis-brew-update-is-5min-to-build-time/5215/9
+ - find /usr/local/Homebrew \! -regex ".+\.git.+" -delete
+ - name: "Windows Build"
+ os: windows
+ install: choco install apache-httpd --params '/installLocation:C:\'
+ script:
+ # add environment variables
+ - export PATH="/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/:$PATH"
+ - export APACHEPATH="C:\\Apache24"
+ # this 'apr_perms_set.h' header is missing from Chocolatey's Apache install
+ - curl https://raw.githubusercontent.com/traviscross/apr/master/include/apr_perms_set.h -o $APACHEPATH\\include\\apr_perms_set.h
+ # call vcvars.bat to setup the environment, then call nmake to build the module
+ - echo 'call "C:\Program Files (x86)\Microsoft Visual Studio 14.0/VC/bin/amd64/vcvars64.bat"' > winbuild.bat
+ - echo -e "\r\n" >> winbuild.bat
+ - echo nmake -f \"$(pwd -W)/Makefile.win\" >> winbuild.bat
+ - cmd //c winbuild.bat
+ # install the compiled module in Apache and try to reload Apache
+ - cp mod_authnz_external.so $APACHEPATH\\modules\\mod_authnz_external.so
+ - echo "LoadModule authnz_external_module modules/mod_authnz_external.so" >> /c/Apache24/conf/httpd.conf
+ - sc stop Apache; sleep 15; sc start Apache ; sleep 15; sc query Apache
--- /dev/null
+#NMAKE format makefile for Visual Studio on Windows
+
+all: build
+
+build: mod_authnz_external.so
+
+!IF !DEFINED(VISUALSTUDIOVERSION)
+!ERROR Must be run from within the vcvars.bat environment!
+!ENDIF
+
+!IF !DEFINED(APACHEPATH)
+!ERROR APACHEPATH environment variable must point to the local installation of Apache httpd!
+!ENDIF
+
+mod_authnz_external.so: mod_authnz_external.obj
+ @echo Successful compile - linking module
+ @echo .
+ @link /dll /libpath:"$(APACHEPATH)\lib" /out:mod_authnz_external.so mod_authnz_external.obj libhttpd.lib libapr-1.lib libaprutil-1.lib
+
+mod_authnz_external.obj: mod_authnz_external.c
+ @echo Visual Studio $(VISUALSTUDIOVERSION) is installed
+ @echo Apache is installed in $(APACHEPATH)
+ @echo .
+ @cl -c -D_WINDOWS -I$(APACHEPATH)\include mod_authnz_external.c
+
+clean:
+ del mod_authnz_external.so mod_authnz_external.obj mod_authnz_external.exp mod_authnz_external.lib
+